]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* c-common.c (c_common_init): Set options->unsigned_wchar.
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 May 2002 21:07:24 +0000 (21:07 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 May 2002 21:07:24 +0000 (21:07 +0000)
* cppinit.c (cpp_create_reader): Default unsigned_wchar,
group target dependencies.
(init_builtins, cpp_handle_option): Update.
* cpplex.c (cpp_interpret_charconst): Update.
* cpplib.h (struct cpp_options): Add unsigned_wchar, rename
signed_char to unsigned_char, group target dependencies.
* defaults.h (WCHAR_UNSIGNED): Remove.
* system.h (WCHAR_UNSIGNED, MAX_CHAR_TYPE_SIZE): Poison.
config:
* freebsd.h, interix.h, alpha/freebsd.h, arm/freebsd.h,
i386/386bsd.h, i386/beos-elf.h, i386/bsd386.h, i386/cygwin.h,
i386/djgpp.h, i386/freebsd-aout.h, i386/i386-interix.h,
i386/win32.h, ia64/freebsd.h, mips/netbsd.h, rs6000/freebsd.h,
sh/elf.h, sh/sh.h, sparc/freebsd.h: Remove WCHAR_UNSIGNED.
doc:
* tm.texi: Remove MAX_CHAR_TYPE_SIZE.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53271 138bc75d-0d04-0410-961f-82ee72b054a4

26 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/config/alpha/freebsd.h
gcc/config/arm/freebsd.h
gcc/config/freebsd.h
gcc/config/i386/386bsd.h
gcc/config/i386/beos-elf.h
gcc/config/i386/bsd386.h
gcc/config/i386/cygwin.h
gcc/config/i386/djgpp.h
gcc/config/i386/freebsd-aout.h
gcc/config/i386/i386-interix.h
gcc/config/i386/win32.h
gcc/config/ia64/freebsd.h
gcc/config/interix.h
gcc/config/mips/netbsd.h
gcc/config/rs6000/freebsd.h
gcc/config/sh/elf.h
gcc/config/sh/sh.h
gcc/config/sparc/freebsd.h
gcc/cppinit.c
gcc/cpplex.c
gcc/cpplib.h
gcc/defaults.h
gcc/doc/tm.texi
gcc/system.h

index 0066f331c390dc578661bdfbb83809c5d0a81d78..764836dcee2f6cb930f4bcb2c5dee2b0f66060c5 100644 (file)
@@ -1,3 +1,23 @@
+2002-05-07  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * c-common.c (c_common_init): Set options->unsigned_wchar.
+       * cppinit.c (cpp_create_reader): Default unsigned_wchar,
+       group target dependencies.
+       (init_builtins, cpp_handle_option): Update.
+       * cpplex.c (cpp_interpret_charconst): Update.
+       * cpplib.h (struct cpp_options): Add unsigned_wchar, rename
+       signed_char to unsigned_char, group target dependencies.
+       * defaults.h (WCHAR_UNSIGNED): Remove.
+       * system.h (WCHAR_UNSIGNED, MAX_CHAR_TYPE_SIZE): Poison.
+config:
+       * freebsd.h, interix.h, alpha/freebsd.h, arm/freebsd.h,
+       i386/386bsd.h, i386/beos-elf.h, i386/bsd386.h, i386/cygwin.h,
+       i386/djgpp.h, i386/freebsd-aout.h, i386/i386-interix.h,
+       i386/win32.h, ia64/freebsd.h, mips/netbsd.h, rs6000/freebsd.h,
+       sh/elf.h, sh/sh.h, sparc/freebsd.h: Remove WCHAR_UNSIGNED.
+doc:
+       * tm.texi: Remove MAX_CHAR_TYPE_SIZE.
+
 2002-05-07  Mark Mitchell  <mark@codesourcery.com>
 
        * fixinc/inclhack.def (windiss_math1): New fix.
index bc4b0b96d023a21c6ae1544382267c322799d38f..b23bcfe14dd08cbd75e1c8093b094c7d250668a5 100644 (file)
@@ -4310,6 +4310,15 @@ c_common_init (filename)
   options->char_precision = TYPE_PRECISION (char_type_node);
   options->int_precision = TYPE_PRECISION (integer_type_node);
   options->wchar_precision = TYPE_PRECISION (wchar_type_node);
+  options->unsigned_wchar = TREE_UNSIGNED (wchar_type_node);
+  /* This can be uncommented when 1) This all happens before
+     cpp_post_options() (needed for __CHAR_UNSIGNED__ builtin), which
+     in turn requires wchat_type_node to be set up properly by then,
+     and 2) tradcpp is integrated, so that the preprocessors don't
+     need to handle the command-line options and the specs in gcc.c
+     can be updated.
+
+     options->unsigned_char = !flag_signed_char; */
 
   options->warn_multichar = warn_multichar;
 
index a8ace30c1801fe8467dfb7603d92a784a94b0cb3..c5b8fc834bba6bc2ba252c3d0f752b2ec9be3722 100644 (file)
@@ -53,9 +53,6 @@ Boston, MA 02111-1307, USA.  */
 /* alpha.h gets this wrong for FreeBSD.  We use the GCC defaults instead.  */
 #undef WCHAR_TYPE
 
-#undef  WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE        32
 
index a9b268c0a48e91d65a07c0836692cf6b38125348..0d417a22ded0ab825842d558819e43cfff6876ef 100644 (file)
@@ -41,9 +41,6 @@ Boston, MA 02111-1307, USA.  */
 /* We use the GCC defaults here.  */
 #undef WCHAR_TYPE
 
-#undef  WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
index 97b20c5232b9133ddafaf186bfcda03908c754f7..99ee6ae3aa6257abf50dbb64380632f837654283 100644 (file)
@@ -76,9 +76,6 @@ Boston, MA 02111-1307, USA.  */
 #undef  WCHAR_TYPE
 #define WCHAR_TYPE "int"
 
-#undef  WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
 #define MATH_LIBRARY_PROFILE    "-lm_p"
 
 /* Code generation parameters.  */
index e3bd08173c06348a7a9d252f9b81a39100424125..9745530abec0725eb05aee4a2e9b28e307956fc7 100644 (file)
@@ -17,8 +17,6 @@
 #undef WCHAR_TYPE
 #define WCHAR_TYPE "short unsigned int"
 
-#define WCHAR_UNSIGNED 1
-
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 16
 
index 208e2744d9f1aa3759c42accb5b8eea3015433bb..5b1d1d3ff22be321984ddf1dfa8cdf43af1ae9c3 100644 (file)
@@ -65,9 +65,6 @@ Boston, MA 02111-1307, USA.  */
 #undef WCHAR_TYPE
 #define WCHAR_TYPE "short unsigned int"
    
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 1
-
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 16
     
index fb24327523cabd6037b96a7be98f5a291711204f..eda80d213ed5a78e5e51ef0c1b978dc6d8871916 100644 (file)
@@ -10,9 +10,6 @@
 #undef WCHAR_TYPE
 #define WCHAR_TYPE "int"
 
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
index efdb70e48a14ede7c66b8292a80e3784d1b2885b..09d4e691d8836ed81445fadc02a3b978f5c876aa 100644 (file)
@@ -171,7 +171,6 @@ Boston, MA 02111-1307, USA.  */
 
 #define SIZE_TYPE "unsigned int"
 #define PTRDIFF_TYPE "int"
-#define WCHAR_UNSIGNED 1
 #define WCHAR_TYPE_SIZE 16
 #define WCHAR_TYPE "short unsigned int"
 
index 240877ca0e2771828b3fa06f5479a0418dad2b6b..6e53e510b4f255f905a9e4c2857abc4ff984bcdf 100644 (file)
@@ -159,9 +159,6 @@ Boston, MA 02111-1307, USA.  */
 
 /* Definitions for types and sizes. Wide characters are 16-bits long so
    Win32 compiler add-ons will be wide character compatible.  */
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 1
-
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 16
 
index 7b1d96a55ba108254d2eff8391d5e5f711461e0f..7f8a4fe811c056eaff88af9a061bcd14fded6859 100644 (file)
@@ -53,8 +53,6 @@ Boston, MA 02111-1307, USA.  */
 #undef WCHAR_TYPE
 #define WCHAR_TYPE "int"
 
-#define WCHAR_UNSIGNED 0
-
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
 
index 40fc36e66e179e650a752d5d4de9e102f50ac856..1043c5f2a49cf604db9f3372ea8384f32ec60acf 100644 (file)
@@ -44,7 +44,6 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_CPU_DEFAULT
 #define TARGET_CPU_DEFAULT 2 /* 486 */
 
-#define WCHAR_UNSIGNED 1
 #define WCHAR_TYPE_SIZE 16
 #define WCHAR_TYPE "short unsigned int"
 
index f6f32149d33d52b37e0f784e1789dd15c07d5b4f..561118b558dbfbcaaa39eb83873739afae0de4c8 100644 (file)
@@ -95,7 +95,6 @@ Boston, MA 02111-1307, USA.  */
 
 #define SIZE_TYPE "unsigned int"
 #define PTRDIFF_TYPE "int"
-#define WCHAR_UNSIGNED 1
 #define WCHAR_TYPE_SIZE 16
 #define WCHAR_TYPE "short unsigned int"
 /* Currently we do not have the atexit() function,
index 57bb391e27093aa6b02a0ebfb67fc4d2d0fbc8cd..34dc885905b24830d2a0fa0c53978eda128dde76 100644 (file)
@@ -42,9 +42,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    We use the GCC defaults instead.  */
 #undef WCHAR_TYPE
 
-#undef  WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
index 778c9ae74733e2c4503621e7c31a6179577ec8d5..9100e01adb7bd69e9628b508897731d34da790d1 100644 (file)
@@ -100,7 +100,6 @@ for windows/multi thread */
 
 #undef WCHAR_TYPE
 #undef WCHAR_TYPE_SIZE
-#define WCHAR_UNSIGNED 1
 #define WCHAR_TYPE "short unsigned int"
 #define WCHAR_TYPE_SIZE 16
 
index 95d3901df942a44254abd05aa58d20f8e7e84723..c625b9d2cdb58904b57bae0837f2df80c250d08b 100644 (file)
@@ -185,9 +185,6 @@ Boston, MA 02111-1307, USA.  */
 #undef WCHAR_TYPE
 #define WCHAR_TYPE "int"
 
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
index e4b9fc52fc0b52f4b7a946e07619d3ce7c1661c7..e4b6482798edc05fe3dcc3a3d5b374e0c1d18e29 100644 (file)
@@ -48,9 +48,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* rs6000.h gets this wrong for FreeBSD.  We use the GCC defaults instead.  */
 #undef WCHAR_TYPE
 
-#undef  WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
index 246a2ff48e3d03d4ae5873bf5454e293f8041156..716f494229af349a266d8f2ef0e2131289c07406 100644 (file)
@@ -30,9 +30,6 @@ Boston, MA 02111-1307, USA.  */
 #undef SIZE_TYPE
 #undef PTRDIFF_TYPE
 
-/* And one that is defined in sh.h and should be undefined in svr4.h...  */
-#undef WCHAR_UNSIGNED
-
 /* Be ELF-like.  */
 /* TODO: convert includes to ${tm_file} list in config.gcc.  */
 #include "dbxelf.h"
index 669427064ef70b6f6aa8e4a0c02e2da9e12f2ef4..5a5094e1c9d9b6cd2d9cfc448ccde44b33ae52bd 100644 (file)
@@ -2522,7 +2522,6 @@ while (0)
 
 #define WCHAR_TYPE "short unsigned int"
 #define WCHAR_TYPE_SIZE 16
-#define WCHAR_UNSIGNED 1
 
 #define SH_ELF_WCHAR_TYPE "long int"
 
index d50de8457333aced4348d735da4e4056a7a095a3..e966090eafb222a666612dfa4589de5f5ebaf427 100644 (file)
@@ -50,9 +50,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    We use the GCC defaults instead.  */
 #undef WCHAR_TYPE
 
-#undef  WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
index 1d570b0e98aeca570edcb0c97dcc23f03ae7a994..dae4ffe602c8040ed2ee3c0955b661670209cfbd 100644 (file)
@@ -494,11 +494,6 @@ cpp_create_reader (lang)
   CPP_OPTION (pfile, tabstop) = 8;
   CPP_OPTION (pfile, operator_names) = 1;
   CPP_OPTION (pfile, warn_endif_labels) = 1;
-#if DEFAULT_SIGNED_CHAR
-  CPP_OPTION (pfile, signed_char) = 1;
-#else
-  CPP_OPTION (pfile, signed_char) = 0;
-#endif
 
   CPP_OPTION (pfile, pending) =
     (struct cpp_pending *) xcalloc (1, sizeof (struct cpp_pending));
@@ -510,6 +505,8 @@ cpp_create_reader (lang)
   CPP_OPTION (pfile, char_precision) = CHAR_BIT;
   CPP_OPTION (pfile, wchar_precision) = CHAR_BIT * sizeof (int);
   CPP_OPTION (pfile, int_precision) = CHAR_BIT * sizeof (int);
+  CPP_OPTION (pfile, unsigned_char) = !DEFAULT_SIGNED_CHAR;
+  CPP_OPTION (pfile, unsigned_wchar) = 1;
 
   /* It's simplest to just create this struct whether or not it will
      be needed.  */
@@ -779,7 +776,7 @@ init_builtins (pfile)
   else if (CPP_OPTION (pfile, c99))
     _cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");
 
-  if (CPP_OPTION (pfile, signed_char) == 0)
+  if (CPP_OPTION (pfile, unsigned_char))
     _cpp_define_builtin (pfile, "__CHAR_UNSIGNED__ 1");
 
   if (CPP_OPTION (pfile, lang) == CLK_STDC89
@@ -1450,10 +1447,10 @@ cpp_handle_option (pfile, argc, argv, ignore)
          CPP_OPTION (pfile, show_column) = 0;
          break;
        case OPT_fsigned_char:
-         CPP_OPTION (pfile, signed_char) = 1;
+         CPP_OPTION (pfile, unsigned_char) = 0;
          break;
        case OPT_funsigned_char:
-         CPP_OPTION (pfile, signed_char) = 0;
+         CPP_OPTION (pfile, unsigned_char) = 1;
          break;
        case OPT_ftabstop:
          /* Silently ignore empty string, non-longs and silly values.  */
index a9f14948133cd4fbda95f6370e05f075e41df09a..39afc5905a93bb5ff68ad152015ecce34e2e61f8 100644 (file)
@@ -1883,13 +1883,13 @@ cpp_interpret_charconst (pfile, token, pchars_seen, unsignedp)
     {
       width = CPP_OPTION (pfile, char_precision);
       max_chars = CPP_OPTION (pfile, int_precision) / width;
-      unsigned_p = CPP_OPTION (pfile, signed_char) == 0;
+      unsigned_p = CPP_OPTION (pfile, unsigned_char);
     }
   else
     {
       width = CPP_OPTION (pfile, wchar_precision);
       max_chars = 1;
-      unsigned_p = WCHAR_UNSIGNED;
+      unsigned_p = CPP_OPTION (pfile, unsigned_wchar);
     }
 
   if (width < BITS_PER_CPPCHAR_T)
index ca0eee2bd639dbce1412e43b42744b4c08dfd677..1b7da3794f3e286590032d1eab53b44b79287dd9 100644 (file)
@@ -251,19 +251,12 @@ struct cpp_options
   /* -fleading_underscore sets this to "_".  */
   const char *user_label_prefix;
 
-  /* Precision for target CPP arithmetic, target characters, target
-     ints and target wide characters, respectively.  */
-  size_t precision, char_precision, int_precision, wchar_precision;
-
   /* The language we're preprocessing.  */
   enum c_lang lang;
 
   /* Non-0 means -v, so print the full set of include dirs.  */
   unsigned char verbose;
 
-  /* Nonzero means chars are signed.  */
-  unsigned char signed_char;
-
   /* Nonzero means use extra default include directories for C++.  */
   unsigned char cplusplus;
 
@@ -395,6 +388,15 @@ struct cpp_options
      options.  Stand-alone CPP should then bail out after option
      parsing; drivers might want to continue printing help.  */
   unsigned char help_only;
+
+  /* Target-specific features set by the front end or client.  */
+
+  /* Precision for target CPP arithmetic, target characters, target
+     ints and target wide characters, respectively.  */
+  size_t precision, char_precision, int_precision, wchar_precision;
+
+  /* Nonzero means chars (wide chars) are unsigned.  */
+  unsigned char unsigned_char, unsigned_wchar;
 };
 
 /* Call backs.  */
index 702800ad7ab4f18d7b9094b17c4cc613767883f7..69c95e7d9e9d40111bfaa7174f64e08dcb80bc52 100644 (file)
@@ -318,10 +318,6 @@ do {                                                               \
 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
 #endif
 
-#ifndef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-#endif
-
 #ifndef FLOAT_TYPE_SIZE
 #define FLOAT_TYPE_SIZE BITS_PER_WORD
 #endif
index c41c0984b2c45c5b904e4c21c4f65b7173c0653f..b70ae4862a4415fe4ffd47867d8783f56ae72a5a 100644 (file)
@@ -1516,14 +1516,6 @@ A C expression for the size in bits of the type @code{char} on the
 target machine.  If you don't define this, the default is
 @code{BITS_PER_UNIT}.
 
-@findex MAX_CHAR_TYPE_SIZE
-@item MAX_CHAR_TYPE_SIZE
-Maximum number for the size in bits of the type @code{char} on the
-target machine.  If this is undefined, the default is
-@code{CHAR_TYPE_SIZE}.  Otherwise, it is the constant value that is the
-largest value that @code{CHAR_TYPE_SIZE} can have at run-time.  This is
-used in @code{cpp}.
-
 @findex BOOL_TYPE_SIZE
 @item BOOL_TYPE_SIZE
 A C expression for the size in bits of the C++ type @code{bool} and
index 55914f05f45e31ab987fa3bd0f387a2d9b26e7df..e12585b3fb0bc6cd126933953a59bde45476c505 100644 (file)
@@ -594,7 +594,8 @@ typedef char _Bool;
        SET_DEFAULT_TYPE_ATTRIBUTES SET_DEFAULT_DECL_ATTRIBUTES         \
        MERGE_MACHINE_TYPE_ATTRIBUTES MERGE_MACHINE_DECL_ATTRIBUTES     \
        MD_INIT_BUILTINS MD_EXPAND_BUILTIN ASM_OUTPUT_CONSTRUCTOR       \
-       ASM_OUTPUT_DESTRUCTOR SIGNED_CHAR_SPEC
+       ASM_OUTPUT_DESTRUCTOR SIGNED_CHAR_SPEC MAX_CHAR_TYPE_SIZE       \
+       WCHAR_UNSIGNED
 
 /* And other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have