aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1999-09-23 21:04:10 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-09-23 17:04:10 -0400
commit5096c664f76b7355439ca9b158d0cfe720eaa0a6 (patch)
tree97859354aefd622727d4158ea6e091ae0fad0b5c /gcc
parent12a39b12648fdd1675757518450720d16ef24793 (diff)
downloadgcc-5096c664f76b7355439ca9b158d0cfe720eaa0a6.zip
gcc-5096c664f76b7355439ca9b158d0cfe720eaa0a6.tar.gz
gcc-5096c664f76b7355439ca9b158d0cfe720eaa0a6.tar.bz2
lex.c: Get WCHAR_TYPE_SIZE from wchar_type_node.
* 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. From-SVN: r29639
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/cp-tree.h4
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/cp/decl2.c5
-rw-r--r--gcc/cp/lang-specs.h3
-rw-r--r--gcc/cp/lex.c9
6 files changed, 27 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3323506..51f48da 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+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.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 78ec70e..d601543f 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -930,6 +930,10 @@ extern int name_mangling_version;
/* 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. */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1e63523..86c1705 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6247,8 +6247,10 @@ init_decl_processing ()
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);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 0b8083a..3b80f68 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -456,6 +456,10 @@ int name_mangling_version = 2;
/* 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. */
@@ -491,6 +495,7 @@ lang_f_options[] =
{"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},
diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index 48a6ac5..692583c 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -39,6 +39,7 @@ Boston, MA 02111-1307, USA. */
%{!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\
@@ -50,6 +51,7 @@ Boston, MA 02111-1307, USA. */
%{!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}\
@@ -71,6 +73,7 @@ Boston, MA 02111-1307, USA. */
%{!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\
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index af78b7f..c396a50 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -348,13 +348,8 @@ int interface_unknown; /* whether or not we know this class
/* 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)