From: Dale Weiler Date: Tue, 30 Jul 2013 15:32:24 +0000 (+0000) Subject: Move some things around X-Git-Tag: v0.3.0~58 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a9ab865add301e49390d1ebeabe350a6c9c4205c;p=xonotic%2Fgmqcc.git Move some things around --- diff --git a/conout.c b/conout.c index 13a242f..2f1eb9e 100644 --- a/conout.c +++ b/conout.c @@ -327,6 +327,7 @@ int con_out(const char *fmt, ...) { return ln; } +#ifndef QCVM_EXECUTOR /* * Utility console message writes for lexer contexts. These will allow * for reporting of file:line based on lexer context, These are used @@ -445,3 +446,4 @@ bool GMQCC_WARN compile_warning(lex_ctx ctx, int warntype, const char *fmt, ...) va_end(ap); return r; } +#endif diff --git a/gmqcc.h b/gmqcc.h index 5372120..4595be9 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -1008,18 +1008,13 @@ void opts_restore_non_Wall(void); void opts_backup_non_Werror_all(void); void opts_restore_non_Werror_all(void); + enum { # define GMQCC_TYPE_FLAGS # define GMQCC_DEFINE_FLAG(X) X, # include "opts.def" COUNT_FLAGS }; -static const opts_flag_def opts_flag_list[] = { -# define GMQCC_TYPE_FLAGS -# define GMQCC_DEFINE_FLAG(X) { #X, LONGBIT(X) }, -# include "opts.def" - { NULL, LONGBIT(0) } -}; enum { # define GMQCC_TYPE_WARNS @@ -1027,12 +1022,6 @@ enum { # include "opts.def" COUNT_WARNINGS }; -static const opts_flag_def opts_warn_list[] = { -# define GMQCC_TYPE_WARNS -# define GMQCC_DEFINE_FLAG(X) { #X, LONGBIT(WARN_##X) }, -# include "opts.def" - { NULL, LONGBIT(0) } -}; enum { # define GMQCC_TYPE_OPTIMIZATIONS @@ -1040,18 +1029,6 @@ enum { # include "opts.def" COUNT_OPTIMIZATIONS }; -static const opts_flag_def opts_opt_list[] = { -# define GMQCC_TYPE_OPTIMIZATIONS -# define GMQCC_DEFINE_FLAG(NAME, MIN_O) { #NAME, LONGBIT(OPTIM_##NAME) }, -# include "opts.def" - { NULL, LONGBIT(0) } -}; -static const unsigned int opts_opt_oflag[] = { -# define GMQCC_TYPE_OPTIMIZATIONS -# define GMQCC_DEFINE_FLAG(NAME, MIN_O) MIN_O, -# include "opts.def" - 0 -}; enum { # define GMQCC_TYPE_OPTIONS @@ -1060,7 +1037,11 @@ enum { OPTION_COUNT }; -extern unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS]; +extern const opts_flag_def opts_flag_list[COUNT_FLAGS+1]; +extern const opts_flag_def opts_warn_list[COUNT_WARNINGS+1]; +extern const opts_flag_def opts_opt_list[COUNT_OPTIMIZATIONS+1]; +extern const unsigned int opts_opt_oflag[COUNT_OPTIMIZATIONS+1]; +extern unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS]; /* other options: */ typedef enum { diff --git a/include.mk b/include.mk index d8ee6fe..3fa588d 100644 --- a/include.mk +++ b/include.mk @@ -16,8 +16,8 @@ LIBS += -lm #objects OBJ_C = main.o lexer.o parser.o fs.o stat.o util.o code.o ast.o ir.o conout.o ftepp.o opts.o utf8.o correct.o OBJ_P = util.o fs.o conout.o opts.o pak.o stat.o -OBJ_T = test.o util.o conout.o fs.o stat.o -OBJ_X = exec-standalone.o util.o conout.o fs.o stat.o +OBJ_T = test.o util.o opts.o conout.o fs.o stat.o +OBJ_X = exec-standalone.o util.o opts.o conout.o fs.o stat.o #gource flags GOURCEFLAGS = \ diff --git a/main.c b/main.c index e8a41b7..8aae427 100644 --- a/main.c +++ b/main.c @@ -45,7 +45,6 @@ static ppitem *ppems = NULL; #define TYPE_ASM 1 #define TYPE_SRC 2 - static const char *app_name; static void version(void) { diff --git a/opts.c b/opts.c index 286b168..e009d4e 100644 --- a/opts.c +++ b/opts.c @@ -26,6 +26,34 @@ #include "gmqcc.h" +const unsigned int opts_opt_oflag[COUNT_OPTIMIZATIONS+1] = { +# define GMQCC_TYPE_OPTIMIZATIONS +# define GMQCC_DEFINE_FLAG(NAME, MIN_O) MIN_O, +# include "opts.def" + 0 +}; + +const opts_flag_def opts_opt_list[COUNT_OPTIMIZATIONS+1] = { +# define GMQCC_TYPE_OPTIMIZATIONS +# define GMQCC_DEFINE_FLAG(NAME, MIN_O) { #NAME, LONGBIT(OPTIM_##NAME) }, +# include "opts.def" + { NULL, LONGBIT(0) } +}; + +const opts_flag_def opts_warn_list[COUNT_WARNINGS+1] = { +# define GMQCC_TYPE_WARNS +# define GMQCC_DEFINE_FLAG(X) { #X, LONGBIT(WARN_##X) }, +# include "opts.def" + { NULL, LONGBIT(0) } +}; + +const opts_flag_def opts_flag_list[COUNT_FLAGS+1] = { +# define GMQCC_TYPE_FLAGS +# define GMQCC_DEFINE_FLAG(X) { #X, LONGBIT(X) }, +# include "opts.def" + { NULL, LONGBIT(0) } +}; + unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS]; opts_cmd_t opts; /* command lien options */ @@ -351,7 +379,6 @@ void opts_ini_init(const char *file) { size_t line; FILE *ini; - if (!file) { /* try ini */ if (!(ini = fs_file_open((file = "gmqcc.ini"), "r")))