* lex.c: Get WCHAR_TYPE_SIZE from wchar_type_node.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Sep 1999 21:04:10 +0000 (21:04 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Sep 1999 21:04:10 +0000 (21:04 +0000)
* 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

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/lang-specs.h
gcc/cp/lex.c

index 3323506..51f48da 100644 (file)
@@ -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.
index 78ec70e..d601543 100644 (file)
@@ -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.       */
index 1e63523..86c1705 100644 (file)
@@ -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);
index 0b8083a..3b80f68 100644 (file)
@@ -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},
index 48a6ac5..692583c 100644 (file)
@@ -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\
index af78b7f..c396a50 100644 (file)
@@ -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)