size_t len;
char *from;
- if (!OPTION_VALUE_BOOL(OPTION_DUMP) &&
- !OPTION_VALUE_BOOL(OPTION_DUMPFIN) &&
- !OPTION_VALUE_BOOL(OPTION_DEBUG))
+ if (!OPTS_OPTION_BOOL(OPTION_DUMP) &&
+ !OPTS_OPTION_BOOL(OPTION_DUMPFIN) &&
+ !OPTS_OPTION_BOOL(OPTION_DEBUG))
{
return NULL;
}
}
/* we are lame now - considering the way QC works we won't tolerate arrays > 1024 elements */
- if (!array->expression.count || array->expression.count > OPTION_VALUE_U32(OPTION_MAX_ARRAY_SIZE))
+ if (!array->expression.count || array->expression.count > OPTS_OPTION_U32(OPTION_MAX_ARRAY_SIZE))
compile_error(ast_ctx(self), "Invalid array of size %lu", (unsigned long)array->expression.count);
elemtype = &array->expression.next->expression;
int vtype = elemtype->vtype;
/* same as with field arrays */
- if (!self->expression.count || self->expression.count > OPTION_VALUE_U32(OPTION_MAX_ARRAY_SIZE))
+ if (!self->expression.count || self->expression.count > OPTS_OPTION_U32(OPTION_MAX_ARRAY_SIZE))
compile_error(ast_ctx(self), "Invalid array of size %lu", (unsigned long)self->expression.count);
v = ir_builder_create_global(ir, self->name, vtype);
}
/* we are lame now - considering the way QC works we won't tolerate arrays > 1024 elements */
- if (!self->expression.count || self->expression.count > OPTION_VALUE_U32(OPTION_MAX_ARRAY_SIZE)) {
+ if (!self->expression.count || self->expression.count > OPTS_OPTION_U32(OPTION_MAX_ARRAY_SIZE)) {
compile_error(ast_ctx(self), "Invalid array of size %lu", (unsigned long)self->expression.count);
}
for (i = 0; i < vec_size(self->locals); ++i)
{
if (!ast_local_codegen(self->locals[i], func->ir_func, false)) {
- if (OPTION_VALUE_BOOL(OPTION_DEBUG))
+ if (OPTS_OPTION_BOOL(OPTION_DEBUG))
compile_error(ast_ctx(self), "failed to generate local `%s`", self->locals[i]->name);
return false;
}
code_header.strings.offset = code_header.globals.offset + (sizeof(int32_t) * vec_size(code_globals));
code_header.strings.length = vec_size(code_chars);
code_header.version = 6;
- if (OPTION_VALUE_BOOL(OPTION_FORCECRC))
- code_header.crc16 = OPTION_VALUE_U16(OPTION_FORCED_CRC);
+ if (OPTS_OPTION_BOOL(OPTION_FORCECRC))
+ code_header.crc16 = OPTS_OPTION_U16(OPTION_FORCED_CRC);
else
code_header.crc16 = code_crc;
code_header.entfield = code_entfields;
default:
ftepp_error(ftepp, "junk in #if: `%s` ...", ftepp_tokval(ftepp));
- if (OPTION_VALUE_BOOL(OPTION_DEBUG))
+ if (OPTS_OPTION_BOOL(OPTION_DEBUG))
ftepp_error(ftepp, "internal: token %i\n", ftepp->token);
return false;
}
/* set the right macro based on the selected standard */
ftepp_add_define(NULL, "GMQCC");
- if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_FTEQCC) {
+ if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_FTEQCC) {
ftepp_add_define(NULL, "__STD_FTEQCC__");
/* 1.00 */
major[0] = '"';
minor[0] = '"';
minor[1] = '0';
minor[2] = '"';
- } else if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_GMQCC) {
+ } else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_GMQCC) {
ftepp_add_define(NULL, "__STD_GMQCC__");
sprintf(major, "\"%d\"", GMQCC_VERSION_MAJOR);
sprintf(minor, "\"%d\"", GMQCC_VERSION_MINOR);
- } else if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCCX) {
+ } else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCCX) {
ftepp_add_define(NULL, "__STD_QCCX__");
sprintf(major, "\"%d\"", GMQCC_VERSION_MAJOR);
sprintf(minor, "\"%d\"", GMQCC_VERSION_MINOR);
- } else if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC) {
+ } else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC) {
ftepp_add_define(NULL, "__STD_QCC__");
/* 1.0 */
major[0] = '"';
# include "opts.def"
OPTION_COUNT
};
+
+/* disabled for now */
+#if 0
static const char *opts_options_descriptions[OPTION_COUNT + 1] = {
# define GMQCC_TYPE_OPTIONS
# define GMQCC_DEFINE_FLAG(X, Y) Y,
# include "opts.def"
""
};
+#endif
extern unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS];
} opt_value_t;
-#define OPTION_VALUE_BOOL(X) (opts.options[X].B)
-#define OPTION_VALUE_U16(X) (opts.options[X].U16)
-#define OPTION_VALUE_U32(X) (opts.options[X].U32)
-#define OPTION_VALUE_STR(X) (opts.options[X].STR)
typedef struct {
opt_value_t options [OPTION_COUNT];
uint32_t flags [1 + (COUNT_FLAGS / 32)];
#define OPTS_WARN(i) OPTS_GENERIC(opts.warn, (i))
#define OPTS_WERROR(i) OPTS_GENERIC(opts.werror, (i))
#define OPTS_OPTIMIZATION(i) OPTS_GENERIC(opts.optimization, (i))
+#define OPTS_OPTION_BOOL(X) (opts.options[X].B)
+#define OPTS_OPTION_U16(X) (opts.options[X].U16)
+#define OPTS_OPTION_U32(X) (opts.options[X].U32)
+#define OPTS_OPTION_STR(X) (opts.options[X].STR)
#endif
irfun = global->constval.vfunc;
def = code_functions + irfun->code_function_def;
- if (OPTION_VALUE_BOOL(OPTION_G) ||
+ if (OPTS_OPTION_BOOL(OPTION_G) ||
!OPTS_OPTIMIZATION(OPTIM_OVERLAP_LOCALS) ||
(irfun->flags & IR_FLAG_MASK_NO_OVERLAP))
{
def.type = global->vtype;
def.offset = vec_size(code_globals);
def.name = 0;
- if (OPTION_VALUE_BOOL(OPTION_G) || !islocal)
+ if (OPTS_OPTION_BOOL(OPTION_G) || !islocal)
{
pushdef = true;
def.offset = (uint16_t)vec_size(code_globals);
/* create a global named the same as the field */
- if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_GMQCC) {
+ if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_GMQCC) {
/* in our standard, the global gets a dot prefix */
size_t len = strlen(field->name);
char name[1024];
code_push_statement(&stmt, vec_last(code_linenums));
}
- if (OPTION_VALUE_BOOL(OPTION_PP_ONLY))
+ if (OPTS_OPTION_BOOL(OPTION_PP_ONLY))
return true;
if (vec_size(code_statements) != vec_size(code_linenums)) {
memcpy(vec_add(lnofile, 5), ".lno", 5);
}
- if (!OPTION_VALUE_BOOL(OPTION_QUIET)) {
+ if (!OPTS_OPTION_BOOL(OPTION_QUIET)) {
if (lnofile)
con_out("writing '%s' and '%s'...\n", filename, lnofile);
else
if (!strcmp(v, keywords_qc[kw]))
return (lex->tok.ttype = TOKEN_KEYWORD);
}
- if (OPTION_VALUE_U32(OPTION_STANDARD) != COMPILER_QCC) {
+ if (OPTS_OPTION_U32(OPTION_STANDARD) != COMPILER_QCC) {
for (kw = 0; kw < num_keywords_fg; ++kw) {
if (!strcmp(v, keywords_fg[kw]))
return (lex->tok.ttype = TOKEN_KEYWORD);
opts_set(opts.werror, WARN_MISSING_RETURN_VALUES, true);
- OPTION_VALUE_U32(OPTION_STANDARD) = COMPILER_GMQCC;
+ OPTS_OPTION_U32(OPTION_STANDARD) = COMPILER_GMQCC;
} else if (!strcmp(argarg, "qcc")) {
opts_set(opts.flags, ADJUST_VECTOR_FIELDS, false);
opts_set(opts.flags, ASSIGN_FUNCTION_TYPES, true);
- OPTION_VALUE_U32(OPTION_STANDARD) = COMPILER_QCC;
+ OPTS_OPTION_U32(OPTION_STANDARD) = COMPILER_QCC;
} else if (!strcmp(argarg, "fte") || !strcmp(argarg, "fteqcc")) {
opts_set(opts.flags, CORRECT_TERNARY, false);
opts_set(opts.warn, WARN_TERNARY_PRECEDENCE, true);
- OPTION_VALUE_U32(OPTION_STANDARD) = COMPILER_FTEQCC;
+ OPTS_OPTION_U32(OPTION_STANDARD) = COMPILER_FTEQCC;
} else if (!strcmp(argarg, "qccx")) {
opts_set(opts.flags, ADJUST_VECTOR_FIELDS, false);
- OPTION_VALUE_U32(OPTION_STANDARD) = COMPILER_QCCX;
+ OPTS_OPTION_U32(OPTION_STANDARD) = COMPILER_QCCX;
} else {
con_out("Unknown standard: %s\n", argarg);
}
if (options_long_gcc("force-crc", &argc, &argv, &argarg)) {
- OPTION_VALUE_BOOL(OPTION_FORCECRC) = true;
- OPTION_VALUE_U16 (OPTION_FORCED_CRC) = strtol(argarg, NULL, 0);
+ OPTS_OPTION_BOOL(OPTION_FORCECRC) = true;
+ OPTS_OPTION_U16 (OPTION_FORCED_CRC) = strtol(argarg, NULL, 0);
continue;
}
if (options_long_gcc("redirout", &argc, &argv, &redirout)) {
}
if (!strcmp(argv[0]+1, "debug")) {
- OPTION_VALUE_BOOL(OPTION_DEBUG) = true;
+ OPTS_OPTION_BOOL(OPTION_DEBUG) = true;
continue;
}
if (!strcmp(argv[0]+1, "dump")) {
- OPTION_VALUE_BOOL(OPTION_DUMP) = true;
+ OPTS_OPTION_BOOL(OPTION_DUMP) = true;
continue;
}
if (!strcmp(argv[0]+1, "dumpfin")) {
- OPTION_VALUE_BOOL(OPTION_DUMPFIN) = true;
+ OPTS_OPTION_BOOL(OPTION_DUMPFIN) = true;
continue;
}
if (!strcmp(argv[0]+1, "memchk")) {
- OPTION_VALUE_BOOL(OPTION_MEMCHK) = true;
+ OPTS_OPTION_BOOL(OPTION_MEMCHK) = true;
continue;
}
if (!strcmp(argv[0]+1, "nocolor")) {
exit(0);
case 'E':
- OPTION_VALUE_BOOL(OPTION_PP_ONLY) = true;
+ OPTS_OPTION_BOOL(OPTION_PP_ONLY) = true;
opts_set(opts.flags, FTEPP_PREDEFS, true); /* predefs on for -E */
break;
/* debug turns on -flno */
case 'g':
opts_setflag("LNO", true);
- OPTION_VALUE_BOOL(OPTION_G) = true;
+ OPTS_OPTION_BOOL(OPTION_G) = true;
break;
case 'q':
- OPTION_VALUE_BOOL(OPTION_QUIET) = true;
+ OPTS_OPTION_BOOL(OPTION_QUIET) = true;
break;
case 'D':
}
if (isdigit(argarg[0])) {
uint32_t val = atoi(argarg);
- OPTION_VALUE_U32(OPTION_O) = val;
+ OPTS_OPTION_U32(OPTION_O) = val;
opts_setoptimlevel(val);
} else {
util_strtocmd(argarg, argarg, strlen(argarg)+1);
exit(0);
}
else if (!strcmp(argarg, "ALL"))
- opts_setoptimlevel(OPTION_VALUE_U32(OPTION_O) = 9999);
+ opts_setoptimlevel(OPTS_OPTION_U32(OPTION_O) = 9999);
else if (!strncmp(argarg, "NO_", 3)) {
if (!opts_setoptim(argarg+3, false)) {
con_out("unknown optimization: %s\n", argarg+3);
con_out("option -o requires an argument: the output file name\n");
return false;
}
- OPTION_VALUE_STR(OPTION_OUTPUT) = argarg;
+ OPTS_OPTION_STR(OPTION_OUTPUT) = argarg;
opts_output_wasset = true;
break;
exit(0);
}
else if (!strcmp(argv[0]+2, "quiet")) {
- OPTION_VALUE_BOOL(OPTION_QUIET) = true;
+ OPTS_OPTION_BOOL(OPTION_QUIET) = true;
break;
}
else if (!strcmp(argv[0]+2, "correct")) {
- OPTION_VALUE_BOOL(OPTION_CORRECTION) = true;
+ OPTS_OPTION_BOOL(OPTION_CORRECTION) = true;
break;
}
else if (!strcmp(argv[0]+2, "no-correct")) {
- OPTION_VALUE_BOOL(OPTION_CORRECTION) = false;
+ OPTS_OPTION_BOOL(OPTION_CORRECTION) = false;
break;
}
else if (!strcmp(argv[0]+2, "add-info")) {
- OPTION_VALUE_BOOL(OPTION_ADD_INFO) = true;
+ OPTS_OPTION_BOOL(OPTION_ADD_INFO) = true;
break;
}
else {
/* All long options with arguments */
if (options_long_witharg("output", &argc, &argv, &argarg)) {
- OPTION_VALUE_STR(OPTION_OUTPUT) = argarg;
+ OPTS_OPTION_STR(OPTION_OUTPUT) = argarg;
opts_output_wasset = true;
} else {
con_out("Unknown parameter: %s\n", argv[0]);
}
/* the standard decides which set of operators to use */
- if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_GMQCC) {
+ if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_GMQCC) {
operators = c_operators;
operator_count = c_operator_count;
- } else if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_FTEQCC) {
+ } else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_FTEQCC) {
operators = fte_operators;
operator_count = fte_operator_count;
} else {
}
}
- if (OPTION_VALUE_BOOL(OPTION_DUMP)) {
+ if (OPTS_OPTION_BOOL(OPTION_DUMP)) {
for (itr = 0; itr < COUNT_FLAGS; ++itr)
con_out("Flag %s = %i\n", opts_flag_list[itr].name, OPTS_FLAG(itr));
for (itr = 0; itr < COUNT_WARNINGS; ++itr)
con_out("Warning %s = %i\n", opts_warn_list[itr].name, OPTS_WARN(itr));
- con_out("output = %s\n", OPTION_VALUE_STR(OPTION_OUTPUT));
- con_out("optimization level = %u\n", OPTION_VALUE_U32(OPTION_O));
- con_out("standard = %u\n", OPTION_VALUE_U32(OPTION_STANDARD));
+ con_out("output = %s\n", OPTS_OPTION_STR(OPTION_OUTPUT));
+ con_out("optimization level = %u\n", OPTS_OPTION_U32(OPTION_O));
+ con_out("standard = %u\n", OPTS_OPTION_U32(OPTION_STANDARD));
}
- if (OPTION_VALUE_BOOL(OPTION_PP_ONLY)) {
+ if (OPTS_OPTION_BOOL(OPTION_PP_ONLY)) {
if (opts_output_wasset) {
- outfile = file_open(OPTION_VALUE_STR(OPTION_OUTPUT), "wb");
+ outfile = file_open(OPTS_OPTION_STR(OPTION_OUTPUT), "wb");
if (!outfile) {
- con_err("failed to open `%s` for writing\n", OPTION_VALUE_STR(OPTION_OUTPUT));
+ con_err("failed to open `%s` for writing\n", OPTS_OPTION_STR(OPTION_OUTPUT));
retval = 1;
goto cleanup;
}
}
}
- if (!OPTION_VALUE_BOOL(OPTION_PP_ONLY)) {
+ if (!OPTS_OPTION_BOOL(OPTION_PP_ONLY)) {
if (!parser_init()) {
con_err("failed to initialize parser\n");
retval = 1;
}
}
- if (OPTION_VALUE_BOOL(OPTION_PP_ONLY) || OPTS_FLAG(FTEPP)) {
+ if (OPTS_OPTION_BOOL(OPTION_PP_ONLY) || OPTS_FLAG(FTEPP)) {
if (!ftepp_init()) {
con_err("failed to initialize parser\n");
retval = 1;
util_debug("COM", "starting ...\n");
/* add macros */
- if (OPTION_VALUE_BOOL(OPTION_PP_ONLY) || OPTS_FLAG(FTEPP)) {
+ if (OPTS_OPTION_BOOL(OPTION_PP_ONLY) || OPTS_FLAG(FTEPP)) {
for (itr = 0; itr < vec_size(ppems); itr++) {
ftepp_add_macro(ppems[itr].name, ppems[itr].value);
mem_d(ppems[itr].name);
}
if (!opts_output_wasset) {
- OPTION_VALUE_STR(OPTION_OUTPUT) = util_strdup(line);
+ OPTS_OPTION_STR(OPTION_OUTPUT) = util_strdup(line);
opts_output_free = true;
}
goto cleanup;
if (vec_size(items)) {
- if (!OPTION_VALUE_BOOL(OPTION_QUIET) &&
- !OPTION_VALUE_BOOL(OPTION_PP_ONLY))
+ if (!OPTS_OPTION_BOOL(OPTION_QUIET) &&
+ !OPTS_OPTION_BOOL(OPTION_PP_ONLY))
{
con_out("Mode: %s\n", (progs_src ? "progs.src" : "manual"));
con_out("There are %lu items to compile:\n", (unsigned long)vec_size(items));
}
for (itr = 0; itr < vec_size(items); ++itr) {
- if (!OPTION_VALUE_BOOL(OPTION_QUIET) &&
- !OPTION_VALUE_BOOL(OPTION_PP_ONLY))
+ if (!OPTS_OPTION_BOOL(OPTION_QUIET) &&
+ !OPTS_OPTION_BOOL(OPTION_PP_ONLY))
{
con_out(" item: %s (%s)\n",
items[itr].filename,
("unknown"))))));
}
- if (OPTION_VALUE_BOOL(OPTION_PP_ONLY)) {
+ if (OPTS_OPTION_BOOL(OPTION_PP_ONLY)) {
const char *out;
if (!ftepp_preprocess_file(items[itr].filename)) {
retval = 1;
}
ftepp_finish();
- if (!OPTION_VALUE_BOOL(OPTION_PP_ONLY)) {
- if (!parser_finish(OPTION_VALUE_STR(OPTION_OUTPUT))) {
+ if (!OPTS_OPTION_BOOL(OPTION_PP_ONLY)) {
+ if (!parser_finish(OPTS_OPTION_STR(OPTION_OUTPUT))) {
retval = 1;
goto cleanup;
}
}
/* stuff */
- if (!OPTION_VALUE_BOOL(OPTION_QUIET) &&
- !OPTION_VALUE_BOOL(OPTION_PP_ONLY))
+ if (!OPTS_OPTION_BOOL(OPTION_QUIET) &&
+ !OPTS_OPTION_BOOL(OPTION_PP_ONLY))
{
for (itr = 0; itr < COUNT_OPTIMIZATIONS; ++itr) {
if (opts_optimizationcount[itr]) {
vec_free(items);
vec_free(ppems);
- if (!OPTION_VALUE_BOOL(OPTION_PP_ONLY))
+ if (!OPTS_OPTION_BOOL(OPTION_PP_ONLY))
parser_cleanup();
if (opts_output_free)
- mem_d(OPTION_VALUE_STR(OPTION_OUTPUT));
+ mem_d(OPTS_OPTION_STR(OPTION_OUTPUT));
if (operators_free)
mem_d((void*)operators);
static void opts_setdefault() {
memset(&opts, 0, sizeof(opts_cmd_t));
- OPTION_VALUE_BOOL(OPTION_CORRECTION) = true;
+ OPTS_OPTION_BOOL(OPTION_CORRECTION) = true;
/* warnings */
opts_set(opts.warn, WARN_UNUSED_VARIABLE, true);
void opts_init(const char *output, int standard, size_t arraysize) {
opts_setdefault();
- OPTION_VALUE_STR(OPTION_OUTPUT) = (char*)output;
- OPTION_VALUE_U32(OPTION_STANDARD) = standard;
- OPTION_VALUE_U32(OPTION_MAX_ARRAY_SIZE) = arraysize;
+ OPTS_OPTION_STR(OPTION_OUTPUT) = (char*)output;
+ OPTS_OPTION_U32(OPTION_STANDARD) = standard;
+ OPTS_OPTION_U32(OPTION_MAX_ARRAY_SIZE) = arraysize;
}
static bool opts_setflag_all(const char *name, bool on, uint32_t *flags, const opts_flag_def *list, size_t listsize) {
{
#if 0
/* This is not broken in fteqcc anymore */
- if (OPTION_VALUE_U32(OPTION_STANDARD) != COMPILER_GMQCC) {
+ if (OPTS_OPTION_U32(OPTION_STANDARD) != COMPILER_GMQCC) {
/* this error doesn't need to make us bail out */
(void)!parsewarning(parser, WARN_EXTENSIONS,
"accessing array-field members of an entity without parenthesis\n"
* We should also consider adding correction tables for
* other things as well.
*/
- if (OPTION_VALUE_BOOL(OPTION_CORRECTION)) {
+ if (OPTS_OPTION_BOOL(OPTION_CORRECTION)) {
correction_t corr;
correct_init(&corr);
if (typevar || parser->tok == TOKEN_TYPENAME) {
#if 0
- if (OPTION_VALUE_U32(OPTION_STANDARD) != COMPILER_GMQCC) {
+ if (OPTS_OPTION_U32(OPTION_STANDARD) != COMPILER_GMQCC) {
if (parsewarning(parser, WARN_EXTENSIONS,
"current standard does not allow variable declarations in for-loop initializers"))
goto onerr;
parseerror(parser, "cannot declare a variable from here");
return false;
}
- if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC) {
+ if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC) {
if (parsewarning(parser, WARN_EXTENSIONS, "missing 'local' keyword when declaring a local variable"))
return false;
}
}
else if (!strcmp(parser_tokval(parser), "for"))
{
- if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC) {
+ if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC) {
if (parsewarning(parser, WARN_EXTENSIONS, "for loops are not recognized in the original Quake C standard, to enable try an alternate standard --std=?"))
return false;
}
if (parser->tok == ';')
return parser_next(parser);
- else if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC)
+ else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC)
parseerror(parser, "missing semicolon after function body (mandatory with -std=qcc)");
return retval;
vec_free(params);
/* sanity check */
- if (vec_size(params) > 8 && OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC)
+ if (vec_size(params) > 8 && OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC)
(void)!parsewarning(parser, WARN_EXTENSIONS, "more than 8 parameters are not supported by this standard");
/* parse-out */
}
/* now there may be function parens again */
- if (parser->tok == '(' && OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC)
+ if (parser->tok == '(' && OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC)
parseerror(parser, "C-style function syntax is not allowed in -std=qcc");
if (parser->tok == '(' && wasarray)
parseerror(parser, "arrays as part of a return type is not supported");
/* Part 0: finish the type */
if (parser->tok == '(') {
- if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC)
+ if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC)
parseerror(parser, "C-style function syntax is not allowed in -std=qcc");
var = parse_parameter_list(parser, var);
if (!var) {
}
/* for functions returning functions */
while (parser->tok == '(') {
- if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC)
+ if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC)
parseerror(parser, "C-style function syntax is not allowed in -std=qcc");
var = parse_parameter_list(parser, var);
if (!var) {
goto cleanup;
*/
}
- if ((OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC || OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_FTEQCC) &&
+ if ((OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC || OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_FTEQCC) &&
(old = parser_find_global(parser, var->name)))
{
parseerror(parser, "cannot declare a field and a global of the same name with -std=qcc");
ast_delete(var);
var = proto;
}
- if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC &&
+ if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC &&
(old = parser_find_field(parser, var->name)))
{
parseerror(parser, "cannot declare a field and a global of the same name with -std=qcc");
retval = false;
goto cleanup;
}
- if (OPTION_VALUE_U32(OPTION_STANDARD) != COMPILER_GMQCC) {
+ if (OPTS_OPTION_U32(OPTION_STANDARD) != COMPILER_GMQCC) {
ast_delete(var);
var = NULL;
goto skipvar;
break;
}
- if (localblock && OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC) {
+ if (localblock && OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC) {
if (parsewarning(parser, WARN_LOCAL_CONSTANTS,
"initializing expression turns variable `%s` into a constant in this standard",
var->name) )
break;
}
}
- else if (OPTION_VALUE_U32(OPTION_STANDARD) == COMPILER_QCC) {
+ else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC) {
parseerror(parser, "expected '=' before function body in this standard");
}
parser->const_vec[1] = ast_value_new(empty_ctx, "<vector.y>", TYPE_NOEXPR);
parser->const_vec[2] = ast_value_new(empty_ctx, "<vector.z>", TYPE_NOEXPR);
- if (OPTION_VALUE_BOOL(OPTION_ADD_INFO)) {
+ if (OPTS_OPTION_BOOL(OPTION_ADD_INFO)) {
parser->reserved_version = ast_value_new(empty_ctx, "reserved:version", TYPE_STRING);
parser->reserved_version->cvq = CV_CONST;
parser->reserved_version->hasvalue = true;
return false;
}
}
- if (OPTION_VALUE_BOOL(OPTION_DUMP))
+ if (OPTS_OPTION_BOOL(OPTION_DUMP))
ir_builder_dump(ir, con_out);
for (i = 0; i < vec_size(parser->functions); ++i) {
if (!ir_function_finalize(parser->functions[i]->ir_func)) {
}
if (retval) {
- if (OPTION_VALUE_BOOL(OPTION_DUMPFIN))
+ if (OPTS_OPTION_BOOL(OPTION_DUMPFIN))
ir_builder_dump(ir, con_out);
generate_checksum(parser);
con_change(redirout, redirerr);
if (!strcmp(argv[0]+1, "debug")) {
- OPTION_VALUE_BOOL(OPTION_DEBUG) = true;
+ OPTS_OPTION_BOOL(OPTION_DEBUG) = true;
continue;
}
if (!strcmp(argv[0]+1, "memchk")) {
- OPTION_VALUE_BOOL(OPTION_MEMCHK) = true;
+ OPTS_OPTION_BOOL(OPTION_MEMCHK) = true;
continue;
}
if (!strcmp(argv[0]+1, "nocolor")) {
void util_meminfo() {
struct memblock_t *info;
- if (!OPTION_VALUE_BOOL(OPTION_MEMCHK))
+ if (!OPTS_OPTION_BOOL(OPTION_MEMCHK))
return;
for (info = mem_start; info; info = info->next) {
void util_debug(const char *area, const char *ms, ...) {
va_list va;
- if (!OPTION_VALUE_BOOL(OPTION_DEBUG))
+ if (!OPTS_OPTION_BOOL(OPTION_DEBUG))
return;
- if (!strcmp(area, "MEM") && !OPTION_VALUE_BOOL(OPTION_MEMCHK))
+ if (!strcmp(area, "MEM") && !OPTS_OPTION_BOOL(OPTION_MEMCHK))
return;
va_start(va, ms);