Revert ""Fix" nocode_wanted in expr_landor"
instead in vcheck_cmp(), pass the CODE_OFF_BIT to generators
unless other nocode purposes are set.
This reverts commit cad8739594
.
Also in 128_run_atexit.c:
avoid line output disorder which may happen on windows when
tcc itself and runned code are using two different printf
implementations and tcc would print the "[Returns 1]" above
any output from the runned test.
This commit is contained in:
parent
7abf2c03d6
commit
5f08561e10
2 changed files with 14 additions and 6 deletions
16
tccgen.c
16
tccgen.c
|
@ -56,8 +56,9 @@ ST_DATA int nocode_wanted; /* no code generation wanted */
|
|||
#define unevalmask 0xffff /* unevaluated subexpression */
|
||||
#define NODATA_WANTED (nocode_wanted > 0) /* no static data output wanted either */
|
||||
#define DATA_ONLY_WANTED 0x80000000 /* ON outside of functions and for static initializers */
|
||||
#define CODE_OFF() if(!nocode_wanted)(nocode_wanted |= 0x20000000)
|
||||
#define CODE_ON() (nocode_wanted &= ~0x20000000)
|
||||
#define CODE_OFF_BIT 0x20000000
|
||||
#define CODE_OFF() if(!nocode_wanted)(nocode_wanted |= CODE_OFF_BIT)
|
||||
#define CODE_ON() (nocode_wanted &= ~CODE_OFF_BIT)
|
||||
|
||||
ST_DATA int global_expr; /* true if compound literals must be allocated globally (used during initializers parsing */
|
||||
ST_DATA CType func_vt; /* current function return type (used by return instruction) */
|
||||
|
@ -765,7 +766,13 @@ static void vcheck_cmp(void)
|
|||
again, so that the VT_CMP/VT_JMP value will be in vtop
|
||||
when code is unsuppressed again. */
|
||||
|
||||
if (vtop->r == VT_CMP && !nocode_wanted)
|
||||
/* However if it's just automatic suppression via CODE_OFF/ON()
|
||||
then it seems that we better let things work undisturbed.
|
||||
How can it work at all under nocode_wanted? Well, gv() will
|
||||
actually clear it at the gsym() in load()/VT_JMP in the
|
||||
generator backends */
|
||||
|
||||
if (vtop->r == VT_CMP && 0 == (nocode_wanted & ~CODE_OFF_BIT))
|
||||
gv(RC_INT);
|
||||
}
|
||||
|
||||
|
@ -6263,7 +6270,7 @@ static int condition_3way(void)
|
|||
|
||||
static void expr_landor(int op)
|
||||
{
|
||||
int t = 0, cc = 1, f = 0, i = op == TOK_LAND, c, prev_ncw = nocode_wanted;
|
||||
int t = 0, cc = 1, f = 0, i = op == TOK_LAND, c;
|
||||
for(;;) {
|
||||
c = f ? i : condition_3way();
|
||||
if (c < 0)
|
||||
|
@ -6286,7 +6293,6 @@ static void expr_landor(int op)
|
|||
nocode_wanted -= f;
|
||||
} else {
|
||||
gvtst_set(i, t);
|
||||
nocode_wanted = prev_ncw;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
int printf(const char *format, ...);
|
||||
#include <stdio.h>
|
||||
|
||||
int atexit(void (*function)(void));
|
||||
int on_exit(void (*function)(int, void *), void *arg);
|
||||
void exit(int status);
|
||||
|
@ -6,6 +7,7 @@ void exit(int status);
|
|||
void cleanup1(void)
|
||||
{
|
||||
printf ("cleanup1\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void cleanup2(void)
|
||||
|
|
Loading…
Reference in a new issue