Mercurial > lbo > hg > ylisp
changeset 174:0c4e9e76a2f2
all: Make ylisp work in Release mode too
by changing the way asserts are used when there are side-effects.
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Mon, 09 Sep 2019 19:57:39 +0200 |
parents | 800a02381024 |
children | 07ff95760f4a |
files | gen/y.lex gen/y.yy src/atom.c src/preprocess.c |
diffstat | 4 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/y.lex Mon Sep 09 19:53:57 2019 +0200 +++ b/gen/y.lex Mon Sep 09 19:57:39 2019 +0200 @@ -44,7 +44,8 @@ // Only used by debug_lexer. int ylex(FILE* in) { yyscan_t scanner; - assert(0 == yylex_init(&scanner)); + int lex_init_ok = yylex_init(&scanner); + assert(0 == lex_init_ok); #ifndef DEBUG FILE* out = fopen("/dev/null", "w"); @@ -60,6 +61,7 @@ printf("token: %d text: %s\n", tok, yyget_text(scanner)); fclose(in); fclose(out); - assert(0 == yylex_destroy(scanner)); + int lex_destroy_ok = yylex_destroy(scanner); + assert(0 == lex_destroy_ok); return 0; }
--- a/gen/y.yy Mon Sep 09 19:53:57 2019 +0200 +++ b/gen/y.yy Mon Sep 09 19:57:39 2019 +0200 @@ -215,7 +215,8 @@ #ifndef DEBUG fclose(out); #endif - assert(0 == yylex_destroy(scanner)); + int lex_destroy_ok = yylex_destroy(scanner); + assert(0 == lex_destroy_ok); return ret; }
--- a/src/atom.c Mon Sep 09 19:53:57 2019 +0200 +++ b/src/atom.c Mon Sep 09 19:57:39 2019 +0200 @@ -37,7 +37,8 @@ wanted.data = (void*)yatom_counter++; YVEC_PUSH(&yatom_names, &wanted.key); assert(yatom_names.len == yatom_counter - YATOM_COUNTER_OFFSET); - assert(hsearch_r(wanted, ENTER, &found, &yatom_table)); + bool atom_found = hsearch_r(wanted, ENTER, &found, &yatom_table); + assert(atom_found); return (yatom_t)wanted.data; } else { // Found.
--- a/src/preprocess.c Mon Sep 09 19:53:57 2019 +0200 +++ b/src/preprocess.c Mon Sep 09 19:57:39 2019 +0200 @@ -202,7 +202,8 @@ // mapping onto scope stack. yref_t new_ref; // TODO: handle errors better - assert(ypreprocess_compile_defn(expr, &new_ref)); + bool compile_defn_ok = ypreprocess_compile_defn(expr, &new_ref); + assert(compile_defn_ok); yvalue_t* func = yvalue_get(new_ref); assert(func != NULL);