aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2018-12-24 00:18:11 +0100
committerCamil Staps2018-12-24 00:18:11 +0100
commit4a4eab4f0a5445b9cb977d2e3da70d7c512a3e64 (patch)
tree160b6f8f959ff34a8c4bb862faf67221f37ca85a
parentNicer output, add CI (diff)
Add -Wall -Wextra -Werror -Ofast
-rw-r--r--Makefile1
-rw-r--r--sjit_c.c8
2 files changed, 7 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 4cbd9d9..ae85740 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
CLM:=clm
CLMFLAGS:=-IL Platform -nr -nt
+override CFLAGS:=-Wall -Wextra -Werror -Ofast $(CFLAGS)
BIN:=sjit
diff --git a/sjit_c.c b/sjit_c.c
index 85702fc..54c43dc 100644
--- a/sjit_c.c
+++ b/sjit_c.c
@@ -20,7 +20,7 @@ enum instr {
IDivRet
};
-static uint32_t instr_size(enum instr instr) {
+static inline uint32_t instr_size(enum instr instr) {
switch (instr) {
case PushRef: return 5+1;
case PushI: return 7+1;
@@ -35,6 +35,10 @@ static uint32_t instr_size(enum instr instr) {
case ISubRet: return 5+5+3+5+1;
case IMulRet: return 5+5+4+5+1;
case IDivRet: return 5+5+3+3+5+1;
+
+ default:
+ fprintf(stderr,"unknown instruction %d\n",instr);
+ exit(1);
}
}
@@ -169,7 +173,7 @@ static inline void gen_instr(char *full_code, char **code_p, uint64_t **pgm_p, u
break;
default:
- fprintf(stderr,"unknown instruction %lu\n",pgm[-1]);
+ fprintf(stderr,"unknown instruction %d\n",(int)pgm[-1]);
exit(1);
}