iris6.h (NO_BUILTIN_WINT_TYPE): Define.
authorRainer Orth <ro@TechFak.Uni-Bielefeld.DE>
Mon, 11 Jun 2001 20:36:56 +0000 (20:36 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Mon, 11 Jun 2001 20:36:56 +0000 (20:36 +0000)
* config/mips/iris6.h (NO_BUILTIN_WINT_TYPE): Define.
(WINT_TYPE): Override.
(WINT_TYPE_SIZE): Likewise.
(SUBTARGET_CPP_SIZE_SPEC): Define __WINT_TYPE__ as appropriate.

* config/sparc/sol2.h (WINT_TYPE): Define.
(WINT_TYPE_SIZE): Likewise.

* config/sparc/sol2-sld-64.h (NO_BUILTIN_WINT_TYPE): Define.
(WINT_TYPE): Override.
(WINT_TYPE_SIZE): Likewise.
(CPP_ARCH32_SPEC): Add __WINT_TYPE__ definition.
(CPP_ARCH64_SPEC): Likewise.

testsuite:
* gcc.dg/wchar_t-1.c: New file.
* gcc.dg/wint_t-1.c: Likewise.

From-SVN: r43216

gcc/ChangeLog
gcc/config/mips/iris6.h
gcc/config/sparc/sol2-sld-64.h
gcc/config/sparc/sol2.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/wchar_t-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/wint_t-1.c [new file with mode: 0644]

index 25caf8dcf372a4377bfff1f261a334087d9f5cb3..45092bd0a52d0d049847c58d0fe10df08460b972 100644 (file)
@@ -1,3 +1,19 @@
+2001-06-11  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * config/mips/iris6.h (NO_BUILTIN_WINT_TYPE): Define.
+       (WINT_TYPE): Override.
+       (WINT_TYPE_SIZE): Likewise.
+       (SUBTARGET_CPP_SIZE_SPEC): Define __WINT_TYPE__ as appropriate.
+
+       * config/sparc/sol2.h (WINT_TYPE): Define.
+       (WINT_TYPE_SIZE): Likewise.
+
+       * config/sparc/sol2-sld-64.h (NO_BUILTIN_WINT_TYPE): Define.
+       (WINT_TYPE): Override.
+       (WINT_TYPE_SIZE): Likewise.
+       (CPP_ARCH32_SPEC): Add __WINT_TYPE__ definition.
+       (CPP_ARCH64_SPEC): Likewise.
+
 2001-06-11  Richard Henderson  <rth@redhat.com>
 
        * unwind-dw2-fde.c (__deregister_frame_info): Don't play games
index fdde59cb02d94066a934b6ff7fc56303ffd40c2e..d7fc21979924963151339b774a055d9388fc10b6 100644 (file)
@@ -39,6 +39,26 @@ Boston, MA 02111-1307, USA.  */
    we avoid creating such labels.  */
 #define DWARF2_GENERATE_TEXT_SECTION_LABEL 0
 
+/* wchar_t is defined differently with and without -mabi=64.  */
+
+#define NO_BUILTIN_WCHAR_TYPE
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE (Pmode == DImode ? "int" : "long int")
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+/* Same for wint_t.  */
+
+#define NO_BUILTIN_WINT_TYPE
+
+#undef WINT_TYPE
+#define WINT_TYPE (Pmode == DImode ? "int" : "long int")
+
+#undef WINT_TYPE_SIZE
+#define WINT_TYPE_SIZE 32
+
 /* For Irix 6, -mabi=64 implies TARGET_LONG64.  */
 /* This is handled in override_options.  */
 
@@ -57,10 +77,12 @@ Boston, MA 02111-1307, USA.  */
 
 #undef SUBTARGET_CPP_SIZE_SPEC
 #define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mabi=n32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mabi=64: -D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-%{!mabi*: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}"
+%{mabi=32|mabi=n32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \
+-D__WCHAR_TYPE__=long\\ int -D__WINT_TYPE__=long\\ int} \
+%{mabi=64: -D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
+-D__WCHAR_TYPE__=int -D__WINT_TYPE__=int} \
+%{!mabi*: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \
+-D__WCHAR_TYPE__=long\\ int -D__WINT_TYPE__=long\\ int}"
 
 /* We must make -mips3 do what -mlong64 used to do.  */
 /* ??? If no mipsX option given, but a mabi=X option is, then should set
index 46c7da59e200ff25dc7814f51c6569e533cc1260..9179635c6363ea9663aaf539edbe03c4a7cbcfd7 100644 (file)
 %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
 ")
 
+/* wchar_t is called differently in <wchar.h> for 32 and 64-bit
+   compilations.  This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
+   (32-bit) and p. 6P-10, Figure 6.38 (64-bit).  */
+#define NO_BUILTIN_WCHAR_TYPE
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE (TARGET_ARCH64 ? "int" : "long int")
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+/* Same for wint_t.  See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit).  There's
+   no corresponding 64-bit definition, but this is what Solaris 8
+   <iso/wchar_iso.h> uses.  */
+#define NO_BUILTIN_WINT_TYPE
+
+#undef WINT_TYPE
+#define WINT_TYPE (TARGET_ARCH64 ? "int" : "long int")
+
+#undef WINT_TYPE_SIZE
+#define WINT_TYPE_SIZE 32
+
 #undef CPP_ARCH32_SPEC
 #define CPP_ARCH32_SPEC "-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \
+-D__WCHAR_TYPE__=long\\ int -D__WINT_TYPE__=long\\ int \
 -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc"
 #undef CPP_ARCH64_SPEC
 #define CPP_ARCH64_SPEC "-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
+-D__WCHAR_TYPE__=int -D__WINT_TYPE__=int \
 -D__arch64__ -Acpu=sparc64 -Amachine=sparcv9 -D__sparcv9"
 
 #undef CPP_ARCH_SPEC
index 64a4e4a6e37b0ea861af2661d7f8111738135ee3..ee7fa063b1733b51b4f93a313a3a748666e76894 100644 (file)
@@ -1,5 +1,6 @@
 /* Definitions of target machine for GNU compiler, for SPARC running Solaris 2
-   Copyright 1992, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright 1992, 1995, 1996, 1997, 1998, 1999, 2000,
+   2001 Free Software Foundation, Inc.
    Contributed by Ron Guilmette (rfg@netcom.com).
    Additional changes by David V. Henkel-Wallace (gumby@cygnus.com).
 
@@ -23,6 +24,14 @@ Boston, MA 02111-1307, USA.  */
 /* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
 #include "sparc/sysv4.h"
 
+/* Solaris 2 uses a wint_t different from the default. This is required
+   by the SCD 2.4.1, p. 6-83, Figure 6-66.  */
+#undef WINT_TYPE
+#define        WINT_TYPE "long int"
+
+#undef WINT_TYPE_SIZE
+#define        WINT_TYPE_SIZE BITS_PER_WORD
+
 #undef CPP_PREDEFINES
 #define CPP_PREDEFINES \
 "-Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 \
index ceffbaebf33107515c8914c7e4192c0c67b7a15b..17842d129875cee6609b67c55394e1616cb7449f 100644 (file)
@@ -1,3 +1,8 @@
+2001-06-11  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * gcc.dg/wchar_t-1.c: New file.
+       * gcc.dg/wint_t-1.c: Likewise.
+
 2001-06-11  Bernd Schmidt  <bernds@redhat.com>
 
        * g++.old-deja/g++.other/stepanov_v1p2.C: Remove.
diff --git a/gcc/testsuite/gcc.dg/wchar_t-1.c b/gcc/testsuite/gcc.dg/wchar_t-1.c
new file mode 100644 (file)
index 0000000..6d95c69
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+/* Compile with -Wall to get a warning if built-in and system wchar_t don't
+   match.  */
+
+#define _STDDEF_H
+#include <wchar.h>
+
+__WCHAR_TYPE__ __wc_t__;
+wchar_t *wc_t_p;
+
+void
+wct (void)
+{
+  wc_t_p = &__wc_t__;
+}
diff --git a/gcc/testsuite/gcc.dg/wint_t-1.c b/gcc/testsuite/gcc.dg/wint_t-1.c
new file mode 100644 (file)
index 0000000..3f88dcb
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+/* Compile with -Wall to get a warning if built-in and system wint_t don't
+   match.  */
+
+#define _STDDEF_H
+#include <wchar.h>
+
+__WINT_TYPE__ __wi_t__;
+wint_t *wi_t_p;
+
+void
+wit (void)
+{
+  wi_t_p = &__wi_t__;
+}