oceani_tests :=
## test list
+ oceani_valg_tests := $(oceani_tests)
+ ## combine test lists
tests:: oceani_test_suite
oceani_test_suite: oceani coverage_oceani
@mv *.gcov coverage ; [ -f .gcov ] && mv .gcov coverage || true
@rm -f .tmp*
- @[ -n "$$SKIP_VALGRIND" ] || for T in $(oceani_tests); do \
+ @[ -n "$$SKIP_VALGRIND" ] || for T in $(oceani_valg_tests); do \
echo -n "Valgrind $$T.. "; \
i="$$IFS"; IFS=,; set $$T; IFS="$$i"; t=$$1; shift; \
- if ! valgrind --error-exitcode=1 --log-file=.tmp.valg ./oceani --section "test: $$t" oceani-tests.mdc $${1+"$$@"} \
- > /dev/null 2>&1 ; then \
+ if valgrind --error-exitcode=42 --log-file=.tmp.valg ./oceani --section "test: $$t" oceani-tests.mdc $${1+"$$@"} \
+ > /dev/null 2>&1 ; [ $$? -eq 42 ] ; then \
echo "FAILED"; cat .tmp.valg; exit 1; fi ; \
if grep 'LEAK SUMMARY' .tmp.valg > /dev/null; then \
echo "valgrind found LEAKS"; cat .tmp.valg ; exit 1 ; fi; \
./coverage_oceani --section "test: $$t" oceani-tests.mdc > /dev/null 2>&1 ;\
done || true
+###### combine test lists
+ oceani_valg_tests += $(oceani_failing_tests)
+
###### test list
oceani_failing_tests := syn1
oceani_failing_tests += tokerr
free(s);
s = t;
}
- if (!context.parse_error) {
- ## free global vars
- }
+ // FIXME parser should pop scope even on error
+ while (context.scope_depth > 0)
+ scope_pop(&context);
+ ## free global vars
## free context types
## free context storage
exit(context.parse_error ? 1 : 0);
t->array.vsize = NULL;
if (number_parse(num, tail, $2.txt) == 0)
tok_err(c, "error: unrecognised number", &$2);
- else if (tail[0])
+ else if (tail[0]) {
tok_err(c, "error: unsupported number suffix", &$2);
- else {
+ mpq_clear(num);
+ } else {
t->array.size = mpz_get_ui(mpq_numref(num));
if (mpz_cmp_ui(mpq_denref(num), 1) != 0) {
tok_err(c, "error: array size must be an integer",
type_err(c,
"Variable declared with no type or value: %v",
$1, NULL, 0, NULL);
+ free_var($1);
} else {
$0 = new(binode);
$0->op = Declare;
v->where_set = var;
var->var = v;
v->constant = 1;
+ v->global = 1;
} else {
- v = var_ref(c, $1.txt);
+ struct variable *vorig = var_ref(c, $1.txt);
tok_err(c, "error: name already declared", &$1);
type_err(c, "info: this is where '%v' was first declared",
- v->where_decl, NULL, 0, NULL);
+ vorig->where_decl, NULL, 0, NULL);
}
do {
ok = 1;
name->type->function.return_type = ret;
global_alloc(c, name->type, name, &fn);
var_block_close(c, CloseSequential, code);
- } else
+ } else {
+ free_binode(args);
+ free_type(ret);
+ free_exec(code);
var_block_close(c, CloseSequential, NULL);
+ }
return name;
}