Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
fuhsnn committed Dec 29, 2024
1 parent 2a9c631 commit da51df8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,11 +1180,12 @@ static int calling_convention(Obj *var, int *gp_count, int *fp_count, int *stack
int gp = *gp_count, fp = *fp_count;
for (; var; var = var->param_next) {
Type *ty = var->ty;
assert(ty->size != 0);

switch (ty->kind) {
case TY_STRUCT:
case TY_UNION:
if (ty->size == 0)
continue;
if (ty->size <= 16) {
int fp_inc = has_flonum1(ty) + (ty->size > 8 && has_flonum2(ty));
int gp_inc = !has_flonum1(ty) + (ty->size > 8 && !has_flonum2(ty));
Expand Down
3 changes: 2 additions & 1 deletion parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -4085,7 +4085,8 @@ static Node *primary(Token **rest, Token *tok) {

if (equal(tok, "sizeof")) {
Type *ty;
if (equal(tok->next, "(") && is_typename(tok->next->next)) {
if (equal(tok->next, "(") && is_typename(tok->next->next) &&
!equal(skip_paren(tok->next->next), "{")) {
ty = typename(&tok, tok->next->next);
*rest = skip(tok, ")");
} else {
Expand Down
4 changes: 3 additions & 1 deletion preprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,9 @@ static Token *directives(Token **cur, Token *start, bool is_root) {
char *filename = read_include_filename(split_line(&tok, tok->next), &is_dquote);
int incl_no = -1;
char *path = search_include_paths2(filename, start, is_dquote, &incl_no);
return include_file(tok, path ? path : filename, start->next->next, &incl_no);
if (!path)
error_tok(start->next->next, "%s: cannot open file: %s", filename, strerror(errno));
return include_file(tok, path, start->next->next, &incl_no);
}

if (equal(tok, "include_next")) {
Expand Down

0 comments on commit da51df8

Please sign in to comment.