c-common.c (c_common_init): Set options->unsigned_wchar.
authorNeil Booth <neil@daikokuya.demon.co.uk>
Tue, 7 May 2002 21:07:24 +0000 (21:07 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Tue, 7 May 2002 21:07:24 +0000 (21:07 +0000)
* 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.

From-SVN: r53271

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 0066f33..764836d 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 bc4b0b9..b23bcfe 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 a8ace30..c5b8fc8 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 a9b268c..0d417a2 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 97b20c5..99ee6ae 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 e3bd081..9745530 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 208e274..5b1d1d3 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 fb24327..eda80d2 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 efdb70e..09d4e69 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 240877c..6e53e51 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 7b1d96a..7f8a4fe 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 40fc36e..1043c5f 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 f6f3214..561118b 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 57bb391..34dc885 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 778c9ae..9100e01 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 95d3901..c625b9d 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 e4b9fc5..e4b6482 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 246a2ff..716f494 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 6694270..5a5094e 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 d50de84..e966090 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 1d570b0..dae4ffe 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 a9f1494..39afc59 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 ca0eee2..1b7da37 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 702800a..69c95e7 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 c41c098..b70ae48 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 55914f0..e12585b 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