* lang-specs.h: If -fshort-wchar, override __WCHAR_TYPE__.
* decl2.c (lang_f_options): Add -fshort-wchar.
* cp-tree.h: Declare flag_short_wchar.
* decl.c (init_decl_processing): If -fshort-wchar, use 'short unsigned
int' for wchar_t.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29639
138bc75d-0d04-0410-961f-
82ee72b054a4
+1999-09-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c: Get WCHAR_TYPE_SIZE from wchar_type_node.
+ * lang-specs.h: If -fshort-wchar, override __WCHAR_TYPE__.
+ * decl2.c (lang_f_options): Add -fshort-wchar.
+ * cp-tree.h: Declare flag_short_wchar.
+ * decl.c (init_decl_processing): If -fshort-wchar, use 'short unsigned
+ int' for wchar_t.
+
1999-09-23 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* ir.texi: Fix formatting errors and typos.
/* Nonzero means that guiding declarations are allowed. */
extern int flag_guiding_decls;
+/* Nonzero if wchar_t should be `unsigned short' instead of whatever it
+ would normally be, for use with WINE. */
+extern int flag_short_wchar;
+
/* Nonzero if squashed mangling is to be performed.
This uses the B and K codes to reference previously seen class types
and class qualifiers. */
TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node;
/* This is special for C++ so functions can be overloaded. */
- 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 = make_signed_type (wchar_type_size);
unsigned_wchar_type_node = make_unsigned_type (wchar_type_size);
/* Nonzero means that guiding declarations are allowed. */
int flag_guiding_decls;
+/* Nonzero if wchar_t should be `unsigned short' instead of whatever it
+ would normally be, for use with WINE. */
+int flag_short_wchar;
+
/* Nonzero if squashed mangling is to be performed.
This uses the B and K codes to reference previously seen class types
and class qualifiers. */
{"unsigned-bitfields", &flag_signed_bitfields, 0},
{"short-enums", &flag_short_enums, 1},
{"short-double", &flag_short_double, 1},
+ {"short-wchar", &flag_short_wchar, 1},
{"cond-mismatch", &flag_cond_mismatch, 1},
{"asm", &flag_no_asm, 0},
{"builtin", &flag_no_builtin, 0},
%{!fno-exceptions:-D__EXCEPTIONS}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
%{ffast-math:-D__FAST_MATH__}\
+ %{fshort-wchar:-D__WCHAR_TYPE__=short\\ unsigned\\ int}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}\
%{!E:%{!M:%{!MM:cc1plus %i %1 %2\
%{!fno-exceptions:-D__EXCEPTIONS}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
%{ffast-math:-D__FAST_MATH__}\
+ %{fshort-wchar:-D__WCHAR_TYPE__=short\\ unsigned\\ int}\
%{trigraphs}\
%{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\
%{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
%{!fno-exceptions:-D__EXCEPTIONS}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
%{ffast-math:-D__FAST_MATH__}\
+ %{fshort-wchar:-D__WCHAR_TYPE__=short\\ unsigned\\ int}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.ii}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
"%{!M:%{!MM:%{!E:cc1plus %{!pipe:%g.ii} %1 %2\
/* lexical analyzer */
-#ifndef WCHAR_TYPE_SIZE
-#ifdef INT_TYPE_SIZE
-#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
-#else
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-#endif
-#endif
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE TYPE_PRECISION (wchar_type_node)
/* Number of bytes in a wide character. */
#define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)