specifier is unsed in a declaration; as it may not make the symbol
local to linkage unit as intended. Suggest using "hidden" visibility
attribute instead. // rdar://
7703982
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162138
91177308-0d34-0410-b5e6-
96231b3b80d8
def note_non_literal_nontrivial_dtor : Note<
"%0 is not literal because it has a non-trivial destructor">;
def warn_private_extern : Warning<
- "Use of __private_extern__ on tentative definition has unexpected"
- " behaviour - use __attribute__((visibility(\"hidden\"))) on extern"
- " declaration or definition instead">,
- InGroup<PrivateExtern>, DefaultIgnore;
+ "use of __private_extern__ on a declaration may not produce external symbol "
+ "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
+def note_private_extern : Note<
+ "use __attribute__((visibility(\"hidden\"))) attribute instead">;
// C++11 char16_t/char32_t
def warn_cxx98_compat_unicode_type : Warning<
AbstractVariableType))
Var->setInvalidDecl();
if (!Type->isDependentType() && !Var->isInvalidDecl() &&
- Var->getStorageClass() == SC_PrivateExtern)
+ Var->getStorageClass() == SC_PrivateExtern) {
Diag(Var->getLocation(), diag::warn_private_extern);
+ Diag(Var->getLocation(), diag::note_private_extern);
+ }
return;
-// RUN: %clang_cc1 %s -triple i386-pc-linux-gnu -verify -fsyntax-only
+// RUN: %clang_cc1 %s -Wno-private-extern -triple i386-pc-linux-gnu -verify -fsyntax-only
void f() {
int i;
-// RUN: %clang_cc1 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
extern int l0 __attribute__((used)); // expected-warning {{used attribute ignored}}
__private_extern__ int l1 __attribute__((used)); // expected-warning {{used attribute ignored}}
-// RUN: %clang_cc1 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
static int g0; // expected-note{{previous definition}}
int g0; // expected-error{{non-static declaration of 'g0' follows static declaration}}
extern int i3;
// rdar://7703982
-__private_extern__ int pExtern; // expected-warning {{Use of __private_extern__ on tentative definition has unexpected behaviour}}
+__private_extern__ int pExtern; // expected-warning {{use of __private_extern__ on a declaration may not produce external symbol private to the linkage unit and is deprecated}} \
+// expected-note {{use __attribute__((visibility("hidden"))) attribute instead}}
int pExtern = 0;
int i4;
-// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic %s
__thread int t1;
__thread extern int t2; // expected-warning {{'__thread' before 'extern'}}