Skip to content

Commit

Permalink
🎨 no more m_bool
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Feb 17, 2024
1 parent f8ed98c commit 1292b90
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion include/absyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 2 additions & 6 deletions include/ast_pass.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
10 changes: 5 additions & 5 deletions src/gwion.l
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/gwion.y
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
Expand Down
10 changes: 5 additions & 5 deletions src/lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
}
Expand Down

0 comments on commit 1292b90

Please sign in to comment.