From: Rainer Orth Date: Mon, 11 Jun 2001 20:36:56 +0000 (+0000) Subject: iris6.h (NO_BUILTIN_WINT_TYPE): Define. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=55f61a560234c69dcc3537b2a5fd2eabbff52e20;p=gcc.git iris6.h (NO_BUILTIN_WINT_TYPE): Define. * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 25caf8dcf37..45092bd0a52 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2001-06-11 Rainer Orth + + * 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 * unwind-dw2-fde.c (__deregister_frame_info): Don't play games diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h index fdde59cb02d..d7fc2197992 100644 --- a/gcc/config/mips/iris6.h +++ b/gcc/config/mips/iris6.h @@ -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 diff --git a/gcc/config/sparc/sol2-sld-64.h b/gcc/config/sparc/sol2-sld-64.h index 46c7da59e20..9179635c636 100644 --- a/gcc/config/sparc/sol2-sld-64.h +++ b/gcc/config/sparc/sol2-sld-64.h @@ -161,11 +161,35 @@ %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \ ") +/* wchar_t is called differently in 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 + 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 diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h index 64a4e4a6e37..ee7fa063b17 100644 --- a/gcc/config/sparc/sol2.h +++ b/gcc/config/sparc/sol2.h @@ -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 \ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ceffbaebf33..17842d12987 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2001-06-11 Rainer Orth + + * gcc.dg/wchar_t-1.c: New file. + * gcc.dg/wint_t-1.c: Likewise. + 2001-06-11 Bernd Schmidt * 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 index 00000000000..6d95c69c304 --- /dev/null +++ b/gcc/testsuite/gcc.dg/wchar_t-1.c @@ -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_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 index 00000000000..3f88dcbeab0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/wint_t-1.c @@ -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 + +__WINT_TYPE__ __wi_t__; +wint_t *wi_t_p; + +void +wit (void) +{ + wi_t_p = &__wi_t__; +}