Move some things around

This commit is contained in:
Dale Weiler 2013-07-30 15:32:24 +00:00
parent c8c25ef6f7
commit a9ab865add
5 changed files with 38 additions and 29 deletions

View file

@ -327,6 +327,7 @@ int con_out(const char *fmt, ...) {
return ln; return ln;
} }
#ifndef QCVM_EXECUTOR
/* /*
* Utility console message writes for lexer contexts. These will allow * Utility console message writes for lexer contexts. These will allow
* for reporting of file:line based on lexer context, These are used * 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); va_end(ap);
return r; return r;
} }
#endif

31
gmqcc.h
View file

@ -1008,18 +1008,13 @@ void opts_restore_non_Wall(void);
void opts_backup_non_Werror_all(void); void opts_backup_non_Werror_all(void);
void opts_restore_non_Werror_all(void); void opts_restore_non_Werror_all(void);
enum { enum {
# define GMQCC_TYPE_FLAGS # define GMQCC_TYPE_FLAGS
# define GMQCC_DEFINE_FLAG(X) X, # define GMQCC_DEFINE_FLAG(X) X,
# include "opts.def" # include "opts.def"
COUNT_FLAGS 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 { enum {
# define GMQCC_TYPE_WARNS # define GMQCC_TYPE_WARNS
@ -1027,12 +1022,6 @@ enum {
# include "opts.def" # include "opts.def"
COUNT_WARNINGS 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 { enum {
# define GMQCC_TYPE_OPTIMIZATIONS # define GMQCC_TYPE_OPTIMIZATIONS
@ -1040,18 +1029,6 @@ enum {
# include "opts.def" # include "opts.def"
COUNT_OPTIMIZATIONS 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 { enum {
# define GMQCC_TYPE_OPTIONS # define GMQCC_TYPE_OPTIONS
@ -1060,7 +1037,11 @@ enum {
OPTION_COUNT 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: */ /* other options: */
typedef enum { typedef enum {

View file

@ -16,8 +16,8 @@ LIBS += -lm
#objects #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_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_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_T = test.o util.o opts.o conout.o fs.o stat.o
OBJ_X = exec-standalone.o util.o conout.o fs.o stat.o OBJ_X = exec-standalone.o util.o opts.o conout.o fs.o stat.o
#gource flags #gource flags
GOURCEFLAGS = \ GOURCEFLAGS = \

1
main.c
View file

@ -45,7 +45,6 @@ static ppitem *ppems = NULL;
#define TYPE_ASM 1 #define TYPE_ASM 1
#define TYPE_SRC 2 #define TYPE_SRC 2
static const char *app_name; static const char *app_name;
static void version(void) { static void version(void) {

29
opts.c
View file

@ -26,6 +26,34 @@
#include "gmqcc.h" #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]; unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS];
opts_cmd_t opts; /* command lien options */ opts_cmd_t opts; /* command lien options */
@ -351,7 +379,6 @@ void opts_ini_init(const char *file) {
size_t line; size_t line;
FILE *ini; FILE *ini;
if (!file) { if (!file) {
/* try ini */ /* try ini */
if (!(ini = fs_file_open((file = "gmqcc.ini"), "r"))) if (!(ini = fs_file_open((file = "gmqcc.ini"), "r")))