aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2006-07-21 20:39:19 +0000
committerMike Stump <mrs@gcc.gnu.org>2006-07-21 20:39:19 +0000
commitdfb84d62333725bb2a75323baa6efe86176733c4 (patch)
tree8933addce976789e0d8124aed02da74fe0e572d4
parentc82815a60a1e5e744568084994a654e75d299fe8 (diff)
downloadgcc-dfb84d62333725bb2a75323baa6efe86176733c4.zip
gcc-dfb84d62333725bb2a75323baa6efe86176733c4.tar.gz
gcc-dfb84d62333725bb2a75323baa6efe86176733c4.tar.bz2
invoke.texi (C++ Dialect Options): Note that -fvisibility-inlines-hidden doesn't affect explicitly instantiationed...
* doc/invoke.texi (C++ Dialect Options): Note that -fvisibility-inlines-hidden doesn't affect explicitly instantiationed inline methods. cp: * decl2.c (determine_visibility_from_class): Don't use hidden visibility for explicit instantiations. testsuite: * g++.dg/ext/visibility/fvisibility-inlines-hidden-3.C: New test. From-SVN: r115649
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl2.c4
-rw-r--r--gcc/doc/invoke.texi4
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-3.C30
6 files changed, 50 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 597e1c1..a647341 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-07-21 Mike Stump <mrs@apple.com>
+
+ * doc/invoke.texi (C++ Dialect Options): Note that
+ -fvisibility-inlines-hidden doesn't affect explicitly
+ instantiationed inline methods.
+
2006-07-20 Roger Sayle <roger@eyesopen.com>
* config.gcc (i[34567]86-*-solaris2*): Add usegas.h to $tm_file
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0017e1d..f74d1a7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-20 Mike Stump <mrs@apple.com>
+
+ * decl2.c (determine_visibility_from_class): Don't use hidden
+ visibility for explicit instantiations.
+
2006-07-21 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28250
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 351de04..876dea3 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1801,7 +1801,9 @@ determine_visibility_from_class (tree decl, tree class_type)
&& !processing_template_decl
&& ! DECL_VISIBILITY_SPECIFIED (decl)
&& TREE_CODE (decl) == FUNCTION_DECL
- && DECL_DECLARED_INLINE_P (decl))
+ && DECL_DECLARED_INLINE_P (decl)
+ && (! DECL_LANG_SPECIFIC (decl)
+ || ! DECL_EXPLICIT_INSTANTIATION (decl)))
DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
else if (!DECL_VISIBILITY_SPECIFIED (decl))
{
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 7d72bd7..28a0a5b 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1627,6 +1627,10 @@ effect of the switch for that method. For example, if you do want to
compare pointers to a particular inline method, you might mark it as
having default visibility.
+Explicitly instantiated inline methods are unaffected by this option
+as their linkage might otherwise cross a shared library boundary.
+@xref{Template Instantiation}.
+
@item -fno-weak
@opindex fno-weak
Do not use weak symbol support, even if it is provided by the linker.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c50a249..d0b9521f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2006-07-21 Mike Stump <mrs@apple.com>
+ * g++.dg/ext/visibility/fvisibility-inlines-hidden-3.C: New test.
+
* gcc.c-torture/unsorted/dump-noaddr.x: Fix test case name.
2006-07-21 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
diff --git a/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-3.C b/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-3.C
new file mode 100644
index 0000000..50885a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-3.C
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+/* { dg-options "-fvisibility-inlines-hidden" } */
+/* { dg-final { scan-not-hidden "_ZN1IIiE3fooEv" } } */
+/* { dg-final { scan-not-hidden "_ZN1OIiE3fooEv" } } */
+/* { dg-final { scan-hidden "_ZN1S3fooEv" } } */
+
+template <class T>
+struct O {
+ static inline void foo() { }
+};
+
+template void O<int>::foo();
+
+template <class T>
+struct I {
+ static inline void foo() { }
+};
+
+extern template void I<int>::foo();
+
+struct S {
+ static inline void foo() { }
+};
+
+void bar() {
+ I<int>::foo();
+ O<int>::foo();
+ S::foo();
+}