]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
surpress empty bodies
authorDale Weiler <killfieldengine@gmail.com>
Sat, 28 Apr 2012 19:13:41 +0000 (15:13 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Sat, 28 Apr 2012 19:13:41 +0000 (15:13 -0400)
Makefile
asm.c
gmqcc.h
ir.c

index ae23ba4684aa3b726611b6bf920927d7dd3c250b..d9626a009eb9b3d51f3813c0fe5bf8125ca9f78e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 CC     ?= clang
-CFLAGS += -Wall -pedantic -std=c99
+CFLAGS += -Wall -pedantic-errors -std=c99
 OBJ     = main.o      \
           lex.o       \
           error.o     \
diff --git a/asm.c b/asm.c
index a40ed94af5b66ca041e06824529005d7a92f7397..a685d1c841cdadb55c8fe2d495ddd8d5237a8271 100644 (file)
--- a/asm.c
+++ b/asm.c
@@ -108,9 +108,9 @@ static inline bool asm_parse_type(const char *skip, size_t line, asm_state *stat
                     Z                                       \
                 }
 
-            PARSE_ELEMENT(find, val1, { if(find) { find+=3; }});
-            PARSE_ELEMENT(find, val2, { if(find) { find+=2; }});
-            PARSE_ELEMENT(find, val3, { if(find) { find+=1; }});
+            PARSE_ELEMENT(find, val1, { if(find) { find +=3; }});
+            PARSE_ELEMENT(find, val2, { if(find) { find +=2; }});
+            PARSE_ELEMENT(find, val3, { if(find) { find +=1; }});
             #undef PARSE_ELEMENT
 
             printf("X:[0] = %f\n", val1);
diff --git a/gmqcc.h b/gmqcc.h
index 37871aab9fa0197918084a96273ef11105736833..6da465b42e741533fb18ce58509c16ef75114582 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
 #else
 #   define GMQCC_WARN
 #endif
+/*
+ * This is a hack to silent clang regarding empty
+ * body if statements.
+ */
+#define GMQCC_SUPRESS_EMPTY_BODY do { } while (0)
 
 /*
  * stdint.h and inttypes.h -less subset
diff --git a/ir.c b/ir.c
index 8e92d4da6b368c9f2577146562b8f88c2b8a4018..5e36dd7afe691df1385eab52a851b2a1ba71041c 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -333,14 +333,14 @@ void ir_instr_delete(ir_instr *self)
     for (i = 0; i < self->phi_count; ++i) {
         size_t idx;
         if (ir_value_writes_find(self->phi[i].value, self, &idx))
-            if (ir_value_writes_remove(self->phi[i].value, idx));
+            if (ir_value_writes_remove(self->phi[i].value, idx)) GMQCC_SUPRESS_EMPTY_BODY;
         if (ir_value_reads_find(self->phi[i].value, self, &idx))
-            if (ir_value_reads_remove(self->phi[i].value, idx));
+            if (ir_value_reads_remove (self->phi[i].value, idx)) GMQCC_SUPRESS_EMPTY_BODY;
     }
     MEM_VECTOR_CLEAR(self, phi);
-    if (ir_instr_op(self, 0, NULL, false));
-    if (ir_instr_op(self, 1, NULL, false));
-    if (ir_instr_op(self, 2, NULL, false));
+    if (ir_instr_op(self, 0, NULL, false)) GMQCC_SUPRESS_EMPTY_BODY;
+    if (ir_instr_op(self, 1, NULL, false)) GMQCC_SUPRESS_EMPTY_BODY;
+    if (ir_instr_op(self, 2, NULL, false)) GMQCC_SUPRESS_EMPTY_BODY;
     mem_d(self);
 }