From 07e47b3dd68d264a6223c1b74aa64d61a14ac240 Mon Sep 17 00:00:00 2001 From: grischka Date: Sat, 1 Oct 2016 19:58:13 +0200 Subject: tccpp: restore -D symbols for multiple sources ... also for built-in defines The case: $ tcc -D FOO a.c b.c with // a.c #undef FOO // b.c #ifndef FOO # error -D FOO has been lost #endif --- libtcc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'libtcc.c') diff --git a/libtcc.c b/libtcc.c index de8b1f6..dbbc01f 100644 --- a/libtcc.c +++ b/libtcc.c @@ -964,8 +964,8 @@ static int tcc_compile(TCCState *s1) decl(VT_CONST); if (tok != TOK_EOF) expect("declaration"); + gen_inline_functions(); check_vstack(); - /* end of translation unit info */ if (s1->do_debug) { put_stabs_r(NULL, N_SO, 0, 0, @@ -974,16 +974,10 @@ static int tcc_compile(TCCState *s1) } s1->error_set_jmp_enabled = 0; - - /* reset define stack, but leave -Dsymbols (may be incorrect if - they are undefined) */ + /* reset define stack, but keep -D and built-ins */ free_defines(define_start); - - gen_inline_functions(); - sym_pop(&global_stack, NULL); sym_pop(&local_stack, NULL); - return s1->nb_errors != 0 ? -1 : 0; } -- cgit v1.3.1