From 151e674ab9981c986990e45c8a0a97815cac2021 Mon Sep 17 00:00:00 2001 From: Scott Linder Date: Thu, 2 May 2019 19:03:57 +0000 Subject: [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 --- test/Sema/attr-visibility.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/Sema/attr-visibility.c') 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}} -- cgit v1.2.1