diff options
author | Marek Polacek <polacek@redhat.com> | 2019-05-20 19:04:52 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2019-05-20 19:04:52 +0000 |
commit | f12ea6acdeb3b62ddb8324bc71a67c6a189f6c3c (patch) | |
tree | 11d8d8987f0f2d30558906d47ef59a5e13476e4a /gcc | |
parent | 8d25372f16eb18581227790389df3115314d07ab (diff) | |
download | gcc-f12ea6acdeb3b62ddb8324bc71a67c6a189f6c3c.zip gcc-f12ea6acdeb3b62ddb8324bc71a67c6a189f6c3c.tar.gz gcc-f12ea6acdeb3b62ddb8324bc71a67c6a189f6c3c.tar.bz2 |
name-lookup.c (finish_using_directive): Don't issue inform() if the warning didn't trigger.
* name-lookup.c (finish_using_directive): Don't issue inform() if the
warning didn't trigger. Add quoting. Tweak the inform message.
* g++.dg/lookup/strong-using2.C: New test.
From-SVN: r271432
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/strong-using2.C | 11 |
4 files changed, 19 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 87ecd7c..88275f0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -3,6 +3,9 @@ * pt.c (convert_template_argument): Add a diagnostic for the [temp.arg]/2 ambiguity case. + * name-lookup.c (finish_using_directive): Don't issue inform() if the + warning didn't trigger. Add quoting. Tweak the inform message. + 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com> * cp-tree.h: Remove remnants of CONV_NONCONVERTING. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index f7952ee..476ba50 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -7258,10 +7258,10 @@ finish_using_directive (tree target, tree attribs) if (current_binding_level->kind == sk_namespace && is_attribute_p ("strong", name)) { - warning (0, "strong using directive no longer supported"); - if (CP_DECL_CONTEXT (target) == current_namespace) + if (warning (0, "%<strong%> using directive no longer supported") + && CP_DECL_CONTEXT (target) == current_namespace) inform (DECL_SOURCE_LOCATION (target), - "you may use an inline namespace instead"); + "you can use an inline namespace instead"); } else warning (OPT_Wattributes, "%qD attribute directive ignored", name); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0f4c81c..be4e7eb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -4,6 +4,8 @@ * g++.dg/cpp2a/nontype-class17.C: New test. + * g++.dg/lookup/strong-using2.C: New test. + 2019-05-20 Jeff Law <law@redhat.com> * gcc.dg/Wtype-limits-Wextra.c: Adjust expected output after diff --git a/gcc/testsuite/g++.dg/lookup/strong-using2.C b/gcc/testsuite/g++.dg/lookup/strong-using2.C new file mode 100644 index 0000000..1728494 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/strong-using2.C @@ -0,0 +1,11 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-w" } + +namespace A +{ + namespace B // { dg-bogus "inline namespace" } + { + } + + using namespace B __attribute__ ((strong)); // { dg-bogus "no longer supported" } +} |