aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-06-30 19:36:25 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-06-30 19:36:25 +0000
commit37fa72e9d359a0c00c3b62e9aabd74276daa6602 (patch)
tree01d40120cc52c2574f790a44609bf19f0551b019 /gcc/c-common.c
parent4497827651d07fa10006fbac4cf63a92cf83c2a2 (diff)
downloadgcc-37fa72e9d359a0c00c3b62e9aabd74276daa6602.zip
gcc-37fa72e9d359a0c00c3b62e9aabd74276daa6602.tar.gz
gcc-37fa72e9d359a0c00c3b62e9aabd74276daa6602.tar.bz2
c-common.c (enum c_language_kind, flag_objc): Remove.
* c-common.c (enum c_language_kind, flag_objc): Remove. (fix_string_type, check_case_value, c_common_nodes_and_builtins, c_add_case_label, finish_label_addr_expr, boolean_increment): Use c_dialect_ macros. * c-common.h (enum c_language_kind): Extend. (c_dialect_cxx, c_dialect_objc): New. (flag_objc): Remove. (c_common_init_options): Update prototype. * c-cppbuiltin.c (define__GNUC__, c_cpp_builtins): Use c_dialect_ macros. * c-decl.c (finsih_decl, grokfield, finish_struct): Use c_dialect_ macros. * c-format.c (C_STD_VER, C_STD_NAME): Similarly. * c-lang.c (c_init_options): Remove. (c_language): Define. (LANG_HOOKS_INIT_OPTIONS): Use common hook. * c-lex.c (lex_charconst): Use c_dialect_cxx(). * c-opts.c (lang_flags): Make function-local. (c_common_init_options): Use c_dialect_ macros. Handle C++ diagnostic requirements. (c_common_handle_option, c_common_post_options): Use flag_cxx. * c-parse.in (init_reswords): Use c_dialect_objc (). * c-pch.c (get_ident): Use c_language. * c-pretty-print.c (pp_c_bool_literal): Use c_dialect_ macros. * c-typeck.c (comptypes, build_c_cast): Similarly. * objc/objc-lang.c (c_language): Define. (LANG_HOOKS_INIT_OPTIONS): Use common hook. (objc_init_options): Remove. cp: * Make-lang.in: Update. * cp-lang.c (c_language): Define. (LANG_HOOKS_INIT_OPTIONS): Use common hook. * cp-tree.h (cxx_init_options): Remove. * lex.c: Don't include diagnostic.h. (cxx_init_options): Remove. From-SVN: r68734
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c40
1 files changed, 11 insertions, 29 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 43f9586..9e03765 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -87,10 +87,6 @@ cpp_reader *parse_in; /* Declared in c-pragma.h. */
: "long long unsigned int"))
#endif
-/* The variant of the C language being processed. */
-
-enum c_language_kind c_language;
-
/* The following symbols are subsumed in the c_global_trees array, and
listed here individually for documentation purposes.
@@ -228,9 +224,6 @@ const char *pch_file;
user's namespace. */
int flag_iso;
-/* Nonzero whenever Objective-C functionality is being used. */
-int flag_objc;
-
/* Nonzero if -undef was given. It suppresses target built-in macros
and assertions. */
int flag_undef;
@@ -1166,7 +1159,7 @@ fix_string_type (tree value)
/* Compute the number of elements, for the array type. */
nchars = wide_flag ? length / wchar_bytes : length;
- if (pedantic && nchars - 1 > nchars_max && c_language == clk_c)
+ if (pedantic && nchars - 1 > nchars_max && !c_dialect_cxx ())
pedwarn ("string length `%d' is greater than the length `%d' ISO C%d compilers are required to support",
nchars - 1, nchars_max, flag_isoc99 ? 99 : 89);
@@ -1868,7 +1861,7 @@ check_case_value (tree value)
switch (...) { case i: ... }
So, we try to reduce the VALUE to a constant that way. */
- if (c_language == clk_cplusplus)
+ if (c_dialect_cxx ())
{
value = decl_constant_value (value);
STRIP_TYPE_NOPS (value);
@@ -3155,25 +3148,25 @@ c_common_nodes_and_builtins (void)
/* `signed' is the same as `int'. FIXME: the declarations of "signed",
"unsigned long", "long long unsigned" and "unsigned short" were in C++
but not C. Are the conditionals here needed? */
- if (c_language == clk_cplusplus)
+ if (c_dialect_cxx ())
record_builtin_type (RID_SIGNED, NULL, integer_type_node);
record_builtin_type (RID_LONG, "long int", long_integer_type_node);
record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node);
record_builtin_type (RID_MAX, "long unsigned int",
long_unsigned_type_node);
- if (c_language == clk_cplusplus)
+ if (c_dialect_cxx ())
record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node);
record_builtin_type (RID_MAX, "long long int",
long_long_integer_type_node);
record_builtin_type (RID_MAX, "long long unsigned int",
long_long_unsigned_type_node);
- if (c_language == clk_cplusplus)
+ if (c_dialect_cxx ())
record_builtin_type (RID_MAX, "long long unsigned",
long_long_unsigned_type_node);
record_builtin_type (RID_SHORT, "short int", short_integer_type_node);
record_builtin_type (RID_MAX, "short unsigned int",
short_unsigned_type_node);
- if (c_language == clk_cplusplus)
+ if (c_dialect_cxx ())
record_builtin_type (RID_MAX, "unsigned short",
short_unsigned_type_node);
@@ -3334,7 +3327,7 @@ c_common_nodes_and_builtins (void)
wchar_type_node = get_identifier (MODIFIED_WCHAR_TYPE);
wchar_type_node = TREE_TYPE (identifier_global_value (wchar_type_node));
wchar_type_size = TYPE_PRECISION (wchar_type_node);
- if (c_language == clk_cplusplus)
+ if (c_dialect_cxx ())
{
if (TREE_UNSIGNED (wchar_type_node))
wchar_type_node = make_unsigned_type (wchar_type_size);
@@ -3954,12 +3947,7 @@ c_add_case_label (splay_tree cases, tree cond, tree low_value,
/* Case ranges are a GNU extension. */
if (high_value && pedantic)
- {
- if (c_language == clk_cplusplus)
- pedwarn ("ISO C++ forbids range expressions in switch statements");
- else
- pedwarn ("ISO C forbids range expressions in switch statements");
- }
+ pedwarn ("range expressions in switch statements are non-standard");
type = TREE_TYPE (cond);
if (low_value)
@@ -4076,12 +4064,7 @@ finish_label_address_expr (tree label)
tree result;
if (pedantic)
- {
- if (c_language == clk_cplusplus)
- pedwarn ("ISO C++ forbids taking the address of a label");
- else
- pedwarn ("ISO C forbids taking the address of a label");
- }
+ pedwarn ("taking the address of a label is non-standard");
if (label == error_mark_node)
return error_mark_node;
@@ -4550,9 +4533,8 @@ tree
boolean_increment (enum tree_code code, tree arg)
{
tree val;
- tree true_res = (c_language == clk_cplusplus
- ? boolean_true_node
- : c_bool_true_node);
+ tree true_res = (c_dialect_cxx () ? boolean_true_node : c_bool_true_node);
+
arg = stabilize_reference (arg);
switch (code)
{