From 33b5d6da2aa84c197ae8c02961ddab6e59f644f2 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 5 Nov 2013 15:22:36 +0000 Subject: [PATCH] re PR c++/58724 (ICE with attribute [[gnu::visibility("default")]] on namespace) 2013-11-05 Paolo Carlini PR c++/58724 * doc/extend.texi [visibility ("visibility_type")]: Add example about visibility attribute on namespace declaration. /cp 2013-11-05 Paolo Carlini PR c++/58724 * name-lookup.c (handle_namespace_attrs): Use get_attribute_name. /testsuite 2013-11-05 Paolo Carlini PR c++/58724 * g++.dg/cpp0x/gen-attrs-56.C: New. From-SVN: r204401 --- gcc/ChangeLog | 8 +++++++- gcc/cp/ChangeLog | 5 +++++ gcc/cp/name-lookup.c | 2 +- gcc/doc/extend.texi | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/gen-attrs-56.C | 5 +++++ 6 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/gen-attrs-56.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c6d309..6067ee5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-11-05 Paolo Carlini + + PR c++/58724 + * doc/extend.texi [visibility ("visibility_type")]: Add example + about visibility attribute on namespace declaration. + 2013-11-05 Richard Biener PR ipa/58492 @@ -27,7 +33,7 @@ 2013-11-05 Andrew MacLeod - * tree-outof-ssa.c (queue_phi_copy_p): Combine phi_ssa_name_p from + * tree-outof-ssa.c (queue_phi_copy_p): Combine phi_ssa_name_p from gimple.h and the rest of the condition in eliminate_build. (eliminate_build): Call new routine. * gimple.h (phi_ssa_name_p): Delete. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e661390..fb9e0c6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-11-05 Paolo Carlini + + PR c++/58724 + * name-lookup.c (handle_namespace_attrs): Use get_attribute_name. + 2013-11-05 Tobias Burnus * parser.c (cp_parser_omp_for, cp_parser_omp_parallel, diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 025a03c..ced596e 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3571,7 +3571,7 @@ handle_namespace_attrs (tree ns, tree attributes) for (d = attributes; d; d = TREE_CHAIN (d)) { - tree name = TREE_PURPOSE (d); + tree name = get_attribute_name (d); tree args = TREE_VALUE (d); if (is_attribute_p ("visibility", name)) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 799ede1..0d72819 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -4275,6 +4275,12 @@ the One Definition Rule; for example, it is usually not useful to mark an inline method as hidden without marking the whole class as hidden. A C++ namespace declaration can also have the visibility attribute. + +@smallexample +namespace nspace1 __attribute__ ((visibility ("protected"))) +@{ /* @r{Do something.} */; @} +@end smallexample + This attribute applies only to the particular namespace body, not to other definitions of the same namespace; it is equivalent to using @samp{#pragma GCC visibility} before and after the namespace diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6a7f3d1..6146163 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-11-05 Paolo Carlini + + PR c++/58724 + * g++.dg/cpp0x/gen-attrs-56.C: New. + 2013-11-05 Richard Biener PR ipa/58492 diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-56.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-56.C new file mode 100644 index 0000000..f331ed3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-56.C @@ -0,0 +1,5 @@ +// PR c++/58724 +// { dg-do compile { target c++11 } } + +namespace foo __attribute__((visibility("default"))) {} +namespace bar [[gnu::visibility("default")]] {} -- 2.7.4