From 263dc93cfab453ad04d1ec0f304acdb16e63405c Mon Sep 17 00:00:00 2001 From: grischka Date: Mon, 4 Feb 2013 15:10:08 +0100 Subject: [PATCH] c67: remove global #define's for TRUE/FALSE/BOOL Also use uppercase TRUE/FALSE instead of true/false --- c67-gen.c | 44 +++++++++++++++++++++++++------------------- libtcc.c | 4 ++-- tcc.c | 2 +- tcc.h | 6 ------ tcccoff.c | 8 ++++---- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/c67-gen.c b/c67-gen.c index 52d9f3b7..b79b1bb8 100644 --- a/c67-gen.c +++ b/c67-gen.c @@ -174,11 +174,18 @@ int TranslateStackToReg[NoCallArgsPassedOnStack]; int ParamLocOnStack[NoCallArgsPassedOnStack]; int TotalBytesPushedOnStack; +#ifndef FALSE +# define FALSE 0 +# define TRUE 1 +#endif + +#undef BOOL +#define BOOL int + /******************************************************/ static unsigned long func_sub_sp_offset; static int func_ret_sub; - static BOOL C67_invert_test; static int C67_compare_reg; @@ -186,7 +193,6 @@ static int C67_compare_reg; FILE *f = NULL; #endif - void C67_g(int c) { int ind1; @@ -1556,7 +1562,7 @@ void C67_SHR(int r, int v) void load(int r, SValue * sv) { int v, t, ft, fc, fr, size = 0, element; - BOOL Unsigned = false; + BOOL Unsigned = FALSE; SValue v1; fr = sv->r; @@ -2182,34 +2188,34 @@ void gen_opi(int op) if (op == TOK_LT) { C67_CMPLT(r, fr, C67_B2); - C67_invert_test = false; + C67_invert_test = FALSE; } else if (op == TOK_GE) { C67_CMPLT(r, fr, C67_B2); - C67_invert_test = true; + C67_invert_test = TRUE; } else if (op == TOK_GT) { C67_CMPGT(r, fr, C67_B2); - C67_invert_test = false; + C67_invert_test = FALSE; } else if (op == TOK_LE) { C67_CMPGT(r, fr, C67_B2); - C67_invert_test = true; + C67_invert_test = TRUE; } else if (op == TOK_EQ) { C67_CMPEQ(r, fr, C67_B2); - C67_invert_test = false; + C67_invert_test = FALSE; } else if (op == TOK_NE) { C67_CMPEQ(r, fr, C67_B2); - C67_invert_test = true; + C67_invert_test = TRUE; } else if (op == TOK_ULT) { C67_CMPLTU(r, fr, C67_B2); - C67_invert_test = false; + C67_invert_test = FALSE; } else if (op == TOK_UGE) { C67_CMPLTU(r, fr, C67_B2); - C67_invert_test = true; + C67_invert_test = TRUE; } else if (op == TOK_UGT) { C67_CMPGTU(r, fr, C67_B2); - C67_invert_test = false; + C67_invert_test = FALSE; } else if (op == TOK_ULE) { C67_CMPGTU(r, fr, C67_B2); - C67_invert_test = true; + C67_invert_test = TRUE; } else if (op == '+') C67_ADD(fr, r); // ADD r,fr,r else if (op == '-') @@ -2344,42 +2350,42 @@ void gen_opf(int op) else C67_CMPLTSP(r, fr, C67_B2); - C67_invert_test = false; + C67_invert_test = FALSE; } else if (op == TOK_GE) { if ((ft & VT_BTYPE) == VT_DOUBLE) C67_CMPLTDP(r, fr, C67_B2); else C67_CMPLTSP(r, fr, C67_B2); - C67_invert_test = true; + C67_invert_test = TRUE; } else if (op == TOK_GT) { if ((ft & VT_BTYPE) == VT_DOUBLE) C67_CMPGTDP(r, fr, C67_B2); else C67_CMPGTSP(r, fr, C67_B2); - C67_invert_test = false; + C67_invert_test = FALSE; } else if (op == TOK_LE) { if ((ft & VT_BTYPE) == VT_DOUBLE) C67_CMPGTDP(r, fr, C67_B2); else C67_CMPGTSP(r, fr, C67_B2); - C67_invert_test = true; + C67_invert_test = TRUE; } else if (op == TOK_EQ) { if ((ft & VT_BTYPE) == VT_DOUBLE) C67_CMPEQDP(r, fr, C67_B2); else C67_CMPEQSP(r, fr, C67_B2); - C67_invert_test = false; + C67_invert_test = FALSE; } else if (op == TOK_NE) { if ((ft & VT_BTYPE) == VT_DOUBLE) C67_CMPEQDP(r, fr, C67_B2); else C67_CMPEQSP(r, fr, C67_B2); - C67_invert_test = true; + C67_invert_test = TRUE; } else { ALWAYS_ASSERT(FALSE); } diff --git a/libtcc.c b/libtcc.c index 68b3e10b..5635c2e8 100644 --- a/libtcc.c +++ b/libtcc.c @@ -1493,9 +1493,9 @@ PUB_FUNC const char * tcc_set_linker(TCCState *s, char *option, int multi) while (option && *option) { end = NULL; if (link_option(option, "Bsymbolic", &p)) { - s->symbolic = TRUE; + s->symbolic = 1; } else if (link_option(option, "nostdlib", &p)) { - s->nostdlib = TRUE; + s->nostdlib = 1; } else if (link_option(option, "fini=", &p)) { s->fini_symbol = p; if (s->warn_unsupported) diff --git a/tcc.c b/tcc.c index 5dd5725c..3116c40a 100644 --- a/tcc.c +++ b/tcc.c @@ -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); /* fixme: these options could be different on your platform */ if (was_pthread && output_type != TCC_OUTPUT_OBJ) { diff --git a/tcc.h b/tcc.h index b8b81c2b..5949ab6a 100644 --- a/tcc.h +++ b/tcc.h @@ -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 IFDEF_STACK_SIZE 64 #define VSTACK_SIZE 256 diff --git a/tcccoff.c b/tcccoff.c index 2f525625..0cdc2b7f 100644 --- a/tcccoff.c +++ b/tcccoff.c @@ -38,7 +38,7 @@ int EndAddress[MAX_FUNCS]; int LastLineNo[MAX_FUNCS]; int FuncEntries[MAX_FUNCS]; -BOOL OutputTheSection(Section * sect); +int OutputTheSection(Section * sect); short int GetCoffFlags(const char *s); void SortSymbolTable(void); Section *FindSection(TCCState * s1, const char *sname); @@ -814,14 +814,14 @@ int FindCoffSymbolIndex(const char *func_name) return n; // total number of symbols } -BOOL OutputTheSection(Section * sect) +int OutputTheSection(Section * sect) { const char *s = sect->name; if (!strcmp(s, ".text")) - return true; + return 1; else if (!strcmp(s, ".data")) - return true; + return 1; else return 0; } -- 2.11.4.GIT