From: Marek Polacek Date: Mon, 20 May 2019 19:04:52 +0000 (+0000) Subject: name-lookup.c (finish_using_directive): Don't issue inform() if the warning didn... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f12ea6acdeb3b62ddb8324bc71a67c6a189f6c3c;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 87ecd7c1f6f..88275f0ed44 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 * cp-tree.h: Remove remnants of CONV_NONCONVERTING. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index f7952eebe0c..476ba509231 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, "% 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 0f4c81c2154..be4e7eb895f 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 * 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 00000000000..17284949645 --- /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" } +}