This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 4/9] cp: Convert implicit uses of input_location into explicit uses
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Thu, 21 Nov 2013 22:31:04 -0500
- Subject: [PATCH 4/9] cp: Convert implicit uses of input_location into explicit uses
- Authentication-results: sourceware.org; auth=none
- References: <1372778676 dot 6455 dot 34 dot camel at surprise> <1385091069-23732-1-git-send-email-dmalcolm at redhat dot com>
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/cp/call.c | 12 ++++++------
gcc/cp/cvt.c | 8 ++++----
gcc/cp/decl.c | 18 ++++++++++--------
gcc/cp/error.c | 6 +++---
gcc/cp/init.c | 4 ++--
gcc/cp/lex.c | 13 +++++++------
gcc/cp/name-lookup.c | 8 +++++---
gcc/cp/parser.c | 14 ++++++++------
gcc/cp/pt.c | 20 +++++++++++---------
gcc/cp/semantics.c | 15 ++++++++-------
gcc/cp/typeck.c | 17 ++++++++++-------
gcc/cp/typeck2.c | 4 ++--
12 files changed, 76 insertions(+), 63 deletions(-)
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index c529c16..935e011 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3687,7 +3687,7 @@ build_integral_nontype_arg_conv (tree type, tree expr, tsubst_flags_t complain)
conversion *conv;
void *p;
tree t;
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (error_operand_p (expr))
return error_mark_node;
@@ -5850,7 +5850,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
tree totype = convs->type;
diagnostic_t diag_kind;
int flags;
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (convs->bad_p && !(complain & tf_error))
return error_mark_node;
@@ -6263,7 +6263,7 @@ tree
convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
{
tree arg_type;
- location_t loc = EXPR_LOC_OR_HERE (arg);
+ location_t loc = EXPR_LOC_OR_LOC (arg, input_location);
/* [expr.call]
@@ -7168,7 +7168,7 @@ build_cxx_call (tree fn, int nargs, tree *argarray,
int optimize_sav;
/* Remember roughly where this call is. */
- location_t loc = EXPR_LOC_OR_HERE (fn);
+ location_t loc = EXPR_LOC_OR_LOC (fn, input_location);
fn = build_call_a (fn, nargs, argarray);
SET_EXPR_LOCATION (fn, loc);
@@ -8979,7 +8979,7 @@ perform_implicit_conversion_flags (tree type, tree expr,
{
conversion *conv;
void *p;
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (error_operand_p (expr))
return error_mark_node;
@@ -9295,7 +9295,7 @@ initialize_reference (tree type, tree expr,
{
conversion *conv;
void *p;
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (type == error_mark_node || error_operand_p (expr))
return error_mark_node;
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 5264c5d..c1dfdcf 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -78,7 +78,7 @@ cp_convert_to_pointer (tree type, tree expr, tsubst_flags_t complain)
tree intype = TREE_TYPE (expr);
enum tree_code form;
tree rval;
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (intype == error_mark_node)
return error_mark_node;
@@ -413,7 +413,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
tree rval = NULL_TREE;
tree rval_as_conversion = NULL_TREE;
bool can_convert_intype_to_type;
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (TREE_CODE (type) == FUNCTION_TYPE
&& TREE_TYPE (expr) == unknown_type_node)
@@ -656,7 +656,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
enum tree_code code = TREE_CODE (type);
const char *invalid_conv_diag;
tree e1;
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (error_operand_p (e) || type == error_mark_node)
return error_mark_node;
@@ -912,7 +912,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
tree
convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
{
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (expr == error_mark_node
|| TREE_TYPE (expr) == error_mark_node)
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 500c81f..40a9a8c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -376,7 +376,8 @@ pop_label (tree label, tree old_value)
location_t location;
error ("label %q+D used but not defined", label);
- location = input_location; /* FIXME want (input_filename, (line)0) */
+ location = input_location;
+ /* FIXME want (LOCATION_FILE (input_location), (line)0) */
/* Avoid crashing later. */
define_label (location, DECL_NAME (label));
}
@@ -3092,7 +3093,7 @@ pop_switch (void)
location_t switch_location;
/* Emit warnings as needed. */
- switch_location = EXPR_LOC_OR_HERE (cs->switch_stmt);
+ switch_location = EXPR_LOC_OR_LOC (cs->switch_stmt, input_location);
if (!processing_template_decl)
c_do_switch_warnings (cs->cases, switch_location,
SWITCH_STMT_TYPE (cs->switch_stmt),
@@ -4241,7 +4242,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs,
error ("multiple types in one declaration");
else if (declspecs->redefined_builtin_type)
{
- if (!in_system_header)
+ if (!in_system_header_at (input_location))
permerror (declspecs->locations[ds_redefined_builtin_type_spec],
"redeclaration of C++ built-in type %qT",
declspecs->redefined_builtin_type);
@@ -4292,7 +4293,8 @@ check_tag_decl (cp_decl_specifier_seq *declspecs,
/* Anonymous unions are objects, so they can have specifiers. */;
SET_ANON_AGGR_TYPE_P (declared_type);
- if (TREE_CODE (declared_type) != UNION_TYPE && !in_system_header)
+ if (TREE_CODE (declared_type) != UNION_TYPE
+ && !in_system_header_at (input_location))
pedwarn (input_location, OPT_Wpedantic, "ISO C++ prohibits anonymous structs");
}
@@ -5846,7 +5848,7 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
/* We try to defer namespace-scope static constants so that they are
not emitted into the object file unnecessarily. */
- filename = input_filename;
+ filename = LOCATION_FILE (input_location);
if (!DECL_VIRTUAL_P (decl)
&& TREE_READONLY (decl)
&& DECL_INITIAL (decl) != NULL_TREE
@@ -8309,7 +8311,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
indicated by the state of complain), so that
another substitution can be found. */
return error_mark_node;
- else if (in_system_header)
+ else if (in_system_header_at (input_location))
/* Allow them in system headers because glibc uses them. */;
else if (name)
pedwarn (input_location, OPT_Wpedantic, "ISO C++ forbids zero-size array %qD", name);
@@ -9096,7 +9098,7 @@ grokdeclarator (const cp_declarator *declarator,
if (type_was_error_mark_node)
/* We've already issued an error, don't complain more. */;
- else if (in_system_header || flag_ms_extensions)
+ else if (in_system_header_at (input_location) || flag_ms_extensions)
/* Allow it, sigh. */;
else if (! is_main)
permerror (input_location, "ISO C++ forbids declaration of %qs with no type", name);
@@ -9119,7 +9121,7 @@ grokdeclarator (const cp_declarator *declarator,
error ("%<__int128%> is not supported by this target");
explicit_int128 = false;
}
- else if (pedantic && ! in_system_header)
+ else if (pedantic && ! in_system_header_at (input_location))
pedwarn (input_location, OPT_Wpedantic,
"ISO C++ does not support %<__int128%> for %qs", name);
}
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 5481523..72aa936 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -924,7 +924,7 @@ dump_global_iord (cxx_pretty_printer *pp, tree t)
else
gcc_unreachable ();
- pp_printf (pp, p, input_filename);
+ pp_printf (pp, p, LOCATION_FILE (input_location));
}
static void
@@ -2804,7 +2804,7 @@ location_of (tree t)
if (DECL_P (t))
return DECL_SOURCE_LOCATION (t);
- return EXPR_LOC_OR_HERE (t);
+ return EXPR_LOC_OR_LOC (t, input_location);
}
/* Now the interfaces from error et al to dump_type et al. Each takes an
@@ -3463,7 +3463,7 @@ cp_printer (pretty_printer *pp, text_info *text, const char *spec,
void
maybe_warn_cpp0x (cpp0x_warn_str str)
{
- if ((cxx_dialect == cxx98) && !in_system_header)
+ if ((cxx_dialect == cxx98) && !in_system_header_at (input_location))
/* We really want to suppress this warning in system headers,
because libstdc++ uses variadic templates even when we aren't
in C++0x mode. */
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index fd43a4f..29ed2a9 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2319,7 +2319,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
{
if (complain & tf_error)
{
- error_at (EXPR_LOC_OR_HERE (inner_nelts),
+ error_at (EXPR_LOC_OR_LOC (inner_nelts, input_location),
"array size in operator new must be constant");
cxx_constant_value(inner_nelts);
}
@@ -2347,7 +2347,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
&& !TREE_CONSTANT (maybe_constant_value (outer_nelts)))
{
if (complain & tf_warning_or_error)
- pedwarn(EXPR_LOC_OR_HERE (outer_nelts), OPT_Wvla,
+ pedwarn(EXPR_LOC_OR_LOC (outer_nelts, input_location), OPT_Wvla,
"ISO C++ does not support variable-length array types");
else
return error_mark_node;
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 5d8a313..2d517a4 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -352,18 +352,18 @@ handle_pragma_interface (cpp_reader* /*dfile*/)
if (fname == error_mark_node)
return;
else if (fname == 0)
- filename = lbasename (input_filename);
+ filename = lbasename (LOCATION_FILE (input_location));
else
filename = TREE_STRING_POINTER (fname);
- finfo = get_fileinfo (input_filename);
+ finfo = get_fileinfo (LOCATION_FILE (input_location));
if (impl_file_chain == 0)
{
/* If this is zero at this point, then we are
auto-implementing. */
if (main_input_filename == 0)
- main_input_filename = input_filename;
+ main_input_filename = LOCATION_FILE (input_location);
}
finfo->interface_only = interface_strcmp (filename);
@@ -397,7 +397,7 @@ handle_pragma_implementation (cpp_reader* /*dfile*/)
if (main_input_filename)
filename = main_input_filename;
else
- filename = input_filename;
+ filename = LOCATION_FILE (input_location);
filename = lbasename (filename);
}
else
@@ -683,7 +683,8 @@ cxx_make_type (enum tree_code code)
/* Set up some flags that give proper default behavior. */
if (RECORD_OR_UNION_CODE_P (code))
{
- struct c_fileinfo *finfo = get_fileinfo (input_filename);
+ struct c_fileinfo *finfo = \
+ get_fileinfo (LOCATION_FILE (input_location));
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown);
CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
}
@@ -711,5 +712,5 @@ in_main_input_context (void)
return filename_cmp (main_input_filename,
LOCATION_FILE (tl->locus)) == 0;
else
- return filename_cmp (main_input_filename, input_filename) == 0;
+ return filename_cmp (main_input_filename, LOCATION_FILE (input_location)) == 0;
}
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index d0c024a..f527638 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -1504,7 +1504,8 @@ push_binding_level (cp_binding_level *scope)
{
scope->binding_depth = binding_depth;
indent (binding_depth);
- cp_binding_level_debug (scope, input_line, "push");
+ cp_binding_level_debug (scope, LOCATION_LINE (input_location),
+ "push");
binding_depth++;
}
}
@@ -1590,7 +1591,8 @@ leave_scope (void)
if (ENABLE_SCOPE_CHECKING)
{
indent (--binding_depth);
- cp_binding_level_debug (scope, input_line, "leave");
+ cp_binding_level_debug (scope, LOCATION_LINE (input_location),
+ "leave");
}
/* Move one nesting level up. */
@@ -1639,7 +1641,7 @@ resume_scope (cp_binding_level* b)
{
b->binding_depth = binding_depth;
indent (binding_depth);
- cp_binding_level_debug (b, input_line, "resume");
+ cp_binding_level_debug (b, LOCATION_LINE (input_location), "resume");
binding_depth++;
}
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 977adf6..b06ce96 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -5088,7 +5088,8 @@ cp_parser_unqualified_id (cp_parser* parser,
{
/* 17.6.3.3.5 */
const char *name = UDLIT_OP_SUFFIX (id);
- if (name[0] != '_' && !in_system_header && declarator_p)
+ if (name[0] != '_' && !in_system_header_at (input_location)
+ && declarator_p)
warning (0, "literal operator suffixes not preceded by %<_%>"
" are reserved for future standardization");
}
@@ -7686,7 +7687,7 @@ cp_parser_cast_expression (cp_parser *parser, bool address_p, bool cast_p,
/* Warn about old-style casts, if so requested. */
if (warn_old_style_cast
- && !in_system_header
+ && !in_system_header_at (input_location)
&& !VOID_TYPE_P (type)
&& current_lang_name != lang_name_c)
warning (OPT_Wold_style_cast, "use of old-style cast");
@@ -10765,7 +10766,7 @@ cp_parser_declaration_seq_opt (cp_parser* parser)
/* A declaration consisting of a single semicolon is
invalid. Allow it unless we're being pedantic. */
cp_lexer_consume_token (parser->lexer);
- if (!in_system_header)
+ if (!in_system_header_at (input_location))
pedwarn (input_location, OPT_Wpedantic, "extra %<;%>");
continue;
}
@@ -15527,7 +15528,7 @@ cp_parser_enumerator_list (cp_parser* parser, tree type)
/* If the next token is a `}', there is a trailing comma. */
if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
{
- if (cxx_dialect < cxx11 && !in_system_header)
+ if (cxx_dialect < cxx11 && !in_system_header_at (input_location))
pedwarn (input_location, OPT_Wpedantic,
"comma at end of enumerator list");
break;
@@ -18056,7 +18057,8 @@ cp_parser_parameter_declaration_clause (cp_parser* parser)
/* There are no parameters. */
{
#ifndef NO_IMPLICIT_EXTERN_C
- if (in_system_header && current_class_type == NULL
+ if (in_system_header_at (input_location)
+ && current_class_type == NULL
&& current_lang_name == lang_name_c)
return NULL_TREE;
else
@@ -20793,7 +20795,7 @@ cp_parser_exception_specification_opt (cp_parser* parser)
#if 0
/* Enable this once a lot of code has transitioned to noexcept? */
- if (cxx_dialect >= cxx11 && !in_system_header)
+ if (cxx_dialect >= cxx11 && !in_system_header_at (input_location))
warning (OPT_Wdeprecated, "dynamic exception specifications are "
"deprecated in C++0x; use %<noexcept%> instead");
#endif
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index bbf8f55..96343ed 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5437,7 +5437,7 @@ unify_arg_conversion (bool explain_p, tree to_type,
tree from_type, tree arg)
{
if (explain_p)
- inform (EXPR_LOC_OR_HERE (arg),
+ inform (EXPR_LOC_OR_LOC (arg, input_location),
" cannot convert %qE (type %qT) to type %qT",
arg, from_type, to_type);
return 1;
@@ -5677,7 +5677,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
return NULL_TREE;
expr = cxx_constant_value (expr);
if (errorcount > errs || warningcount + werrorcount > warns)
- inform (EXPR_LOC_OR_HERE (expr),
+ inform (EXPR_LOC_OR_LOC (expr, input_location),
"in template argument for type %qT ", type);
if (expr == error_mark_node)
return NULL_TREE;
@@ -8093,7 +8093,7 @@ push_tinst_level (tree d)
new_level->decl = d;
new_level->locus = input_location;
new_level->errors = errorcount+sorrycount;
- new_level->in_system_header_p = in_system_header;
+ new_level->in_system_header_p = in_system_header_at (input_location);
new_level->next = current_tinst_level;
current_tinst_level = new_level;
@@ -14505,7 +14505,7 @@ tsubst_copy_and_build (tree t,
fn = TREE_OPERAND (fn, 1);
if (is_overloaded_fn (fn))
fn = get_first_fn (fn);
- if (permerror (EXPR_LOC_OR_HERE (t),
+ if (permerror (EXPR_LOC_OR_LOC (t, input_location),
"%qD was not declared in this scope, "
"and no declarations were found by "
"argument-dependent lookup at the point "
@@ -14515,15 +14515,17 @@ tsubst_copy_and_build (tree t,
/* Can't say anything more. */;
else if (DECL_CLASS_SCOPE_P (fn))
{
- inform (EXPR_LOC_OR_HERE (t),
+ location_t loc = EXPR_LOC_OR_LOC (t,
+ input_location);
+ inform (loc,
"declarations in dependent base %qT are "
"not found by unqualified lookup",
DECL_CLASS_CONTEXT (fn));
if (current_class_ptr)
- inform (EXPR_LOC_OR_HERE (t),
+ inform (loc,
"use %<this->%D%> instead", function);
else
- inform (EXPR_LOC_OR_HERE (t),
+ inform (loc,
"use %<%T::%D%> instead",
current_class_name, function);
}
@@ -18807,7 +18809,7 @@ do_decl_instantiation (tree decl, tree storage)
;
else if (storage == ridpointers[(int) RID_EXTERN])
{
- if (!in_system_header && (cxx_dialect == cxx98))
+ if (!in_system_header_at (input_location) && (cxx_dialect == cxx98))
pedwarn (input_location, OPT_Wpedantic,
"ISO C++ 1998 forbids the use of %<extern%> on explicit "
"instantiations");
@@ -18900,7 +18902,7 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
if (storage != NULL_TREE)
{
- if (!in_system_header)
+ if (!in_system_header_at (input_location))
{
if (storage == ridpointers[(int) RID_EXTERN])
{
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 11f7812..907bd0c 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2146,7 +2146,7 @@ finish_call_expr (tree fn, vec<tree, va_gc> **args, bool disallow_virtual,
&& type_dependent_expression_p (current_class_ref)))
{
result = build_nt_call_vec (fn, *args);
- SET_EXPR_LOCATION (result, EXPR_LOC_OR_HERE (fn));
+ SET_EXPR_LOCATION (result, EXPR_LOC_OR_LOC (fn, input_location));
KOENIG_LOOKUP_P (result) = koenig_p;
if (cfun)
{
@@ -2721,7 +2721,8 @@ begin_class_definition (tree t)
before. */
if (! TYPE_ANONYMOUS_P (t))
{
- struct c_fileinfo *finfo = get_fileinfo (input_filename);
+ struct c_fileinfo *finfo = \
+ get_fileinfo (LOCATION_FILE (input_location));
CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
SET_CLASSTYPE_INTERFACE_UNKNOWN_X
(t, finfo->interface_unknown);
@@ -8278,7 +8279,7 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t,
bool allow_non_constant, bool addr,
bool *non_constant_p, bool *overflow_p)
{
- location_t loc = EXPR_LOC_OR_HERE (t);
+ location_t loc = EXPR_LOC_OR_LOC (t, input_location);
tree fun = get_function_named_in_call (t);
tree result;
constexpr_call new_call = { NULL, NULL, NULL, 0 };
@@ -9659,7 +9660,7 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t,
&& !integer_zerop (op))
{
if (!allow_non_constant)
- error_at (EXPR_LOC_OR_HERE (t),
+ error_at (EXPR_LOC_OR_LOC (t, input_location),
"reinterpret_cast from integer to pointer");
*non_constant_p = true;
return t;
@@ -9705,7 +9706,7 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t,
case EXPR_STMT:
case OFFSET_REF:
if (!allow_non_constant)
- error_at (EXPR_LOC_OR_HERE (t),
+ error_at (EXPR_LOC_OR_LOC (t, input_location),
"expression %qE is not a constant-expression", t);
*non_constant_p = true;
break;
@@ -9978,7 +9979,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
{
if (flags & tf_error)
{
- error_at (EXPR_LOC_OR_HERE (t),
+ error_at (EXPR_LOC_OR_LOC (t, input_location),
"call to non-constexpr function %qD", fun);
explain_invalid_constexpr_fn (fun);
}
@@ -10070,7 +10071,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
&& !integer_zerop (from))
{
if (flags & tf_error)
- error_at (EXPR_LOC_OR_HERE (t),
+ error_at (EXPR_LOC_OR_LOC (t, input_location),
"reinterpret_cast from integer to pointer");
return false;
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index c9ddbe9..493453b 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1883,7 +1883,7 @@ decay_conversion (tree exp, tsubst_flags_t complain)
{
tree type;
enum tree_code code;
- location_t loc = EXPR_LOC_OR_HERE (exp);
+ location_t loc = EXPR_LOC_OR_LOC (exp, input_location);
type = TREE_TYPE (exp);
if (type == error_mark_node)
@@ -2133,6 +2133,8 @@ static tree
rationalize_conditional_expr (enum tree_code code, tree t,
tsubst_flags_t complain)
{
+ location_t loc = EXPR_LOC_OR_LOC (t, input_location);
+
/* For MIN_EXPR or MAX_EXPR, fold-const.c has arranged things so that
the first operand is always the one to be used if both operands
are equal, so we know what conditional expression this used to be. */
@@ -2145,8 +2147,8 @@ rationalize_conditional_expr (enum tree_code code, tree t,
gcc_assert (!TREE_SIDE_EFFECTS (op0)
&& !TREE_SIDE_EFFECTS (op1));
return
- build_conditional_expr (EXPR_LOC_OR_HERE (t),
- build_x_binary_op (EXPR_LOC_OR_HERE (t),
+ build_conditional_expr (loc,
+ build_x_binary_op (loc,
(TREE_CODE (t) == MIN_EXPR
? LE_EXPR : GE_EXPR),
op0, TREE_CODE (op0),
@@ -2159,7 +2161,7 @@ rationalize_conditional_expr (enum tree_code code, tree t,
}
return
- build_conditional_expr (EXPR_LOC_OR_HERE (t), TREE_OPERAND (t, 0),
+ build_conditional_expr (loc, TREE_OPERAND (t, 0),
cp_build_unary_op (code, TREE_OPERAND (t, 1), 0,
complain),
cp_build_unary_op (code, TREE_OPERAND (t, 2), 0,
@@ -6042,8 +6044,9 @@ build_x_compound_expr_from_list (tree list, expr_list_kind exp,
&& !CONSTRUCTOR_IS_DIRECT_INIT (expr))
{
if (complain & tf_error)
- pedwarn (EXPR_LOC_OR_HERE (expr), 0, "list-initializer for "
- "non-class type must not be parenthesized");
+ pedwarn (EXPR_LOC_OR_LOC (expr, input_location), 0,
+ "list-initializer for non-class type must not "
+ "be parenthesized");
else
return error_mark_node;
}
@@ -8101,7 +8104,7 @@ convert_for_assignment (tree type, tree rhs,
&& TREE_CODE (TREE_TYPE (rhs)) != BOOLEAN_TYPE
&& (complain & tf_warning))
{
- location_t loc = EXPR_LOC_OR_HERE (rhs);
+ location_t loc = EXPR_LOC_OR_LOC (rhs, input_location);
warning_at (loc, OPT_Wparentheses,
"suggest parentheses around assignment used as truth value");
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 0f3b01d..9fa201d 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -896,11 +896,11 @@ check_narrowing (tree type, tree init)
if (!ok)
{
if (cxx_dialect >= cxx11)
- pedwarn (EXPR_LOC_OR_HERE (init), OPT_Wnarrowing,
+ pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing,
"narrowing conversion of %qE from %qT to %qT inside { }",
init, ftype, type);
else
- warning_at (EXPR_LOC_OR_HERE (init), OPT_Wnarrowing,
+ warning_at (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing,
"narrowing conversion of %qE from %qT to %qT inside { } "
"is ill-formed in C++11", init, ftype, type);
}
--
1.7.11.7