aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-05-07 21:07:24 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-05-07 21:07:24 +0000
commitd932f956c4531df74bdf96538013680d7968599f (patch)
tree74df1638e099a3467f9206ea84d1ec4945ea2b23
parent1744f6712e140e7ab2694a0257734539c5088bbe (diff)
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53271 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog20
-rw-r--r--gcc/c-common.c9
-rw-r--r--gcc/config/alpha/freebsd.h3
-rw-r--r--gcc/config/arm/freebsd.h3
-rw-r--r--gcc/config/freebsd.h3
-rw-r--r--gcc/config/i386/386bsd.h2
-rw-r--r--gcc/config/i386/beos-elf.h3
-rw-r--r--gcc/config/i386/bsd386.h3
-rw-r--r--gcc/config/i386/cygwin.h1
-rw-r--r--gcc/config/i386/djgpp.h3
-rw-r--r--gcc/config/i386/freebsd-aout.h2
-rw-r--r--gcc/config/i386/i386-interix.h1
-rw-r--r--gcc/config/i386/win32.h1
-rw-r--r--gcc/config/ia64/freebsd.h3
-rw-r--r--gcc/config/interix.h1
-rw-r--r--gcc/config/mips/netbsd.h3
-rw-r--r--gcc/config/rs6000/freebsd.h3
-rw-r--r--gcc/config/sh/elf.h3
-rw-r--r--gcc/config/sh/sh.h1
-rw-r--r--gcc/config/sparc/freebsd.h3
-rw-r--r--gcc/cppinit.c13
-rw-r--r--gcc/cpplex.c4
-rw-r--r--gcc/cpplib.h16
-rw-r--r--gcc/defaults.h4
-rw-r--r--gcc/doc/tm.texi8
-rw-r--r--gcc/system.h3
26 files changed, 47 insertions, 72 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0066f331c39..764836dcee2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index bc4b0b96d02..b23bcfe14dd 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -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;
diff --git a/gcc/config/alpha/freebsd.h b/gcc/config/alpha/freebsd.h
index a8ace30c180..c5b8fc834bb 100644
--- a/gcc/config/alpha/freebsd.h
+++ b/gcc/config/alpha/freebsd.h
@@ -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
diff --git a/gcc/config/arm/freebsd.h b/gcc/config/arm/freebsd.h
index a9b268c0a48..0d417a22ded 100644
--- a/gcc/config/arm/freebsd.h
+++ b/gcc/config/arm/freebsd.h
@@ -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
diff --git a/gcc/config/freebsd.h b/gcc/config/freebsd.h
index 97b20c5232b..99ee6ae3aa6 100644
--- a/gcc/config/freebsd.h
+++ b/gcc/config/freebsd.h
@@ -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. */
diff --git a/gcc/config/i386/386bsd.h b/gcc/config/i386/386bsd.h
index e3bd08173c0..9745530abec 100644
--- a/gcc/config/i386/386bsd.h
+++ b/gcc/config/i386/386bsd.h
@@ -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
diff --git a/gcc/config/i386/beos-elf.h b/gcc/config/i386/beos-elf.h
index 208e2744d9f..5b1d1d3ff22 100644
--- a/gcc/config/i386/beos-elf.h
+++ b/gcc/config/i386/beos-elf.h
@@ -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
diff --git a/gcc/config/i386/bsd386.h b/gcc/config/i386/bsd386.h
index fb24327523c..eda80d213ed 100644
--- a/gcc/config/i386/bsd386.h
+++ b/gcc/config/i386/bsd386.h
@@ -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
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index efdb70e48a1..09d4e691d88 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -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"
diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h
index 240877ca0e2..6e53e510b4f 100644
--- a/gcc/config/i386/djgpp.h
+++ b/gcc/config/i386/djgpp.h
@@ -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
diff --git a/gcc/config/i386/freebsd-aout.h b/gcc/config/i386/freebsd-aout.h
index 7b1d96a55ba..7f8a4fe811c 100644
--- a/gcc/config/i386/freebsd-aout.h
+++ b/gcc/config/i386/freebsd-aout.h
@@ -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
diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h
index 40fc36e66e1..1043c5f2a49 100644
--- a/gcc/config/i386/i386-interix.h
+++ b/gcc/config/i386/i386-interix.h
@@ -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"
diff --git a/gcc/config/i386/win32.h b/gcc/config/i386/win32.h
index f6f32149d33..561118b558d 100644
--- a/gcc/config/i386/win32.h
+++ b/gcc/config/i386/win32.h
@@ -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,
diff --git a/gcc/config/ia64/freebsd.h b/gcc/config/ia64/freebsd.h
index 57bb391e270..34dc885905b 100644
--- a/gcc/config/ia64/freebsd.h
+++ b/gcc/config/ia64/freebsd.h
@@ -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
diff --git a/gcc/config/interix.h b/gcc/config/interix.h
index 778c9ae7473..9100e01adb7 100644
--- a/gcc/config/interix.h
+++ b/gcc/config/interix.h
@@ -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
diff --git a/gcc/config/mips/netbsd.h b/gcc/config/mips/netbsd.h
index 95d3901df94..c625b9d2cdb 100644
--- a/gcc/config/mips/netbsd.h
+++ b/gcc/config/mips/netbsd.h
@@ -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
diff --git a/gcc/config/rs6000/freebsd.h b/gcc/config/rs6000/freebsd.h
index e4b9fc52fc0..e4b6482798e 100644
--- a/gcc/config/rs6000/freebsd.h
+++ b/gcc/config/rs6000/freebsd.h
@@ -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
diff --git a/gcc/config/sh/elf.h b/gcc/config/sh/elf.h
index 246a2ff48e3..716f494229a 100644
--- a/gcc/config/sh/elf.h
+++ b/gcc/config/sh/elf.h
@@ -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"
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 669427064ef..5a5094e1c9d 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -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"
diff --git a/gcc/config/sparc/freebsd.h b/gcc/config/sparc/freebsd.h
index d50de845733..e966090eafb 100644
--- a/gcc/config/sparc/freebsd.h
+++ b/gcc/config/sparc/freebsd.h
@@ -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
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index 1d570b0e98a..dae4ffe602c 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -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. */
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index a9f14948133..39afc5905a9 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -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)
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index ca0eee2bd63..1b7da3794f3 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -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. */
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 702800ad7ab..69c95e7d9e9 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -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
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index c41c0984b2c..b70ae4862a4 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -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
diff --git a/gcc/system.h b/gcc/system.h
index 55914f05f45..e12585b3fb0 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -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