|
3 | 3 | #define MACRO_A "defining macros outside namespace is valid"
|
4 | 4 |
|
5 | 5 | class ClassB;
|
6 |
| -// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration must be enclosed within the 'LIBC_NAMESPACE' namespace |
| 6 | +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration must be enclosed within the 'LIBC_NAMESPACE_DECL' namespace |
7 | 7 | struct StructC {};
|
8 |
| -// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: declaration must be enclosed within the 'LIBC_NAMESPACE' namespace |
9 |
| -char *VarD = MACRO_A; |
10 |
| -// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration must be enclosed within the 'LIBC_NAMESPACE' namespace |
| 8 | +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: declaration must be enclosed within the 'LIBC_NAMESPACE_DECL' namespace |
| 9 | +const char *VarD = MACRO_A; |
| 10 | +// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: declaration must be enclosed within the 'LIBC_NAMESPACE_DECL' namespace |
11 | 11 | typedef int typeE;
|
12 |
| -// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: declaration must be enclosed within the 'LIBC_NAMESPACE' namespace |
| 12 | +// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: declaration must be enclosed within the 'LIBC_NAMESPACE_DECL' namespace |
13 | 13 | void funcF() {}
|
14 |
| -// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration must be enclosed within the 'LIBC_NAMESPACE' namespace |
| 14 | +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration must be enclosed within the 'LIBC_NAMESPACE_DECL' namespace |
15 | 15 |
|
16 | 16 | namespace outer_most {
|
17 |
| -// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: the outermost namespace should be the 'LIBC_NAMESPACE' macro |
| 17 | +// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: the outermost namespace should be the 'LIBC_NAMESPACE_DECL' macro |
18 | 18 | class A {};
|
19 | 19 | }
|
20 | 20 |
|
21 | 21 | // Wrapped in anonymous namespace.
|
22 | 22 | namespace {
|
23 |
| -// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: declaration must be enclosed within the 'LIBC_NAMESPACE' namespace |
| 23 | +// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: declaration must be enclosed within the 'LIBC_NAMESPACE_DECL' namespace |
24 | 24 | class A {};
|
25 | 25 | }
|
26 | 26 |
|
27 | 27 | namespace namespaceG {
|
28 |
| -// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: the outermost namespace should be the 'LIBC_NAMESPACE' macro |
| 28 | +// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: the outermost namespace should be the 'LIBC_NAMESPACE_DECL' macro |
29 | 29 | namespace __llvm_libc {
|
30 | 30 | namespace namespaceH {
|
31 | 31 | class ClassB;
|
32 | 32 | } // namespace namespaceH
|
33 | 33 | struct StructC {};
|
34 | 34 | } // namespace __llvm_libc
|
35 |
| -char *VarD = MACRO_A; |
| 35 | +const char *VarD = MACRO_A; |
36 | 36 | typedef int typeE;
|
37 | 37 | void funcF() {}
|
38 | 38 | } // namespace namespaceG
|
39 | 39 |
|
40 | 40 | // Wrapped in macro namespace but with an incorrect name
|
41 |
| -#define LIBC_NAMESPACE custom_namespace |
42 |
| -namespace LIBC_NAMESPACE { |
43 |
| -// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: the 'LIBC_NAMESPACE' macro should start with '__llvm_libc' |
| 41 | +#define LIBC_NAMESPACE_DECL [[gnu::visibility("hidden")]] custom_namespace |
| 42 | +namespace LIBC_NAMESPACE_DECL { |
| 43 | +// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: the 'LIBC_NAMESPACE_DECL' macro expansion should start with '__llvm_libc' |
| 44 | + |
44 | 45 | namespace namespaceH {
|
45 | 46 | class ClassB;
|
46 | 47 | } // namespace namespaceH
|
47 |
| -} // namespace LIBC_NAMESPACE |
| 48 | +} // namespace LIBC_NAMESPACE_DECL |
48 | 49 |
|
49 | 50 |
|
50 |
| -// Wrapped in macro namespace with a valid name, LIBC_NAMESPACE starts with '__llvm_libc' |
51 |
| -#undef LIBC_NAMESPACE |
52 |
| -#define LIBC_NAMESPACE __llvm_libc_xyz |
53 |
| -namespace LIBC_NAMESPACE { |
| 51 | +// Wrapped in macro namespace with a valid name, LIBC_NAMESPACE_DECL starts with '__llvm_libc' |
| 52 | +#undef LIBC_NAMESPACE_DECL |
| 53 | +#define LIBC_NAMESPACE_DECL [[gnu::visibility("hidden")]] __llvm_libc_xyz |
| 54 | +namespace LIBC_NAMESPACE_DECL { |
54 | 55 | namespace namespaceI {
|
55 | 56 | class ClassB;
|
56 | 57 | } // namespace namespaceI
|
57 | 58 | struct StructC {};
|
58 |
| -char *VarD = MACRO_A; |
| 59 | +const char *VarD = MACRO_A; |
59 | 60 | typedef int typeE;
|
60 | 61 | void funcF() {}
|
61 | 62 | extern "C" void extern_funcJ() {}
|
62 |
| -} // namespace LIBC_NAMESPACE |
| 63 | +} // namespace LIBC_NAMESPACE_DECL |
0 commit comments