From df9a685f61934c155e512444648a254b9d93b386 Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Sat, 28 Apr 2012 15:13:41 -0400 Subject: [PATCH] surpress empty bodies --- Makefile | 2 +- asm.c | 6 +++--- gmqcc.h | 5 +++++ ir.c | 10 +++++----- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index ae23ba4..d9626a0 100644 --- 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 a40ed94..a685d1c 100644 --- 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 37871aa..6da465b 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -68,6 +68,11 @@ #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 8e92d4d..5e36dd7 100644 --- 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); } -- 2.39.2