surpress empty bodies

This commit is contained in:
Dale Weiler 2012-04-28 15:13:41 -04:00
parent 7d66144c1b
commit df9a685f61
4 changed files with 14 additions and 9 deletions

View file

@ -1,5 +1,5 @@
CC ?= clang
CFLAGS += -Wall -pedantic -std=c99
CFLAGS += -Wall -pedantic-errors -std=c99
OBJ = main.o \
lex.o \
error.o \

6
asm.c
View file

@ -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);

View file

@ -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

10
ir.c
View file

@ -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);
}