c67: remove global #define's for TRUE/FALSE/BOOL

Also use uppercase TRUE/FALSE instead of true/false
This commit is contained in:
grischka 2013-02-04 15:10:08 +01:00
parent f715207249
commit 263dc93cfa
5 changed files with 32 additions and 32 deletions

View File

@ -174,11 +174,18 @@ int TranslateStackToReg[NoCallArgsPassedOnStack];
int ParamLocOnStack[NoCallArgsPassedOnStack]; int ParamLocOnStack[NoCallArgsPassedOnStack];
int TotalBytesPushedOnStack; int TotalBytesPushedOnStack;
#ifndef FALSE
# define FALSE 0
# define TRUE 1
#endif
#undef BOOL
#define BOOL int
/******************************************************/ /******************************************************/
static unsigned long func_sub_sp_offset; static unsigned long func_sub_sp_offset;
static int func_ret_sub; static int func_ret_sub;
static BOOL C67_invert_test; static BOOL C67_invert_test;
static int C67_compare_reg; static int C67_compare_reg;
@ -186,7 +193,6 @@ static int C67_compare_reg;
FILE *f = NULL; FILE *f = NULL;
#endif #endif
void C67_g(int c) void C67_g(int c)
{ {
int ind1; int ind1;
@ -1556,7 +1562,7 @@ void C67_SHR(int r, int v)
void load(int r, SValue * sv) void load(int r, SValue * sv)
{ {
int v, t, ft, fc, fr, size = 0, element; int v, t, ft, fc, fr, size = 0, element;
BOOL Unsigned = false; BOOL Unsigned = FALSE;
SValue v1; SValue v1;
fr = sv->r; fr = sv->r;
@ -2182,34 +2188,34 @@ void gen_opi(int op)
if (op == TOK_LT) { if (op == TOK_LT) {
C67_CMPLT(r, fr, C67_B2); C67_CMPLT(r, fr, C67_B2);
C67_invert_test = false; C67_invert_test = FALSE;
} else if (op == TOK_GE) { } else if (op == TOK_GE) {
C67_CMPLT(r, fr, C67_B2); C67_CMPLT(r, fr, C67_B2);
C67_invert_test = true; C67_invert_test = TRUE;
} else if (op == TOK_GT) { } else if (op == TOK_GT) {
C67_CMPGT(r, fr, C67_B2); C67_CMPGT(r, fr, C67_B2);
C67_invert_test = false; C67_invert_test = FALSE;
} else if (op == TOK_LE) { } else if (op == TOK_LE) {
C67_CMPGT(r, fr, C67_B2); C67_CMPGT(r, fr, C67_B2);
C67_invert_test = true; C67_invert_test = TRUE;
} else if (op == TOK_EQ) { } else if (op == TOK_EQ) {
C67_CMPEQ(r, fr, C67_B2); C67_CMPEQ(r, fr, C67_B2);
C67_invert_test = false; C67_invert_test = FALSE;
} else if (op == TOK_NE) { } else if (op == TOK_NE) {
C67_CMPEQ(r, fr, C67_B2); C67_CMPEQ(r, fr, C67_B2);
C67_invert_test = true; C67_invert_test = TRUE;
} else if (op == TOK_ULT) { } else if (op == TOK_ULT) {
C67_CMPLTU(r, fr, C67_B2); C67_CMPLTU(r, fr, C67_B2);
C67_invert_test = false; C67_invert_test = FALSE;
} else if (op == TOK_UGE) { } else if (op == TOK_UGE) {
C67_CMPLTU(r, fr, C67_B2); C67_CMPLTU(r, fr, C67_B2);
C67_invert_test = true; C67_invert_test = TRUE;
} else if (op == TOK_UGT) { } else if (op == TOK_UGT) {
C67_CMPGTU(r, fr, C67_B2); C67_CMPGTU(r, fr, C67_B2);
C67_invert_test = false; C67_invert_test = FALSE;
} else if (op == TOK_ULE) { } else if (op == TOK_ULE) {
C67_CMPGTU(r, fr, C67_B2); C67_CMPGTU(r, fr, C67_B2);
C67_invert_test = true; C67_invert_test = TRUE;
} else if (op == '+') } else if (op == '+')
C67_ADD(fr, r); // ADD r,fr,r C67_ADD(fr, r); // ADD r,fr,r
else if (op == '-') else if (op == '-')
@ -2344,42 +2350,42 @@ void gen_opf(int op)
else else
C67_CMPLTSP(r, fr, C67_B2); C67_CMPLTSP(r, fr, C67_B2);
C67_invert_test = false; C67_invert_test = FALSE;
} else if (op == TOK_GE) { } else if (op == TOK_GE) {
if ((ft & VT_BTYPE) == VT_DOUBLE) if ((ft & VT_BTYPE) == VT_DOUBLE)
C67_CMPLTDP(r, fr, C67_B2); C67_CMPLTDP(r, fr, C67_B2);
else else
C67_CMPLTSP(r, fr, C67_B2); C67_CMPLTSP(r, fr, C67_B2);
C67_invert_test = true; C67_invert_test = TRUE;
} else if (op == TOK_GT) { } else if (op == TOK_GT) {
if ((ft & VT_BTYPE) == VT_DOUBLE) if ((ft & VT_BTYPE) == VT_DOUBLE)
C67_CMPGTDP(r, fr, C67_B2); C67_CMPGTDP(r, fr, C67_B2);
else else
C67_CMPGTSP(r, fr, C67_B2); C67_CMPGTSP(r, fr, C67_B2);
C67_invert_test = false; C67_invert_test = FALSE;
} else if (op == TOK_LE) { } else if (op == TOK_LE) {
if ((ft & VT_BTYPE) == VT_DOUBLE) if ((ft & VT_BTYPE) == VT_DOUBLE)
C67_CMPGTDP(r, fr, C67_B2); C67_CMPGTDP(r, fr, C67_B2);
else else
C67_CMPGTSP(r, fr, C67_B2); C67_CMPGTSP(r, fr, C67_B2);
C67_invert_test = true; C67_invert_test = TRUE;
} else if (op == TOK_EQ) { } else if (op == TOK_EQ) {
if ((ft & VT_BTYPE) == VT_DOUBLE) if ((ft & VT_BTYPE) == VT_DOUBLE)
C67_CMPEQDP(r, fr, C67_B2); C67_CMPEQDP(r, fr, C67_B2);
else else
C67_CMPEQSP(r, fr, C67_B2); C67_CMPEQSP(r, fr, C67_B2);
C67_invert_test = false; C67_invert_test = FALSE;
} else if (op == TOK_NE) { } else if (op == TOK_NE) {
if ((ft & VT_BTYPE) == VT_DOUBLE) if ((ft & VT_BTYPE) == VT_DOUBLE)
C67_CMPEQDP(r, fr, C67_B2); C67_CMPEQDP(r, fr, C67_B2);
else else
C67_CMPEQSP(r, fr, C67_B2); C67_CMPEQSP(r, fr, C67_B2);
C67_invert_test = true; C67_invert_test = TRUE;
} else { } else {
ALWAYS_ASSERT(FALSE); ALWAYS_ASSERT(FALSE);
} }

View File

@ -1493,9 +1493,9 @@ PUB_FUNC const char * tcc_set_linker(TCCState *s, char *option, int multi)
while (option && *option) { while (option && *option) {
end = NULL; end = NULL;
if (link_option(option, "Bsymbolic", &p)) { if (link_option(option, "Bsymbolic", &p)) {
s->symbolic = TRUE; s->symbolic = 1;
} else if (link_option(option, "nostdlib", &p)) { } else if (link_option(option, "nostdlib", &p)) {
s->nostdlib = TRUE; s->nostdlib = 1;
} else if (link_option(option, "fini=", &p)) { } else if (link_option(option, "fini=", &p)) {
s->fini_symbol = p; s->fini_symbol = p;
if (s->warn_unsupported) if (s->warn_unsupported)

2
tcc.c
View File

@ -469,7 +469,7 @@ static int parse_args(TCCState *s, int argc, char **argv)
} }
} }
} }
if (NULL != (r1 = tcc_set_linker(s, (char *) linker_arg.data, TRUE))) if (NULL != (r1 = tcc_set_linker(s, (char *) linker_arg.data, 1)))
tcc_error("unsupported linker option '%s'", r1); tcc_error("unsupported linker option '%s'", r1);
/* fixme: these options could be different on your platform */ /* fixme: these options could be different on your platform */
if (was_pthread && output_type != TCC_OUTPUT_OBJ) { if (was_pthread && output_type != TCC_OUTPUT_OBJ) {

6
tcc.h
View File

@ -222,12 +222,6 @@
/* -------------------------------------------- */ /* -------------------------------------------- */
#define FALSE 0
#define false 0
#define TRUE 1
#define true 1
typedef int BOOL;
#define INCLUDE_STACK_SIZE 32 #define INCLUDE_STACK_SIZE 32
#define IFDEF_STACK_SIZE 64 #define IFDEF_STACK_SIZE 64
#define VSTACK_SIZE 256 #define VSTACK_SIZE 256

View File

@ -38,7 +38,7 @@ int EndAddress[MAX_FUNCS];
int LastLineNo[MAX_FUNCS]; int LastLineNo[MAX_FUNCS];
int FuncEntries[MAX_FUNCS]; int FuncEntries[MAX_FUNCS];
BOOL OutputTheSection(Section * sect); int OutputTheSection(Section * sect);
short int GetCoffFlags(const char *s); short int GetCoffFlags(const char *s);
void SortSymbolTable(void); void SortSymbolTable(void);
Section *FindSection(TCCState * s1, const char *sname); Section *FindSection(TCCState * s1, const char *sname);
@ -814,14 +814,14 @@ int FindCoffSymbolIndex(const char *func_name)
return n; // total number of symbols return n; // total number of symbols
} }
BOOL OutputTheSection(Section * sect) int OutputTheSection(Section * sect)
{ {
const char *s = sect->name; const char *s = sect->name;
if (!strcmp(s, ".text")) if (!strcmp(s, ".text"))
return true; return 1;
else if (!strcmp(s, ".data")) else if (!strcmp(s, ".data"))
return true; return 1;
else else
return 0; return 0;
} }