diff --git a/include/absyn.h b/include/absyn.h index 0bdc700f..6dc035d3 100644 --- a/include/absyn.h +++ b/include/absyn.h @@ -457,7 +457,7 @@ ANEW ANN AST_NEW(Exp*, exp_td, Type_Decl *, const loc_t); static inline Exp* take_exp(Exp* exp, const uint32_t n) { Exp* e = exp; - for (uint32_t i = 1; i < n; i++) CHECK_OO((e = e->next)); + for (uint32_t i = 1; i < n; i++) CHECK_O((e = e->next)); return e; } diff --git a/include/ast_pass.h b/include/ast_pass.h index 965fcc3b..5900be64 100644 --- a/include/ast_pass.h +++ b/include/ast_pass.h @@ -4,12 +4,8 @@ #ifndef __AST_PASS #define __AST_PASS -static inline m_bool dummy_func(const void *a NUSED, const void *b NUSED) { - return 1; -} - -static inline bool bdummy_func(const void *a NUSED, const void *b NUSED) { - return 1; +static inline bool dummy_func(const void *a NUSED, const void *b NUSED) { + return true; } #define DECL_PRIM_FUNC(prefix, type, arg) \ diff --git a/src/gwion.l b/src/gwion.l index c5bd3dec..a36f82c1 100644 --- a/src/gwion.l +++ b/src/gwion.l @@ -630,7 +630,7 @@ static inline bool scan_rem_macro(Scanner *scan, const m_str id) { vector_add(&scan->pp->global_undef, (vtype)sym); return ret; } - return GW_OK; + return true; } static bool rem_macro(void* data, const m_str str) { @@ -642,13 +642,13 @@ static bool rem_macro(void* data, const m_str str) { if(ret) return true; lexer_error(data, "Undefined", ERRORCODE(104)); - return GW_ERROR; + return false; } static inline Macro scan_has_macro(Scanner *scan, const m_str id) { const Symbol sym = insert_symbol(scan->st, id); - const m_int ret = vector_size(&scan->pp->global_undef) ? vector_find(&scan->pp->global_undef, (vtype)sym) : GW_ERROR; - if(ret != GW_ERROR) + const m_int ret = vector_size(&scan->pp->global_undef) ? vector_find(&scan->pp->global_undef, (vtype)sym) : -1; + if(ret != -1) return NULL; const Macro global = ppa_has_macro(scan->ppa, insert_symbol(scan->st, id)); if(global) @@ -1003,7 +1003,7 @@ int yywrap(void* data) { static bool handle_comma(void* data) { const Scanner *scan = yyget_extra(data); const MacroArg a = scan->pp->entry->args; - if(scan->pp->npar > 1) { handle_char(data, ","); return GW_OK;} + if(scan->pp->npar > 1) { handle_char(data, ","); return true;} if(strcmp(a->name, "__VA_ARGS__")) { if(!(scan->pp->entry->args = a->next)) { loc_t *loc = yyget_lloc(data); diff --git a/src/gwion.y b/src/gwion.y index 481ecbd3..27dde87b 100644 --- a/src/gwion.y +++ b/src/gwion.y @@ -283,7 +283,7 @@ specialized: ID traits { } | "const" type_decl_empty ID { $$ = (Specialized) { - .tag = MK_TAG($3, @2), + .tag = MK_TAG($3, @3), .td = $2, }; } diff --git a/src/lexer.c b/src/lexer.c index edf48d84..d7066384 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -3998,7 +3998,7 @@ static inline bool scan_rem_macro(Scanner *scan, const m_str id) { vector_add(&scan->pp->global_undef, (vtype)sym); return ret; } - return GW_OK; + return true; } static bool rem_macro(void* data, const m_str str) { @@ -4010,13 +4010,13 @@ static bool rem_macro(void* data, const m_str str) { if(ret) return true; lexer_error(data, "Undefined", ERRORCODE(104)); - return GW_ERROR; + return false; } static inline Macro scan_has_macro(Scanner *scan, const m_str id) { const Symbol sym = insert_symbol(scan->st, id); - const m_int ret = vector_size(&scan->pp->global_undef) ? vector_find(&scan->pp->global_undef, (vtype)sym) : GW_ERROR; - if(ret != GW_ERROR) + const m_int ret = vector_size(&scan->pp->global_undef) ? vector_find(&scan->pp->global_undef, (vtype)sym) : -1; + if(ret != -1) return NULL; const Macro global = ppa_has_macro(scan->ppa, insert_symbol(scan->st, id)); if(global) @@ -4371,7 +4371,7 @@ int yywrap(void* data) { static bool handle_comma(void* data) { const Scanner *scan = yyget_extra(data); const MacroArg a = scan->pp->entry->args; - if(scan->pp->npar > 1) { handle_char(data, ","); return GW_OK;} + if(scan->pp->npar > 1) { handle_char(data, ","); return true;} if(strcmp(a->name, "__VA_ARGS__")) { if(!(scan->pp->entry->args = a->next)) { loc_t *loc = yyget_lloc(data); diff --git a/src/parser.c b/src/parser.c index 6d634b32..355f7a94 100644 --- a/src/parser.c +++ b/src/parser.c @@ -2794,7 +2794,7 @@ YYLTYPE yylloc = yyloc_default; #line 284 "src/gwion.y" { (yyval.specialized) = (Specialized) { - .tag = MK_TAG((yyvsp[0].sym), (yylsp[-1])), + .tag = MK_TAG((yyvsp[0].sym), (yylsp[0])), .td = (yyvsp[-1].type_decl), }; }