X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=opts.c;h=79980247333fecd7aa105ef4f0bc52f79e0db62f;hp=fd10233ef0e1d2f2a5812dfff332cf7f252ed53b;hb=fe14d1b056935d726cca09b2c0f2607c831244ef;hpb=12a864abf5a5cc79f0a8f11535c26bb2009c0ad9 diff --git a/opts.c b/opts.c index fd10233..7998024 100644 --- a/opts.c +++ b/opts.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012, 2013 + * Copyright (C) 2012, 2013, 2014 * Wolfgang Bumiller * Dale Weiler * @@ -25,7 +25,6 @@ #include #include "gmqcc.h" -#include "platform.h" const unsigned int opts_opt_oflag[COUNT_OPTIMIZATIONS+1] = { # define GMQCC_TYPE_OPTIMIZATIONS @@ -61,7 +60,7 @@ opts_cmd_t opts; /* command line options */ static void opts_setdefault(void) { memset(&opts, 0, sizeof(opts_cmd_t)); OPTS_OPTION_BOOL(OPTION_CORRECTION) = true; - OPTS_OPTION_STR(OPTION_PROGSRC) = "progs.src"; + OPTS_OPTION_STR(OPTION_PROGSRC) = "progs.src"; /* warnings */ opts_set(opts.warn, WARN_UNUSED_VARIABLE, true); @@ -93,6 +92,7 @@ static void opts_setdefault(void) { opts_set(opts.warn, WARN_PARENTHESIS, true); opts_set(opts.warn, WARN_CONST_OVERWRITE, true); opts_set(opts.warn, WARN_DIRECTIVE_INMACRO, true); + opts_set(opts.warn, WARN_BUILTINS, true); /* flags */ opts_set(opts.flags, ADJUST_VECTOR_FIELDS, true); @@ -130,7 +130,7 @@ void opts_restore_non_Werror_all() { void opts_init(const char *output, int standard, size_t arraysize) { opts_setdefault(); - OPTS_OPTION_STR(OPTION_OUTPUT) = (char*)output; + OPTS_OPTION_STR(OPTION_OUTPUT) = output; OPTS_OPTION_U32(OPTION_STANDARD) = standard; OPTS_OPTION_U32(OPTION_MAX_ARRAY_SIZE) = arraysize; OPTS_OPTION_U16(OPTION_MEMDUMPCOLS) = 16; @@ -214,7 +214,7 @@ static char *opts_ini_next(const char *s, char c) { } static size_t opts_ini_parse ( - FILE *filehandle, + fs_file_t *filehandle, char *(*loadhandle)(const char *, const char *, const char *), char **errorhandle ) { @@ -231,7 +231,7 @@ static size_t opts_ini_parse ( char *read_name; char *read_value; - while (fs_file_getline(&line, &linesize, filehandle) != EOF) { + while (fs_file_getline(&line, &linesize, filehandle) != FS_FILE_EOF) { parse_beg = line; /* handle BOM */ @@ -252,7 +252,7 @@ static size_t opts_ini_parse ( /* section found */ if (*(parse_end = opts_ini_next(parse_beg + 1, ']')) == ']') { * parse_end = '\0'; /* terminate bro */ - platform_strncpy(section_data, parse_beg + 1, sizeof(section_data)); + util_strncpy(section_data, parse_beg + 1, sizeof(section_data)); section_data[sizeof(section_data) - 1] = '\0'; *oldname_data = '\0'; } else if (!error) { @@ -273,7 +273,7 @@ static size_t opts_ini_parse ( opts_ini_rstrip(read_value); /* valid name value pair, lets call down to handler */ - platform_strncpy(oldname_data, read_name, sizeof(oldname_data)); + util_strncpy(oldname_data, read_name, sizeof(oldname_data)); oldname_data[sizeof(oldname_data) - 1] ='\0'; if ((*errorhandle = loadhandle(section_data, read_name, read_value)) && !error) @@ -381,7 +381,7 @@ void opts_ini_init(const char *file) { */ char *error = NULL; size_t line; - FILE *ini; + fs_file_t *ini; if (!file) { /* try ini */