diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2019-01-11 09:02:43 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2019-01-11 09:02:43 +0000 |
commit | a8766179a75fd18a1636b80425f81c0cd54d6151 (patch) | |
tree | 5955fc153ea7ffedd82733d5ca159d2fcaa96dbd /gcc/cp | |
parent | 7dc3df082b9edc8d78e0cd3846027afc345aebc7 (diff) | |
download | gcc-a8766179a75fd18a1636b80425f81c0cd54d6151.zip gcc-a8766179a75fd18a1636b80425f81c0cd54d6151.tar.gz gcc-a8766179a75fd18a1636b80425f81c0cd54d6151.tar.bz2 |
decl.c (start_decl): Improve error location.
/cp
2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (start_decl): Improve error location.
(grokdeclarator): Likewise, improve two locations.
/testsuite
2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/diagnostic/extern-initialized.C: New.
* g++.dg/ext/dllimport-initialized.C: Likewise.
From-SVN: r267830
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b3ee2a5..4b9fa82 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-01-11 Paolo Carlini <paolo.carlini@oracle.com> + + * decl.c (start_decl): Improve error location. + (grokdeclarator): Likewise, improve two locations. + 2019-01-09 Sandra Loosemore <sandra@codesourcery.com> PR other/16615 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 267303e..fe5403d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5096,7 +5096,8 @@ start_decl (const cp_declarator *declarator, a definition. */ if (initialized && DECL_DLLIMPORT_P (decl)) { - error ("definition of %q#D is marked %<dllimport%>", decl); + error_at (DECL_SOURCE_LOCATION (decl), + "definition of %q#D is marked %<dllimport%>", decl); DECL_DLLIMPORT_P (decl) = 0; } @@ -12791,11 +12792,13 @@ grokdeclarator (const cp_declarator *declarator, /* It's common practice (and completely valid) to have a const be initialized and declared extern. */ if (!(type_quals & TYPE_QUAL_CONST)) - warning (0, "%qs initialized and declared %<extern%>", name); + warning_at (DECL_SOURCE_LOCATION (decl), 0, + "%qs initialized and declared %<extern%>", name); } else { - error ("%qs has both %<extern%> and initializer", name); + error_at (DECL_SOURCE_LOCATION (decl), + "%qs has both %<extern%> and initializer", name); return error_mark_node; } } |