Skip to content

Commit

Permalink
fix: Force use of 32-bit integer wchar_t which was already assumed el…
Browse files Browse the repository at this point in the history
…sewhere as this typedef may vary on some platforms.
  • Loading branch information
ijsf committed May 27, 2024
1 parent 17cd89f commit 17bb7ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/cc/frontend/lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,8 @@ static void *convert_str_to_wstr(const char *src, size_t *plen) {
break;
}

wchar_t *wstr = malloc_or_die(len * sizeof(*wstr));
wchar_t *q = wstr;
int *wstr = malloc_or_die(len * sizeof(*wstr));
int *q = wstr;
for (const char *p = src;; ) {
int c;
p = read_utf8_char(p, &c);
Expand Down
2 changes: 1 addition & 1 deletion src/cc/frontend/parser_expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ static Expr *parse_prim(void) {
{TK_ULONGLIT, FX_LONG, true},
{TK_ULLONGLIT, FX_LLONG, true},
#ifndef __NO_WCHAR
{TK_WCHARLIT, FX_INT, true}, // TODO: Must match with target's wchar_t
{TK_WCHARLIT, FX_INT, true}, // Uses 32-bit wchar_t internally
#endif
};
for (int i = 0; i < (int)ARRAY_SIZE(TABLE); ++i) {
Expand Down

0 comments on commit 17bb7ac

Please sign in to comment.