]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Make it compile with -Wall and -pedantic
authorDale Weiler <killfieldengine@gmail.com>
Fri, 23 Nov 2012 02:23:22 +0000 (02:23 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Fri, 23 Nov 2012 02:23:22 +0000 (02:23 +0000)
Makefile
con.c
ftepp.c
parser.c
util.c

index e7a648df2e9ed87f29f5c76efb70b2698a6ca0b3..a8f7a790728eb0249c2e1842126c43ec0727063f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,12 +3,11 @@ PREFIX := /usr/local
 BINDIR := $(PREFIX)/bin
 
 CC     ?= clang
 BINDIR := $(PREFIX)/bin
 
 CC     ?= clang
-CFLAGS += -Wall -I.
+CFLAGS += -Wall -I. -Wall -pedantic
 #turn on tons of warnings if clang is present
 ifeq ($(CC), clang)
        CFLAGS +=                         \
                -Weverything                  \
 #turn on tons of warnings if clang is present
 ifeq ($(CC), clang)
        CFLAGS +=                         \
                -Weverything                  \
-               -Wno-missing-prototypes       \
                -Wno-padded                   \
                -Wno-format-nonliteral        \
                -Wno-disabled-macro-expansion \
                -Wno-padded                   \
                -Wno-format-nonliteral        \
                -Wno-disabled-macro-expansion \
diff --git a/con.c b/con.c
index a784ab7338cfe82be1b95628e1824b4f9b900b4e..2d18d6941992bdcc75d23915b289f3491048a5ba 100644 (file)
--- a/con.c
+++ b/con.c
@@ -281,7 +281,7 @@ int con_change(const char *out, const char *err) {
         con_enablecolor();
     } else if (!(console.handle_err = fopen(err, "w"))) return 0;
     
         con_enablecolor();
     } else if (!(console.handle_err = fopen(err, "w"))) return 0;
     
-    // no buffering
+    /* no buffering */
     setvbuf(console.handle_out, NULL, _IONBF, 0);
     setvbuf(console.handle_err, NULL, _IONBF, 0);
     
     setvbuf(console.handle_out, NULL, _IONBF, 0);
     setvbuf(console.handle_err, NULL, _IONBF, 0);
     
diff --git a/ftepp.c b/ftepp.c
index 34ca698c8702e03c65361f0bba4d7225e9c7e0a9..158daa1a16ec19f64a0805ed654894eff3e58a95 100644 (file)
--- a/ftepp.c
+++ b/ftepp.c
@@ -134,8 +134,9 @@ static void pptoken_delete(pptoken *self)
 
 static ppmacro *ppmacro_new(lex_ctx ctx, const char *name)
 {
 
 static ppmacro *ppmacro_new(lex_ctx ctx, const char *name)
 {
-    (void)ctx;
     ppmacro *macro = (ppmacro*)mem_a(sizeof(ppmacro));
     ppmacro *macro = (ppmacro*)mem_a(sizeof(ppmacro));
+    
+    (void)ctx;
     memset(macro, 0, sizeof(*macro));
     macro->name = util_strdup(name);
     return macro;
     memset(macro, 0, sizeof(*macro));
     macro->name = util_strdup(name);
     return macro;
index 5f61e7b17af584ba01e3e49b31457b0fe6c6190b..d61a416b85bf21af2606a6d483b367138a70982f 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2485,10 +2485,11 @@ static ast_expression *array_setter_node(parser_t *parser, ast_value *array, ast
     lex_ctx ctx = ast_ctx(array);
 
     if (from+1 == afterend) {
     lex_ctx ctx = ast_ctx(array);
 
     if (from+1 == afterend) {
-        // set this value
+        /* set this value */
         ast_block       *block;
         ast_return      *ret;
         ast_array_index *subscript;
         ast_block       *block;
         ast_return      *ret;
         ast_array_index *subscript;
+        ast_store       *st;
         int assignop = type_store_instr[value->expression.vtype];
 
         if (value->expression.vtype == TYPE_FIELD && value->expression.next->expression.vtype == TYPE_VECTOR)
         int assignop = type_store_instr[value->expression.vtype];
 
         if (value->expression.vtype == TYPE_FIELD && value->expression.next->expression.vtype == TYPE_VECTOR)
@@ -2498,7 +2499,7 @@ static ast_expression *array_setter_node(parser_t *parser, ast_value *array, ast
         if (!subscript)
             return NULL;
 
         if (!subscript)
             return NULL;
 
-        ast_store *st = ast_store_new(ctx, assignop, (ast_expression*)subscript, (ast_expression*)value);
+        st = ast_store_new(ctx, assignop, (ast_expression*)subscript, (ast_expression*)value);
         if (!st) {
             ast_delete(subscript);
             return NULL;
         if (!st) {
             ast_delete(subscript);
             return NULL;
@@ -2543,11 +2544,12 @@ static ast_expression *array_field_setter_node(
     lex_ctx ctx = ast_ctx(array);
 
     if (from+1 == afterend) {
     lex_ctx ctx = ast_ctx(array);
 
     if (from+1 == afterend) {
-        // set this value
+        /* set this value */
         ast_block       *block;
         ast_return      *ret;
         ast_entfield    *entfield;
         ast_array_index *subscript;
         ast_block       *block;
         ast_return      *ret;
         ast_entfield    *entfield;
         ast_array_index *subscript;
+        ast_store       *st;
         int assignop = type_storep_instr[value->expression.vtype];
 
         if (value->expression.vtype == TYPE_FIELD && value->expression.next->expression.vtype == TYPE_VECTOR)
         int assignop = type_storep_instr[value->expression.vtype];
 
         if (value->expression.vtype == TYPE_FIELD && value->expression.next->expression.vtype == TYPE_VECTOR)
@@ -2566,7 +2568,7 @@ static ast_expression *array_field_setter_node(
             return NULL;
         }
 
             return NULL;
         }
 
-        ast_store *st = ast_store_new(ctx, assignop, (ast_expression*)entfield, (ast_expression*)value);
+        st = ast_store_new(ctx, assignop, (ast_expression*)entfield, (ast_expression*)value);
         if (!st) {
             ast_delete(entfield);
             return NULL;
         if (!st) {
             ast_delete(entfield);
             return NULL;
diff --git a/util.c b/util.c
index a15599a6180ec2ea7240759db39e5fb58ab91a95..6d947427cec991f6f659df420c826a03c5430fc0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -498,11 +498,23 @@ size_t util_strtononcmd(const char *in, char *out, size_t outsz) {
             *out = *in + 'a' - 'A';
         else
             *out = *in;
             *out = *in + 'a' - 'A';
         else
             *out = *in;
+            
+        *out = (isalpha(*in) && isupper(*in)) ? *in + 'a' - 'A' : *in;
     }
     *out = 0;
     return sz-1;
 }
 
     }
     *out = 0;
     return sz-1;
 }
 
+
+bool util_filexists(const char *file) {
+    FILE *fp = fopen(file, "rb");
+    if  (!fp) return false;
+    
+    /* it exists */
+    fclose(fp);
+    return true;
+}
+
 FILE *util_fopen(const char *filename, const char *mode)
 {
 #ifdef WIN32
 FILE *util_fopen(const char *filename, const char *mode)
 {
 #ifdef WIN32
@@ -515,15 +527,6 @@ FILE *util_fopen(const char *filename, const char *mode)
 #endif
 }
 
 #endif
 }
 
-bool util_filexists(const char *file) {
-    FILE *fp = fopen(file, "rb");
-    if  (!fp) return false;
-    
-    /* it exists */
-    fclose(fp);
-    return true;
-}
-
 void _util_vec_grow(void **a, size_t i, size_t s) {
     size_t m = *a ? 2*_vec_beg(*a)+i : i+1;
     void  *p = mem_r((*a ? _vec_raw(*a) : NULL), s * m + sizeof(size_t)*2);
 void _util_vec_grow(void **a, size_t i, size_t s) {
     size_t m = *a ? 2*_vec_beg(*a)+i : i+1;
     void  *p = mem_r((*a ? _vec_raw(*a) : NULL), s * m + sizeof(size_t)*2);