@@ -84,7 +84,7 @@ void get_char_constant(struct token *token, unsigned long long *val)
end = p + type - TOKEN_WIDE_CHAR;
}
p = parse_escape(p, &v, end,
- type < TOKEN_WIDE_CHAR ? bits_in_char : bits_in_wchar, token->pos);
+ type < TOKEN_WIDE_CHAR ? bits_in_char : wchar_ctype->bit_size, token->pos);
if (p != end)
warning(token->pos,
"multi-character character constant");
@@ -113,7 +113,7 @@ struct token *get_string_constant(struct token *token, struct expression *expr)
done = next;
}
}
- bits = is_wide ? bits_in_wchar : bits_in_char;
+ bits = is_wide ? wchar_ctype->bit_size: bits_in_char;
while (token != done) {
unsigned v;
const char *p = token->string->data;
@@ -1246,9 +1246,7 @@ static void predefined_macros(void)
predefined_ctype("SHORT", &short_ctype, PTYPE_SIZEOF);
predefined_ctype("SHRT", &short_ctype, PTYPE_MAX|PTYPE_WIDTH);
predefined_ctype("SCHAR", &char_ctype, PTYPE_MAX|PTYPE_WIDTH);
- predefined_sizeof("WCHAR", "_T", bits_in_wchar);
- predefined_max("WCHAR", "", bits_in_wchar);
- predefined_width("WCHAR", bits_in_wchar);
+ predefined_ctype("WCHAR", wchar_ctype, PTYPE_ALL|PTYPE_T);
predefine("__CHAR_BIT__", 1, "%d", bits_in_char);
@@ -5,6 +5,7 @@
struct symbol *size_t_ctype = &uint_ctype;
struct symbol *ssize_t_ctype = &int_ctype;
+struct symbol *wchar_ctype = &int_ctype;
/*
* For "__attribute__((aligned))"
@@ -22,8 +23,6 @@ int bits_in_long = 32;
int bits_in_longlong = 64;
int bits_in_longlonglong = 128;
-int bits_in_wchar = 32;
-
int max_int_alignment = 4;
/*
@@ -3,6 +3,7 @@
extern struct symbol *size_t_ctype;
extern struct symbol *ssize_t_ctype;
+extern struct symbol *wchar_ctype;
/*
* For "__attribute__((aligned))"
@@ -20,8 +21,6 @@ extern int bits_in_long;
extern int bits_in_longlong;
extern int bits_in_longlonglong;
-extern int bits_in_wchar;
-
extern int max_int_alignment;
/*