aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2019-09-16 23:04:10 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2019-09-16 23:04:10 +0000
commit61b204bf24adfe62d58400e60732bc569bc2164a (patch)
treeea1077703877a85ebba600225a35d7f3769dfcd4 /gcc/cp/decl.c
parentb3a77aa6ffa0186a966ad53360aa1485c783800a (diff)
downloadgcc-61b204bf24adfe62d58400e60732bc569bc2164a.zip
gcc-61b204bf24adfe62d58400e60732bc569bc2164a.tar.gz
gcc-61b204bf24adfe62d58400e60732bc569bc2164a.tar.bz2
decl.c (grokdeclarator): Use declspecs->locations and declarator->id_loc in a few error messages.
/cp 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grokdeclarator): Use declspecs->locations and declarator->id_loc in a few error messages. * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION. (push_template_decl_real): Likewise. /testsuite 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/ext/int128-6.C: New. * c-c++-common/pr68107.c: Test location(s). * g++.dg/other/large-size-array.C: Likewise. * g++.dg/template/dtor2.C: Likewise. * g++.dg/template/error9.C: Likewise. * g++.dg/tls/diag-2.C: Likewise. * g++.dg/tls/diag-4.C: Likewise. * g++.dg/tls/diag-5.C: Likewise. * g++.old-deja/g++.pt/memtemp71.C: Likewise. From-SVN: r275759
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index e0d6732..b753796 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10948,14 +10948,15 @@ grokdeclarator (const cp_declarator *declarator,
{
if (! int_n_enabled_p[declspecs->int_n_idx])
{
- error ("%<__int%d%> is not supported by this target",
- int_n_data[declspecs->int_n_idx].bitsize);
+ error_at (declspecs->locations[ds_type_spec],
+ "%<__int%d%> is not supported by this target",
+ int_n_data[declspecs->int_n_idx].bitsize);
explicit_intN = false;
}
/* Don't pedwarn if the alternate "__intN__" form has been used instead
of "__intN". */
else if (!int_n_alt && pedantic && ! in_system_header_at (input_location))
- pedwarn (input_location, OPT_Wpedantic,
+ pedwarn (declspecs->locations[ds_type_spec], OPT_Wpedantic,
"ISO C++ does not support %<__int%d%> for %qs",
int_n_data[declspecs->int_n_idx].bitsize, name);
}
@@ -11330,7 +11331,10 @@ grokdeclarator (const cp_declarator *declarator,
&& storage_class != sc_static)
|| typedef_p))
{
- error ("multiple storage classes in declaration of %qs", name);
+ location_t loc
+ = min_location (declspecs->locations[ds_thread],
+ declspecs->locations[ds_storage_class]);
+ error_at (loc, "multiple storage classes in declaration of %qs", name);
thread_p = false;
}
if (decl_context != NORMAL
@@ -11489,7 +11493,9 @@ grokdeclarator (const cp_declarator *declarator,
type = create_array_type_for_decl (dname, type,
declarator->u.array.bounds,
declarator->id_loc);
- if (!valid_array_size_p (input_location, type, dname))
+ if (!valid_array_size_p (dname
+ ? declarator->id_loc : input_location,
+ type, dname))
type = error_mark_node;
if (declarator->std_attributes)