Commit 44a147ad by Neil Booth Committed by Neil Booth

c-common.c (c_common_init): Set options->unsigned_wchar.

	* 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
parent 522e3d22
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> 2002-05-07 Mark Mitchell <mark@codesourcery.com>
* fixinc/inclhack.def (windiss_math1): New fix. * fixinc/inclhack.def (windiss_math1): New fix.
......
...@@ -4310,6 +4310,15 @@ c_common_init (filename) ...@@ -4310,6 +4310,15 @@ c_common_init (filename)
options->char_precision = TYPE_PRECISION (char_type_node); options->char_precision = TYPE_PRECISION (char_type_node);
options->int_precision = TYPE_PRECISION (integer_type_node); options->int_precision = TYPE_PRECISION (integer_type_node);
options->wchar_precision = TYPE_PRECISION (wchar_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; options->warn_multichar = warn_multichar;
......
...@@ -53,9 +53,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -53,9 +53,6 @@ Boston, MA 02111-1307, USA. */
/* alpha.h gets this wrong for FreeBSD. We use the GCC defaults instead. */ /* alpha.h gets this wrong for FreeBSD. We use the GCC defaults instead. */
#undef WCHAR_TYPE #undef WCHAR_TYPE
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32 #define WCHAR_TYPE_SIZE 32
......
...@@ -41,9 +41,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -41,9 +41,6 @@ Boston, MA 02111-1307, USA. */
/* We use the GCC defaults here. */ /* We use the GCC defaults here. */
#undef WCHAR_TYPE #undef WCHAR_TYPE
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32 #define WCHAR_TYPE_SIZE 32
......
...@@ -76,9 +76,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -76,9 +76,6 @@ Boston, MA 02111-1307, USA. */
#undef WCHAR_TYPE #undef WCHAR_TYPE
#define WCHAR_TYPE "int" #define WCHAR_TYPE "int"
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#define MATH_LIBRARY_PROFILE "-lm_p" #define MATH_LIBRARY_PROFILE "-lm_p"
/* Code generation parameters. */ /* Code generation parameters. */
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#undef WCHAR_TYPE #undef WCHAR_TYPE
#define WCHAR_TYPE "short unsigned int" #define WCHAR_TYPE "short unsigned int"
#define WCHAR_UNSIGNED 1
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 16 #define WCHAR_TYPE_SIZE 16
......
...@@ -65,9 +65,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -65,9 +65,6 @@ Boston, MA 02111-1307, USA. */
#undef WCHAR_TYPE #undef WCHAR_TYPE
#define WCHAR_TYPE "short unsigned int" #define WCHAR_TYPE "short unsigned int"
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 1
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 16 #define WCHAR_TYPE_SIZE 16
......
...@@ -10,9 +10,6 @@ ...@@ -10,9 +10,6 @@
#undef WCHAR_TYPE #undef WCHAR_TYPE
#define WCHAR_TYPE "int" #define WCHAR_TYPE "int"
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32 #define WCHAR_TYPE_SIZE 32
......
...@@ -171,7 +171,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -171,7 +171,6 @@ Boston, MA 02111-1307, USA. */
#define SIZE_TYPE "unsigned int" #define SIZE_TYPE "unsigned int"
#define PTRDIFF_TYPE "int" #define PTRDIFF_TYPE "int"
#define WCHAR_UNSIGNED 1
#define WCHAR_TYPE_SIZE 16 #define WCHAR_TYPE_SIZE 16
#define WCHAR_TYPE "short unsigned int" #define WCHAR_TYPE "short unsigned int"
......
...@@ -159,9 +159,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -159,9 +159,6 @@ Boston, MA 02111-1307, USA. */
/* Definitions for types and sizes. Wide characters are 16-bits long so /* Definitions for types and sizes. Wide characters are 16-bits long so
Win32 compiler add-ons will be wide character compatible. */ Win32 compiler add-ons will be wide character compatible. */
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 1
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 16 #define WCHAR_TYPE_SIZE 16
......
...@@ -53,8 +53,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -53,8 +53,6 @@ Boston, MA 02111-1307, USA. */
#undef WCHAR_TYPE #undef WCHAR_TYPE
#define WCHAR_TYPE "int" #define WCHAR_TYPE "int"
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE BITS_PER_WORD #define WCHAR_TYPE_SIZE BITS_PER_WORD
......
...@@ -44,7 +44,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -44,7 +44,6 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_CPU_DEFAULT #undef TARGET_CPU_DEFAULT
#define TARGET_CPU_DEFAULT 2 /* 486 */ #define TARGET_CPU_DEFAULT 2 /* 486 */
#define WCHAR_UNSIGNED 1
#define WCHAR_TYPE_SIZE 16 #define WCHAR_TYPE_SIZE 16
#define WCHAR_TYPE "short unsigned int" #define WCHAR_TYPE "short unsigned int"
......
...@@ -95,7 +95,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -95,7 +95,6 @@ Boston, MA 02111-1307, USA. */
#define SIZE_TYPE "unsigned int" #define SIZE_TYPE "unsigned int"
#define PTRDIFF_TYPE "int" #define PTRDIFF_TYPE "int"
#define WCHAR_UNSIGNED 1
#define WCHAR_TYPE_SIZE 16 #define WCHAR_TYPE_SIZE 16
#define WCHAR_TYPE "short unsigned int" #define WCHAR_TYPE "short unsigned int"
/* Currently we do not have the atexit() function, /* Currently we do not have the atexit() function,
......
...@@ -42,9 +42,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -42,9 +42,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
We use the GCC defaults instead. */ We use the GCC defaults instead. */
#undef WCHAR_TYPE #undef WCHAR_TYPE
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32 #define WCHAR_TYPE_SIZE 32
......
...@@ -100,7 +100,6 @@ for windows/multi thread */ ...@@ -100,7 +100,6 @@ for windows/multi thread */
#undef WCHAR_TYPE #undef WCHAR_TYPE
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_UNSIGNED 1
#define WCHAR_TYPE "short unsigned int" #define WCHAR_TYPE "short unsigned int"
#define WCHAR_TYPE_SIZE 16 #define WCHAR_TYPE_SIZE 16
......
...@@ -185,9 +185,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -185,9 +185,6 @@ Boston, MA 02111-1307, USA. */
#undef WCHAR_TYPE #undef WCHAR_TYPE
#define WCHAR_TYPE "int" #define WCHAR_TYPE "int"
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32 #define WCHAR_TYPE_SIZE 32
......
...@@ -48,9 +48,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -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. */ /* rs6000.h gets this wrong for FreeBSD. We use the GCC defaults instead. */
#undef WCHAR_TYPE #undef WCHAR_TYPE
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32 #define WCHAR_TYPE_SIZE 32
......
...@@ -30,9 +30,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -30,9 +30,6 @@ Boston, MA 02111-1307, USA. */
#undef SIZE_TYPE #undef SIZE_TYPE
#undef PTRDIFF_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. */ /* Be ELF-like. */
/* TODO: convert includes to ${tm_file} list in config.gcc. */ /* TODO: convert includes to ${tm_file} list in config.gcc. */
#include "dbxelf.h" #include "dbxelf.h"
......
...@@ -2522,7 +2522,6 @@ while (0) ...@@ -2522,7 +2522,6 @@ while (0)
#define WCHAR_TYPE "short unsigned int" #define WCHAR_TYPE "short unsigned int"
#define WCHAR_TYPE_SIZE 16 #define WCHAR_TYPE_SIZE 16
#define WCHAR_UNSIGNED 1
#define SH_ELF_WCHAR_TYPE "long int" #define SH_ELF_WCHAR_TYPE "long int"
......
...@@ -50,9 +50,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -50,9 +50,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
We use the GCC defaults instead. */ We use the GCC defaults instead. */
#undef WCHAR_TYPE #undef WCHAR_TYPE
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32 #define WCHAR_TYPE_SIZE 32
......
...@@ -494,11 +494,6 @@ cpp_create_reader (lang) ...@@ -494,11 +494,6 @@ cpp_create_reader (lang)
CPP_OPTION (pfile, tabstop) = 8; CPP_OPTION (pfile, tabstop) = 8;
CPP_OPTION (pfile, operator_names) = 1; CPP_OPTION (pfile, operator_names) = 1;
CPP_OPTION (pfile, warn_endif_labels) = 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) = CPP_OPTION (pfile, pending) =
(struct cpp_pending *) xcalloc (1, sizeof (struct cpp_pending)); (struct cpp_pending *) xcalloc (1, sizeof (struct cpp_pending));
...@@ -510,6 +505,8 @@ cpp_create_reader (lang) ...@@ -510,6 +505,8 @@ cpp_create_reader (lang)
CPP_OPTION (pfile, char_precision) = CHAR_BIT; CPP_OPTION (pfile, char_precision) = CHAR_BIT;
CPP_OPTION (pfile, wchar_precision) = CHAR_BIT * sizeof (int); CPP_OPTION (pfile, wchar_precision) = CHAR_BIT * sizeof (int);
CPP_OPTION (pfile, int_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 /* It's simplest to just create this struct whether or not it will
be needed. */ be needed. */
...@@ -779,7 +776,7 @@ init_builtins (pfile) ...@@ -779,7 +776,7 @@ init_builtins (pfile)
else if (CPP_OPTION (pfile, c99)) else if (CPP_OPTION (pfile, c99))
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L"); _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"); _cpp_define_builtin (pfile, "__CHAR_UNSIGNED__ 1");
if (CPP_OPTION (pfile, lang) == CLK_STDC89 if (CPP_OPTION (pfile, lang) == CLK_STDC89
...@@ -1450,10 +1447,10 @@ cpp_handle_option (pfile, argc, argv, ignore) ...@@ -1450,10 +1447,10 @@ cpp_handle_option (pfile, argc, argv, ignore)
CPP_OPTION (pfile, show_column) = 0; CPP_OPTION (pfile, show_column) = 0;
break; break;
case OPT_fsigned_char: case OPT_fsigned_char:
CPP_OPTION (pfile, signed_char) = 1; CPP_OPTION (pfile, unsigned_char) = 0;
break; break;
case OPT_funsigned_char: case OPT_funsigned_char:
CPP_OPTION (pfile, signed_char) = 0; CPP_OPTION (pfile, unsigned_char) = 1;
break; break;
case OPT_ftabstop: case OPT_ftabstop:
/* Silently ignore empty string, non-longs and silly values. */ /* Silently ignore empty string, non-longs and silly values. */
......
...@@ -1883,13 +1883,13 @@ cpp_interpret_charconst (pfile, token, pchars_seen, unsignedp) ...@@ -1883,13 +1883,13 @@ cpp_interpret_charconst (pfile, token, pchars_seen, unsignedp)
{ {
width = CPP_OPTION (pfile, char_precision); width = CPP_OPTION (pfile, char_precision);
max_chars = CPP_OPTION (pfile, int_precision) / width; max_chars = CPP_OPTION (pfile, int_precision) / width;
unsigned_p = CPP_OPTION (pfile, signed_char) == 0; unsigned_p = CPP_OPTION (pfile, unsigned_char);
} }
else else
{ {
width = CPP_OPTION (pfile, wchar_precision); width = CPP_OPTION (pfile, wchar_precision);
max_chars = 1; max_chars = 1;
unsigned_p = WCHAR_UNSIGNED; unsigned_p = CPP_OPTION (pfile, unsigned_wchar);
} }
if (width < BITS_PER_CPPCHAR_T) if (width < BITS_PER_CPPCHAR_T)
......
...@@ -251,19 +251,12 @@ struct cpp_options ...@@ -251,19 +251,12 @@ struct cpp_options
/* -fleading_underscore sets this to "_". */ /* -fleading_underscore sets this to "_". */
const char *user_label_prefix; 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. */ /* The language we're preprocessing. */
enum c_lang lang; enum c_lang lang;
/* Non-0 means -v, so print the full set of include dirs. */ /* Non-0 means -v, so print the full set of include dirs. */
unsigned char verbose; unsigned char verbose;
/* Nonzero means chars are signed. */
unsigned char signed_char;
/* Nonzero means use extra default include directories for C++. */ /* Nonzero means use extra default include directories for C++. */
unsigned char cplusplus; unsigned char cplusplus;
...@@ -395,6 +388,15 @@ struct cpp_options ...@@ -395,6 +388,15 @@ struct cpp_options
options. Stand-alone CPP should then bail out after option options. Stand-alone CPP should then bail out after option
parsing; drivers might want to continue printing help. */ parsing; drivers might want to continue printing help. */
unsigned char help_only; 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. */ /* Call backs. */
......
...@@ -318,10 +318,6 @@ do { \ ...@@ -318,10 +318,6 @@ do { \
#define WCHAR_TYPE_SIZE INT_TYPE_SIZE #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
#endif #endif
#ifndef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#endif
#ifndef FLOAT_TYPE_SIZE #ifndef FLOAT_TYPE_SIZE
#define FLOAT_TYPE_SIZE BITS_PER_WORD #define FLOAT_TYPE_SIZE BITS_PER_WORD
#endif #endif
......
...@@ -1516,14 +1516,6 @@ A C expression for the size in bits of the type @code{char} on the ...@@ -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 target machine. If you don't define this, the default is
@code{BITS_PER_UNIT}. @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 @findex BOOL_TYPE_SIZE
@item BOOL_TYPE_SIZE @item BOOL_TYPE_SIZE
A C expression for the size in bits of the C++ type @code{bool} and A C expression for the size in bits of the C++ type @code{bool} and
......
...@@ -594,7 +594,8 @@ typedef char _Bool; ...@@ -594,7 +594,8 @@ typedef char _Bool;
SET_DEFAULT_TYPE_ATTRIBUTES SET_DEFAULT_DECL_ATTRIBUTES \ SET_DEFAULT_TYPE_ATTRIBUTES SET_DEFAULT_DECL_ATTRIBUTES \
MERGE_MACHINE_TYPE_ATTRIBUTES MERGE_MACHINE_DECL_ATTRIBUTES \ MERGE_MACHINE_TYPE_ATTRIBUTES MERGE_MACHINE_DECL_ATTRIBUTES \
MD_INIT_BUILTINS MD_EXPAND_BUILTIN ASM_OUTPUT_CONSTRUCTOR \ 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 /* 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 headers and were not used, and may be obsolete or may never have
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment