aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1999-09-23 21:03:53 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-09-23 17:03:53 -0400
commit12a39b12648fdd1675757518450720d16ef24793 (patch)
treef1348bbe949f8cba90abd610eefdbe630bdaa2c1 /gcc/c-decl.c
parente689ae67255aca55fddb4b01b0b9ded6d3f151ea (diff)
downloadgcc-12a39b12648fdd1675757518450720d16ef24793.zip
gcc-12a39b12648fdd1675757518450720d16ef24793.tar.gz
gcc-12a39b12648fdd1675757518450720d16ef24793.tar.bz2
toplev.c (documented_lang_options): Add -fshort-wchar.
* toplev.c (documented_lang_options): Add -fshort-wchar. * c-decl.c (c_decode_option): Likewise. (init_decl_processing): If -fshort-wchar, use 'short unsigned int' for wchar_t. * c-common.c, c-lex.c: Get WCHAR_TYPE_SIZE from wchar_type_node. * gcc.c (default_compilers): If -fshort-wchar, override __WCHAR_TYPE__. * tm.texi (C Dialect Options): Add -fshort-wchar. From-SVN: r29638
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 75b8ee0..b2f32c6 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -304,6 +304,10 @@ int flag_cond_mismatch;
int flag_short_double;
+/* Nonzero means give `wchar_t' the same size as `short'. */
+
+int flag_short_wchar;
+
/* Nonzero means don't recognize the keyword `asm'. */
int flag_no_asm;
@@ -580,6 +584,10 @@ c_decode_option (argc, argv)
flag_short_enums = 1;
else if (!strcmp (p, "-fno-short-enums"))
flag_short_enums = 0;
+ else if (!strcmp (p, "-fshort-wchar"))
+ flag_short_wchar = 1;
+ else if (!strcmp (p, "-fno-short-wchar"))
+ flag_short_wchar = 0;
else if (!strcmp (p, "-fcond-mismatch"))
flag_cond_mismatch = 1;
else if (!strcmp (p, "-fno-cond-mismatch"))
@@ -2984,8 +2992,10 @@ init_decl_processing ()
pushdecl (build_decl (TYPE_DECL,
ridpointers[(int) RID_VOID], void_type_node));
- wchar_type_node
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WCHAR_TYPE)));
+ wchar_type_node = get_identifier (flag_short_wchar
+ ? "short unsigned int"
+ : WCHAR_TYPE);
+ wchar_type_node = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (wchar_type_node));
wchar_type_size = TYPE_PRECISION (wchar_type_node);
signed_wchar_type_node = signed_type (wchar_type_node);
unsigned_wchar_type_node = unsigned_type (wchar_type_node);