From 2a1dc0d87ed40633451c634b567a37f15e93abb5 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Tue, 21 May 2002 21:55:37 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 36 +++++++++++++++++++++++++++--------- gcc/c-common.c | 16 +++++++--------- gcc/cpphash.c | 1 - gcc/cpphash.h | 1 - gcc/cppinit.c | 25 ++++--------------------- gcc/cppmacro.c | 9 ++++++--- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e0b55dd2f2f7..63536dd36a2c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,22 @@ +2002-05-21 Zack Weinberg + + * 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 + * 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 2002-05-20 Dale Johannesen - * 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 @@ -134,14 +152,14 @@ Tue May 21 10:51:54 CEST 2002 Jan Hubicka 2002-05-19 Aldy Hernandez - * 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 diff --git a/gcc/c-common.c b/gcc/c-common.c index b9658da30e7f..89f98703d054 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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; diff --git a/gcc/cpphash.c b/gcc/cpphash.c index 69e1a237aa49..a90ec9bda53a 100644 --- a/gcc/cpphash.c +++ b/gcc/cpphash.c @@ -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; } diff --git a/gcc/cpphash.h b/gcc/cpphash.h index dcbb4fc1ae62..7be439fc43af 100644 --- a/gcc/cpphash.h +++ b/gcc/cpphash.h @@ -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 */ }; diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 4f2cc8ef652e..f8e9cd5e08e6 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -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') diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index c7a08f262433..797a30428f88 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -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; -- 2.43.5