diff options
author | David Malcolm <dmalcolm@redhat.com> | 2013-11-22 14:18:13 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2013-11-22 14:18:13 +0000 |
commit | 8400e75ec451d9ecaf58ec1c07a29824a31a2e0a (patch) | |
tree | a7c4dbecf9c3315f9546fbd414900591eab0b7fa /gcc/c | |
parent | f81448f7525462e58bc1393eb3b2157a66672cb0 (diff) | |
download | gcc-8400e75ec451d9ecaf58ec1c07a29824a31a2e0a.zip gcc-8400e75ec451d9ecaf58ec1c07a29824a31a2e0a.tar.gz gcc-8400e75ec451d9ecaf58ec1c07a29824a31a2e0a.tar.bz2 |
Remove macros that implicitly use input_location
gcc/
* input.h (input_line): Remove.
(input_filename): Likewise.
(in_system_header): Likewise.
* tree.h (EXPR_LOC_OR_HERE): Remove.
* config/bfin/bfin.c (output_file_start): Remove use of
input_filename macro.
* builtins.c (c_strlen): Remove use of EXPR_LOC_OR_HERE macro.
* gimplify.c (internal_get_tmp_var): Likewise.
EXPR_LOC_OR_HERE macro.
(shortcut_cond_expr): Likewise.
* tree-diagnostic.c (diagnostic_report_current_function): Remove
use of input_filename macro.
* tree.c (get_file_function_name): Likewise.
gcc/ada
* gcc-interface/utils2.c (build_call_raise): Remove use of
input_line macro.
(build_call_raise_range): Likewise.
(build_call_raise_column): Likewise.
gcc/c-family
* c-common.c (unsafe_conversion_p): Remove use of
EXPR_LOC_OR_HERE macro.
(conversion_warning): Likewise.
(warnings_for_convert_and_check): Likewise.
(warn_for_collisions_1): Likewise.
(shorten_compare): Likewise, and remove use of in_system_header
macro, using the location from the former.
* c-lex.c (dump_one_header): Remove use of input_filename macro.
(cb_def_pragma): Remove use of in_system_header macro.
(lex_string): Likewise.
* c-pragma.c (handle_pragma_float_const_decimal64): Likewise.
gcc/c
* c-decl.c (define_label, shadow_tag_warned)
(check_bitfield_type_and_width, grokdeclarator, grokparms,
store_parm_decls_newstyle, store_parm_decls_oldstyle)
(declspecs_add_type): Remove use of in_system_header macro.
* c-parser.c (c_parser_unary_expression): Likewise.
* c-typeck.c (store_init_value, process_init_element)
(c_start_case): Likewise.
* c-decl.c (build_enumerator): Remove use of EXPR_LOC_OR_HERE
macro.
* c-parser.c (c_parser_set_source_position_from_token): Remove
reference to in_system_header from comment.
gcc/cp
* call.c (build_integral_nontype_arg_conv): Remove use of
EXPR_LOC_OR_HERE macro.
(convert_like_real): Likewise.
(convert_arg_to_ellipsis): Likewise.
(build_cxx_call): Likewise.
(perform_implicit_conversion_flags): Likewise.
(initialize_reference): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_reference): Likewise.
(ocp_convert): Likewise.
(convert_to_void): Likewise.
* decl.c (pop_label): Update comment.
(pop_switch): Remove use of EXPR_LOC_OR_HERE macro.
(check_tag_decl): Remove use of in_system_header macro.
(make_rtl_for_nonlocal_decl): Remove use of input_filename
macro.
(compute_array_index_type): Remove use of in_system_header
macro.
(grokdeclarator): Likewise.
* error.c (dump_global_iord): Remove use of input_filename
macro.
(location_of): Remove use of EXPR_LOC_OR_HERE macro.
(maybe_warn_cpp0x): Remove use of in_system_header macro.
* init.c (build_new_1): Remove use of EXPR_LOC_OR_HERE macro.
* lex.c (handle_pragma_interface): Remove use of input_filename
macro.
(handle_pragma_implementation): Likewise.
(cxx_make_type): Likewise.
(in_main_input_context): Likewise.
* name-lookup.c (push_binding_level): Remove use of
input_line macro.
(leave_scope): Likewise.
(resume_scope): Likewise.
* parser.c (cp_parser_unqualified_id): Remove use of
in_system_header macro.
(cp_parser_cast_expression): Likewise.
(cp_parser_declaration_seq_opt): Likewise.
(cp_parser_enumerator_list): Likewise.
(cp_parser_parameter_declaration_clause): Likewise.
(cp_parser_exception_specification_opt): Likewise.
* pt.c (unify_arg_conversion): Remove use of EXPR_LOC_OR_HERE
macro.
(convert_nontype_argument): Likewise.
(push_tinst_level): Remove use of in_system_header macro.
(tsubst_copy_and_build): Remove use of EXPR_LOC_OR_HERE
macros.
(do_decl_instantiation): Remove use of in_system_header macro.
(do_type_instantiation): Likewise.
* semantics.c (finish_call_expr): Remove use of EXPR_LOC_OR_HERE
macro.
(begin_class_definition): Remove use of input_filename macro.
(cxx_eval_call_expression): Remove use of EXPR_LOC_OR_HERE
macro.
(cxx_eval_constant_expression): Likewise.
(potential_constant_expression_1): Likewise.
* typeck.c (decay_conversion): Likewise.
(rationalize_conditional_expr): Likewise.
(build_x_compound_expr_from_list): Likewise.
(convert_for_assignment): Likewise.
* typeck2.c (check_narrowing): Likewise.
gcc/fortran
* trans.c (trans_runtime_error_vararg): Remove use of input_line
macro.
gcc/java
* class.c (maybe_layout_super_class): Update comment.
* decl.c (java_add_stmt): Remove use of input_filename macro.
* jcf-parse.c (set_source_filename): Remove use of
input_filename macro.
(parse_class_file): Remove use of input_line and input_filename
macros.
(java_parse_file): Remove use of input_filename macro.
From-SVN: r205262
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 49 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 5 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 6 |
4 files changed, 50 insertions, 26 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 92dbcee..7dab092 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,19 @@ +2013-11-22 David Malcolm <dmalcolm@redhat.com> + + * c-decl.c (define_label, shadow_tag_warned) + (check_bitfield_type_and_width, grokdeclarator, grokparms, + store_parm_decls_newstyle, store_parm_decls_oldstyle) + (declspecs_add_type): Remove use of in_system_header macro. + * c-parser.c (c_parser_unary_expression): Likewise. + * c-typeck.c (store_init_value, process_init_element) + (c_start_case): Likewise. + + * c-decl.c (build_enumerator): Remove use of EXPR_LOC_OR_HERE + macro. + + * c-parser.c (c_parser_set_source_position_from_token): Remove + reference to in_system_header from comment. + 2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> * c-decl.c (grokdeclarator): Update comment to refer to diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 4125bd9..1d4f1af 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -3328,7 +3328,7 @@ define_label (location_t location, tree name) bind_label (name, label, current_function_scope, label_vars); } - if (!in_system_header && lookup_name (name)) + if (!in_system_header_at (input_location) && lookup_name (name)) warning_at (location, OPT_Wtraditional, "traditional C lacks a separate namespace " "for labels, identifier %qE conflicts", name); @@ -3762,7 +3762,7 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned) } else { - if (warned != 1 && !in_system_header) + if (warned != 1 && !in_system_header_at (input_location)) { pedwarn (input_location, 0, "useless type name in empty declaration"); @@ -3770,7 +3770,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned) } } } - else if (warned != 1 && !in_system_header && declspecs->typedef_p) + else if (warned != 1 && !in_system_header_at (input_location) + && declspecs->typedef_p) { pedwarn (input_location, 0, "useless type name in empty declaration"); warned = 1; @@ -3802,30 +3803,34 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned) warned = 1; } - if (!warned && !in_system_header && declspecs->storage_class != csc_none) + if (!warned && !in_system_header_at (input_location) + && declspecs->storage_class != csc_none) { warning (0, "useless storage class specifier in empty declaration"); warned = 2; } - if (!warned && !in_system_header && declspecs->thread_p) + if (!warned && !in_system_header_at (input_location) && declspecs->thread_p) { warning (0, "useless %qs in empty declaration", declspecs->thread_gnu_p ? "__thread" : "_Thread_local"); warned = 2; } - if (!warned && !in_system_header && (declspecs->const_p - || declspecs->volatile_p - || declspecs->atomic_p - || declspecs->restrict_p - || declspecs->address_space)) + if (!warned + && !in_system_header_at (input_location) + && (declspecs->const_p + || declspecs->volatile_p + || declspecs->atomic_p + || declspecs->restrict_p + || declspecs->address_space)) { warning (0, "useless type qualifier in empty declaration"); warned = 2; } - if (!warned && !in_system_header && declspecs->alignas_p) + if (!warned && !in_system_header_at (input_location) + && declspecs->alignas_p) { warning (0, "useless %<_Alignas%> in empty declaration"); warned = 2; @@ -4821,7 +4826,7 @@ check_bitfield_type_and_width (tree *type, tree *width, tree orig_name) } type_mv = TYPE_MAIN_VARIANT (*type); - if (!in_system_header + if (!in_system_header_at (input_location) && type_mv != integer_type_node && type_mv != unsigned_type_node && type_mv != boolean_type_node) @@ -5071,7 +5076,7 @@ grokdeclarator (const struct c_declarator *declarator, /* Diagnose defaulting to "int". */ - if (declspecs->default_int_p && !in_system_header) + if (declspecs->default_int_p && !in_system_header_at (input_location)) { /* Issue a warning if this is an ISO C 99 program or if -Wreturn-type and this is a function, or if -Wimplicit; @@ -5351,7 +5356,8 @@ grokdeclarator (const struct c_declarator *declarator, type = error_mark_node; } - if (pedantic && !in_system_header && flexible_array_type_p (type)) + if (pedantic && !in_system_header_at (input_location) + && flexible_array_type_p (type)) pedwarn (loc, OPT_Wpedantic, "invalid use of structure with flexible array member"); @@ -5529,7 +5535,8 @@ grokdeclarator (const struct c_declarator *declarator, flexible_array_member = (t->kind == cdk_id); } if (flexible_array_member - && pedantic && !flag_isoc99 && !in_system_header) + && pedantic && !flag_isoc99 + && !in_system_header_at (input_location)) pedwarn (loc, OPT_Wpedantic, "ISO C90 does not support flexible array members"); @@ -6383,7 +6390,8 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) error ("%<[*]%> not allowed in other than function prototype scope"); } - if (arg_types == 0 && !funcdef_flag && !in_system_header) + if (arg_types == 0 && !funcdef_flag + && !in_system_header_at (input_location)) warning (OPT_Wstrict_prototypes, "function declaration isn%'t a prototype"); @@ -7782,7 +7790,7 @@ build_enumerator (location_t decl_loc, location_t loc, /* Set basis for default for next value. */ the_enum->enum_next_value - = build_binary_op (EXPR_LOC_OR_HERE (value), + = build_binary_op (EXPR_LOC_OR_LOC (value, input_location), PLUS_EXPR, value, integer_one_node, 0); the_enum->enum_overflow = tree_int_cst_lt (the_enum->enum_next_value, value); @@ -8056,7 +8064,8 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info) warning if we got here because ARG_INFO_TYPES was error_mark_node (this happens when a function definition has just an ellipsis in its parameter list). */ - else if (!in_system_header && !current_function_scope + else if (!in_system_header_at (input_location) + && !current_function_scope && arg_info->types != error_mark_node) warning_at (DECL_SOURCE_LOCATION (fndecl), OPT_Wtraditional, "traditional C rejects ISO C style function definitions"); @@ -8110,7 +8119,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) tree parmids = arg_info->parms; struct pointer_set_t *seen_args = pointer_set_create (); - if (!in_system_header) + if (!in_system_header_at (input_location)) warning_at (DECL_SOURCE_LOCATION (fndecl), OPT_Wold_style_definition, "old-style function definition"); @@ -9468,7 +9477,7 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, error_at (loc, "%<__int128%> is not supported for this target"); return specs; } - if (!in_system_header) + if (!in_system_header_at (input_location)) pedwarn (loc, OPT_Wpedantic, "ISO C does not support %<__int128%> type"); diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index ea3aa9a..1e3689f 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -775,8 +775,7 @@ c_parser_consume_pragma (c_parser *parser) parser->in_pragma = true; } -/* Update the globals input_location and in_system_header from - TOKEN. */ +/* Update the global input_location from TOKEN. */ static inline void c_parser_set_source_position_from_token (c_token *token) { @@ -6301,7 +6300,7 @@ c_parser_unary_expression (c_parser *parser) ret.value = build_indirect_ref (op_loc, op.value, RO_UNARY_STAR); return ret; case CPP_PLUS: - if (!c_dialect_objc () && !in_system_header) + if (!c_dialect_objc () && !in_system_header_at (input_location)) warning_at (op_loc, OPT_Wtraditional, "traditional C rejects the unary plus operator"); diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 8e74b7b..1ae75fb 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -6185,7 +6185,7 @@ store_init_value (location_t init_loc, tree decl, tree init, tree origtype) /* Store the expression if valid; else report error. */ - if (!in_system_header + if (!in_system_header_at (input_location) && AGGREGATE_TYPE_P (TREE_TYPE (decl)) && !TREE_STATIC (decl)) warning (OPT_Wtraditional, "traditional C rejects automatic " "aggregate initialization"); @@ -8686,7 +8686,7 @@ process_init_element (struct c_expr value, bool implicit, again on the assumption that this must be conditional on __STDC__ anyway (and we've already complained about the member-designator already). */ - if (!in_system_header && !constructor_designated + if (!in_system_header_at (input_location) && !constructor_designated && !(value.value && (integer_zerop (value.value) || real_zerop (value.value)))) warning (OPT_Wtraditional, "traditional C rejects initialization " @@ -9287,7 +9287,7 @@ c_start_case (location_t switch_loc, { tree type = TYPE_MAIN_VARIANT (orig_type); - if (!in_system_header + if (!in_system_header_at (input_location) && (type == long_integer_type_node || type == long_unsigned_type_node)) warning_at (switch_cond_loc, |