c-common.c (c_common_init): Set options->unsigned_char from flag_signed_char.

* c-common.c (c_common_init): Set options->unsigned_char from
	flag_signed_char.
	(cb_register_builtins): Define __STRICT_ANSI__ and
	__CHAR_UNSIGNED__ here...
	* cppinit.c (init_builtins): Not here.
	(cpp_create_reader): unsigned_char option defaults to 0, not
	!DEFAULT_SIGNED_CHAR.
	(COMMAND_LINE_OPTIONS, cpp_handle_option): Lose -fsigned-char
	and -funsigned-char.

	* cpphash.h (struct spec_nodes): Kill n__STRICT_ANSI__.
	* cpphash.c (_cpp_init_hashtable): Don't set it.
	* cppmacro.c (builtin_macro) [BT_STDC]: Use the language setting
	directly.  Clarify comment.

From-SVN: r53703
This commit is contained in:
Zack Weinberg 2002-05-21 21:55:37 +00:00
parent d476dcad7f
commit 2a1dc0d87e
6 changed files with 44 additions and 44 deletions

View File

@ -1,4 +1,22 @@
2002-05-21 Zack Weinberg <zack@codesourcery.com>
* c-common.c (c_common_init): Set options->unsigned_char from
flag_signed_char.
(cb_register_builtins): Define __STRICT_ANSI__ and
__CHAR_UNSIGNED__ here...
* cppinit.c (init_builtins): Not here.
(cpp_create_reader): unsigned_char option defaults to 0, not
!DEFAULT_SIGNED_CHAR.
(COMMAND_LINE_OPTIONS, cpp_handle_option): Lose -fsigned-char
and -funsigned-char.
* cpphash.h (struct spec_nodes): Kill n__STRICT_ANSI__.
* cpphash.c (_cpp_init_hashtable): Don't set it.
* cppmacro.c (builtin_macro) [BT_STDC]: Use the language setting
directly. Clarify comment.
2002-05-21 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* bb-reorder.c (make_reorder_chain_1): Modified.
* cfganal.c (can_fallthru, flow_call_edges_add,
flow_preorder_transversal_compute): Modified.
@ -80,8 +98,8 @@ Tue May 21 10:51:54 CEST 2002 Jan Hubicka <jh@suse.cz>
2002-05-20 Dale Johannesen <dalej@apple.com>
* combine.c (cant_combine_insn_p): Back out my
previous patch.
* combine.c (cant_combine_insn_p): Back out my
previous patch.
2002-05-20 Kazu Hirata <kazu@cs.umass.edu>
@ -134,14 +152,14 @@ Tue May 21 10:51:54 CEST 2002 Jan Hubicka <jh@suse.cz>
2002-05-19 Aldy Hernandez <aldyh@redhat.com>
* config/rs6000/rs6000.h (FUNCTION_VALUE): Only return vectors in
an altivec register if TARGET_ALTIVEC.
* config/rs6000/rs6000.h (FUNCTION_VALUE): Only return vectors in
an altivec register if TARGET_ALTIVEC.
* config/rs600/rs6000.c (rs6000_emit_move): Change VECTOR_MODE_P
to ALTIVEC_VECTOR_MODE.
(rs6000_va_arg): Only vectors of type AltiVec are 16 byte aligned.
(rs6000_va_arg): Vectors may go in registers if they are not
altivec vectors.
* config/rs600/rs6000.c (rs6000_emit_move): Change VECTOR_MODE_P
to ALTIVEC_VECTOR_MODE.
(rs6000_va_arg): Only vectors of type AltiVec are 16 byte aligned.
(rs6000_va_arg): Vectors may go in registers if they are not
altivec vectors.
2002-05-19 Kazu Hirata <kazu@cs.umass.edu>

View File

@ -4372,6 +4372,12 @@ cb_register_builtins (pfile)
if (flag_no_inline)
cpp_define (pfile, "__NO_INLINE__");
if (flag_iso)
cpp_define (pfile, "__STRICT_ANSI__");
if (!flag_signed_char)
cpp_define (pfile, "__CHAR_UNSIGNED__");
/* A straightforward target hook doesn't work, because of problems
linking that hook's body when part of non-C front ends. */
#define preprocessing_asm_p() (cpp_get_options (pfile)->lang == CLK_ASM)
@ -4461,15 +4467,7 @@ c_common_init (filename)
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->unsigned_char = !flag_signed_char;
options->warn_multichar = warn_multichar;
options->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS;

View File

@ -72,7 +72,6 @@ _cpp_init_hashtable (pfile, table)
s->n_defined = cpp_lookup (pfile, DSC("defined"));
s->n_true = cpp_lookup (pfile, DSC("true"));
s->n_false = cpp_lookup (pfile, DSC("false"));
s->n__STRICT_ANSI__ = cpp_lookup (pfile, DSC("__STRICT_ANSI__"));
s->n__VA_ARGS__ = cpp_lookup (pfile, DSC("__VA_ARGS__"));
s->n__VA_ARGS__->flags |= NODE_DIAGNOSTIC;
}

View File

@ -188,7 +188,6 @@ struct spec_nodes
cpp_hashnode *n_defined; /* defined operator */
cpp_hashnode *n_true; /* C++ keyword true */
cpp_hashnode *n_false; /* C++ keyword false */
cpp_hashnode *n__STRICT_ANSI__; /* STDC_0_IN_SYSTEM_HEADERS */
cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */
};

View File

@ -500,7 +500,7 @@ 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_char) = 0;
CPP_OPTION (pfile, unsigned_wchar) = 1;
/* It's simplest to just create this struct whether or not it will
@ -694,25 +694,16 @@ init_builtins (pfile)
if (CPP_OPTION (pfile, cplusplus))
_cpp_define_builtin (pfile, "__cplusplus 1");
if (CPP_OPTION (pfile, objc))
else if (CPP_OPTION (pfile, objc))
_cpp_define_builtin (pfile, "__OBJC__ 1");
else if (CPP_OPTION (pfile, lang) == CLK_ASM)
_cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
if (CPP_OPTION (pfile, lang) == CLK_STDC94)
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L");
else if (CPP_OPTION (pfile, c99))
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");
if (CPP_OPTION (pfile, unsigned_char))
_cpp_define_builtin (pfile, "__CHAR_UNSIGNED__ 1");
if (CPP_OPTION (pfile, lang) == CLK_STDC89
|| CPP_OPTION (pfile, lang) == CLK_STDC94
|| CPP_OPTION (pfile, lang) == CLK_STDC99)
_cpp_define_builtin (pfile, "__STRICT_ANSI__ 1");
else if (CPP_OPTION (pfile, lang) == CLK_ASM)
_cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
if (pfile->cb.register_builtins)
(*pfile->cb.register_builtins) (pfile);
}
@ -1158,9 +1149,7 @@ new_pending_directive (pend, text, handler)
DEF_OPT("fno-show-column", 0, OPT_fno_show_column) \
DEF_OPT("fpreprocessed", 0, OPT_fpreprocessed) \
DEF_OPT("fshow-column", 0, OPT_fshow_column) \
DEF_OPT("fsigned-char", 0, OPT_fsigned_char) \
DEF_OPT("ftabstop=", no_num, OPT_ftabstop) \
DEF_OPT("funsigned-char", 0, OPT_funsigned_char) \
DEF_OPT("h", 0, OPT_h) \
DEF_OPT("idirafter", no_dir, OPT_idirafter) \
DEF_OPT("imacros", no_fil, OPT_imacros) \
@ -1365,12 +1354,6 @@ cpp_handle_option (pfile, argc, argv, ignore)
case OPT_fno_show_column:
CPP_OPTION (pfile, show_column) = 0;
break;
case OPT_fsigned_char:
CPP_OPTION (pfile, unsigned_char) = 0;
break;
case OPT_funsigned_char:
CPP_OPTION (pfile, unsigned_char) = 1;
break;
case OPT_ftabstop:
/* Silently ignore empty string, non-longs and silly values. */
if (arg[0] != '\0')

View File

@ -174,14 +174,17 @@ builtin_macro (pfile, node)
/* __STDC__ has the value 1 under normal circumstances.
However, if (a) we are in a system header, (b) the option
stdc_0_in_system_headers is true, and (c) __STRICT_ANSI__ is
not defined, then it has the value 0. */
stdc_0_in_system_headers is true (set by target config), and
(c) we are not in strictly conforming mode, then it has the
value 0. */
case BT_STDC:
{
int stdc;
enum c_lang lang = CPP_OPTION (pfile, lang);
if (CPP_IN_SYSTEM_HEADER (pfile)
&& CPP_OPTION (pfile, stdc_0_in_system_headers)
&& pfile->spec_nodes.n__STRICT_ANSI__->type == NT_VOID)
&& !(lang == CLK_STDC89 || lang == CLK_STDC94
|| lang == CLK_STDC99)) /* || lang == CLK_CXX98 ? */
stdc = 0;
else
stdc = 1;