mirror of
https://github.com/frida/tinycc
synced 2024-12-23 05:26:49 +03:00
0cc24d0e84
* -dt now with lowercase t * test snippets now separated by real preprocessor statements which is valid C also for other compilers #if defined test_xxx < test snippet x > #elif defined test_yyy < test snippet y > #elif ... #endif * simpler implementation, behaves like -run if no 'test_...' macros are seen, works with -E too * for demonstration I combined some of the small tests for errors and warnings (56..63,74) in "60_errors_and_warnings.c" Also: * libtcc.c: put tcc_preprocess() and tcc_assemble() under the setjmp clause to let them return to caller after errors. This is for -dt -E. * tccgen.c: - get rid of save/restore_parse_state(), macro_ptr is saved by begin_macro anyway, now line_num too. - use expr_eq for parsing _Generic's controlling_type - set nocode_wanted with const_wanted. too, This is to keep VT_JMP on vtop when parsing preprocessor expressions. * tccpp.c: tcc -E: suppress trailing whitespace from lines with comments (that -E removes) such as NO_GOTPLT_ENTRY,\t /* never generate ... */
52 lines
857 B
C
52 lines
857 B
C
#if defined test_56_btype_excess_1
|
|
struct A {} int i;
|
|
|
|
#elif defined test_57_btype_excess_2
|
|
char int i;
|
|
|
|
#elif defined test_58_function_redefinition
|
|
int f(void) { return 0; }
|
|
int f(void) { return 1; }
|
|
|
|
#elif defined test_global_redefinition
|
|
int xxx = 1;
|
|
int xxx;
|
|
int xxx = 2;
|
|
|
|
#elif defined test_59_function_array
|
|
int (*fct)[42](int x);
|
|
|
|
#elif defined test_60_enum_redefinition
|
|
enum color { RED, GREEN, BLUE };
|
|
enum color { R, G, B };
|
|
enum color c;
|
|
|
|
#elif defined test_62_enumerator_redefinition
|
|
enum color { RED, GREEN, BLUE };
|
|
enum rgb { RED, G, B};
|
|
enum color c = RED;
|
|
|
|
#elif defined test_63_local_enumerator_redefinition
|
|
enum {
|
|
FOO,
|
|
BAR
|
|
};
|
|
|
|
int main(void)
|
|
{
|
|
enum {
|
|
FOO = 2,
|
|
BAR
|
|
};
|
|
|
|
return BAR - FOO;
|
|
}
|
|
|
|
#elif defined test_61_undefined_enum
|
|
enum rgb3 c = 42;
|
|
|
|
#elif defined test_74_non_const_init
|
|
int i = i++;
|
|
|
|
#endif
|