aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2015-11-26 16:21:09 -0500
committerFranklin Wei <git@fwei.tk>2015-11-26 16:21:09 -0500
commitc668251e99a024a525bb07ef33a3900ef463a89a (patch)
tree2beec588ef86394445103317b478d0fa1d52e065
parenta4cd8b13074443b97f4d6568970758fb6ea2c9f9 (diff)
downloadducky-c668251e99a024a525bb07ef33a3900ef463a89a.zip
ducky-c668251e99a024a525bb07ef33a3900ef463a89a.tar.gz
ducky-c668251e99a024a525bb07ef33a3900ef463a89a.tar.bz2
ducky-c668251e99a024a525bb07ef33a3900ef463a89a.tar.xz
fix some warnings, less verbosity
-rw-r--r--src/compile.c1
-rw-r--r--src/emitc.c11
2 files changed, 10 insertions, 2 deletions
diff --git a/src/compile.c b/src/compile.c
index bc78fc2..47b3864 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -786,7 +786,6 @@ static int logvar_handler(char **save)
static int rem_handler(char **save)
{
(void) save;
- vid_logf("REM, skipping line");
return BREAK;
}
diff --git a/src/emitc.c b/src/emitc.c
index c205a91..016cb09 100644
--- a/src/emitc.c
+++ b/src/emitc.c
@@ -874,19 +874,26 @@ void write_stub_code(int num_lines)
write_src("static inline vartype getvar(varid_t varid)\n");
write_src("{\n");
+#if MAX_VARS < 65536
write_src("if(varid < %d)\n", MAX_VARS);
write_src("{\n");
+#endif
write_src("struct var_t *var = vars+varid;\n");
write_src("if(var->type == TYPE_PLAIN)\n");
write_src("return vars[varid].val;\n");
write_src("else\n");
write_src("return get_special(vars[varid].special);\n");
write_src("}\n");
+#if MAX_VARS < 65536
write_src("}\n");
+#endif
write_src("static inline void setvar(varid_t varid, vartype val)\n");
write_src("{\n");
- write_src("if(varid < %d && !vars[varid].constant)\n", MAX_VARS);
+#if MAX_VARS < 65536
+ write_src("if(varid < %d)\n", MAX_VARS);
+#endif
+ write_src("if(!vars[varid].constant)\n", MAX_VARS);
write_src("vars[varid].val = val;\n");
write_src("else\n");
write_src("ERROR(\"cannot modify variable\");\n");
@@ -894,7 +901,9 @@ void write_stub_code(int num_lines)
write_src("static inline void mkconst(varid_t varid)\n");
write_src("{\n");
+#if MAX_VARS < 65536
write_src("if(varid < %d)\n", MAX_VARS);
+#endif
write_src("vars[varid].constant = true;\n");
write_src("}\n");