env.build_dir('source','build/obj/source')
env.build_dir('modules','build/obj/modules')
env.set_toolset(:gcc)
- env["CFLAGS"] += ['-DLEAK_DETECT_LEVEL=1', '--std=c99', '-Wall', '-Wextra'] #, '-Werror']
+ env["CFLAGS"] += ['-DLEAK_DETECT_LEVEL=1', '--std=c99', '-Wall', '-Wextra', '-Werror']
env["CPPPATH"] += ['modules/libopts/source'] + Dir['modules/libcds/source/**/']
end
test_env = base_env.clone do |env|
env.build_dir('source','build/obj_test/source')
env.build_dir('modules','build/obj_test/modules')
- env['CFLAGS'] += ['--coverage']
+ env['CFLAGS'] += ['-O0', '--coverage']
env['LDFLAGS'] += ['--coverage']
end
case T_FLOAT: printf("__float(%f)", *((double*)tok->value)); break;
case T_BOOL: printf("__bool(%s)", ((int)tok->value)?"true":"false"); break;
case T_VAR: printf("%s", ((char*)tok->value)); break;
+ default: break;
}
} else if (is_formtype(p_tree, "if")) {
printf("IF (");
}
} else if (is_formtype(p_tree, "fn")) {
- printf("__func(&fn%d)", get_fn_id(fnlst, p_tree));
+ printf("__func(&fn%d)", (int)get_fn_id(fnlst, p_tree));
} else {
vec_t* vec = p_tree->ptr.vec;
- size_t nargs = vec_size(vec)-1;
+ int nargs = vec_size(vec)-1;
/* Determine the calling convention based on number of args */
if (0 == nargs)
printf("__call0(%s", (char*)get_val(vec_at(vec,0)));
else if (nargs < 16)
- printf("__calln(%s, %d, ", (char*)get_val(vec_at(vec,0)), nargs);
+ printf("__calln(%s, %d, ", (char*)get_val(vec_at(vec,0)), (int)nargs);
else
printf("__calln(%s, n, ", (char*)get_val(vec_at(vec,0)));
/* Print out the arguments */
static void emit_fn_declarations(vec_t* fnlst) {
char name[64];
for (size_t idx = 0; idx < vec_size(fnlst); idx++) {
- sprintf(name,"fn%d", idx);
+ sprintf(name,"fn%d", (int)idx);
printf("static ");
emit_fn_signature(name, (tree_t*)vec_at(fnlst,idx));
puts(";");
char name[64];
for (size_t idx = 0; idx < vec_size(fnlst); idx++) {
tree_t* func = (tree_t*)vec_at(fnlst,idx);
- sprintf(name,"fn%d", idx);
+ sprintf(name,"fn%d", (int)idx);
printf("static ");
emit_fn_signature(name, func);
puts(" {");
}
void codegen_csource(FILE* file, vec_t* program) {
+ (void)file;
emit_header();
emit_def_placeholders(program);
vec_t* funcs = find_fn_literals(program);
#include "parser.h"
#include "lexer.h"
#include "pprint.h"
+#include "codegen.h"
/* Command Line Options
*****************************************************************************/
const char Usage[] = "Usage: sclpl [OPTION]... MODE [FILE]...\n";
+
opts_cfg_t Options_Config[] = {
{"tokens", false, "mode", "Emit the token output of lexical analysis for the given file"},
{"ast", false, "mode", "Emit the abstract syntax tree for the given file"},
/* Print the usage and option list */
puts(Usage);
- size_t padding = sz + 4 + ((opts_have_args) ? 4 : 0);
+ int padding = sz + 4 + ((opts_have_args) ? 4 : 0);
char* buffer = (char*)malloc(padding+1);
opts = &Options_Config[0];
while (NULL != opts->name) {