summaryrefslogtreecommitdiff
path: root/test/Sema/attr-visibility.c
diff options
context:
space:
mode:
authorScott Linder <scott@scottlinder.com>2019-05-02 19:03:57 +0000
committerScott Linder <scott@scottlinder.com>2019-05-02 19:03:57 +0000
commit151e674ab9981c986990e45c8a0a97815cac2021 (patch)
treea3df8deb4b5ade474d4d56846269bf6760f33210 /test/Sema/attr-visibility.c
parent8a2708eca05acc8285203bd8efbdc68318f61fcb (diff)
downloadclang-151e674ab9981c986990e45c8a0a97815cac2021.tar.gz
[Sema] Emit warning for visibility attribute on internal-linkage declaration
GCC warns on these cases, but we currently just silently ignore the attribute. Differential Revision: https://reviews.llvm.org/D61097 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359814 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/attr-visibility.c')
-rw-r--r--test/Sema/attr-visibility.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Sema/attr-visibility.c b/test/Sema/attr-visibility.c
index 798d6dcd78..792721a1ac 100644
--- a/test/Sema/attr-visibility.c
+++ b/test/Sema/attr-visibility.c
@@ -26,3 +26,9 @@ typedef int __attribute__((visibility("default"))) bar; // expected-warning {{'v
int x __attribute__((type_visibility("default"))); // expected-error {{'type_visibility' attribute only applies to types and namespaces}}
int PR17105 __attribute__((visibility(hidden))); // expected-error {{'visibility' attribute requires a string}}
+
+static int test8 __attribute__((visibility("default"))); // expected-warning {{'visibility' attribute is ignored on a non-external symbol}}
+static int test9 __attribute__((visibility("hidden"))); // expected-warning {{'visibility' attribute is ignored on a non-external symbol}}
+static int test10 __attribute__((visibility("internal"))); // expected-warning {{'visibility' attribute is ignored on a non-external symbol}}
+
+static int test11() __attribute__((visibility("default"))); // expected-warning {{'visibility' attribute is ignored on a non-external symbol}}