Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit f3dc130

Browse files
committed
Determine the attribute subject for diagnostics based on declarative information in DeclNodes.td. This greatly reduces the number of enumerated values used for more complex diagnostics; these are now only required when the "attribute only applies to" diagnostic needs to be generated manually as part of semantic processing.
This also clarifies some terminology used by the diagnostic (methods -> Objective-C methods, fields -> non-static data members, etc). Many of the tests needed to be updated in multiple places for the diagnostic wording tweaks. The first instance of the diagnostic for that attribute is fully specified and subsequent instances cut off the complete list (to make it easier if additional subjects are added in the future for the attribute). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319002 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent dace804 commit f3dc130

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+312
-460
lines changed

include/clang/Basic/Attr.td

+69-94
Large diffs are not rendered by default.

include/clang/Basic/DeclNodes.td

+31-28
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,68 @@
11
class AttrSubject;
22

3-
class Decl<bit abstract = 0> : AttrSubject {
3+
class Decl<string diagSpelling = "", bit abstract = 0> : AttrSubject {
44
bit Abstract = abstract;
5+
string DiagSpelling = diagSpelling;
56
}
67

7-
class DDecl<Decl base, bit abstract = 0> : Decl<abstract> {
8+
class DDecl<Decl base, string diagSpelling = "", bit abstract = 0>
9+
: Decl<diagSpelling, abstract> {
810
Decl Base = base;
911
}
1012

11-
class DeclContext { }
13+
class DeclContext {}
1214

1315
def TranslationUnit : Decl, DeclContext;
1416
def PragmaComment : Decl;
1517
def PragmaDetectMismatch : Decl;
1618
def ExternCContext : Decl, DeclContext;
17-
def Named : Decl<1>;
18-
def Namespace : DDecl<Named>, DeclContext;
19+
def Named : Decl<"named declarations", 1>;
20+
def Namespace : DDecl<Named, "namespaces">, DeclContext;
1921
def UsingDirective : DDecl<Named>;
2022
def NamespaceAlias : DDecl<Named>;
21-
def Label : DDecl<Named>;
22-
def Type : DDecl<Named, 1>;
23-
def TypedefName : DDecl<Type, 1>;
23+
def Label : DDecl<Named, "labels">;
24+
def Type : DDecl<Named, "types", 1>;
25+
def TypedefName : DDecl<Type, "typedefs", 1>;
2426
def Typedef : DDecl<TypedefName>;
2527
def TypeAlias : DDecl<TypedefName>;
2628
def ObjCTypeParam : DDecl<TypedefName>;
2729
def UnresolvedUsingTypename : DDecl<Type>;
28-
def Tag : DDecl<Type, 1>, DeclContext;
29-
def Enum : DDecl<Tag>;
30-
def Record : DDecl<Tag>;
31-
def CXXRecord : DDecl<Record>;
30+
def Tag : DDecl<Type, "tag types", 1>, DeclContext;
31+
def Enum : DDecl<Tag, "enums">;
32+
def Record : DDecl<Tag, "structs, unions, classes">;
33+
def CXXRecord : DDecl<Record, "classes">;
3234
def ClassTemplateSpecialization : DDecl<CXXRecord>;
3335
def ClassTemplatePartialSpecialization
3436
: DDecl<ClassTemplateSpecialization>;
3537
def TemplateTypeParm : DDecl<Type>;
36-
def Value : DDecl<Named, 1>;
37-
def EnumConstant : DDecl<Value>;
38+
def Value : DDecl<Named, "value declarations", 1>;
39+
def EnumConstant : DDecl<Value, "enumerators">;
3840
def UnresolvedUsingValue : DDecl<Value>;
3941
def IndirectField : DDecl<Value>;
4042
def Binding : DDecl<Value>;
4143
def OMPDeclareReduction : DDecl<Value>, DeclContext;
42-
def Declarator : DDecl<Value, 1>;
43-
def Field : DDecl<Declarator>;
44+
def Declarator : DDecl<Value, "declarators", 1>;
45+
def Field : DDecl<Declarator, "non-static data members">;
4446
def ObjCIvar : DDecl<Field>;
4547
def ObjCAtDefsField : DDecl<Field>;
4648
def MSProperty : DDecl<Declarator>;
47-
def Function : DDecl<Declarator>, DeclContext;
49+
def Function : DDecl<Declarator, "functions">, DeclContext;
4850
def CXXDeductionGuide : DDecl<Function>;
4951
def CXXMethod : DDecl<Function>;
5052
def CXXConstructor : DDecl<CXXMethod>;
5153
def CXXDestructor : DDecl<CXXMethod>;
5254
def CXXConversion : DDecl<CXXMethod>;
53-
def Var : DDecl<Declarator>;
55+
def Var : DDecl<Declarator, "variables">;
5456
def VarTemplateSpecialization : DDecl<Var>;
5557
def VarTemplatePartialSpecialization
5658
: DDecl<VarTemplateSpecialization>;
5759
def ImplicitParam : DDecl<Var>;
58-
def ParmVar : DDecl<Var>;
60+
def ParmVar : DDecl<Var, "parameters">;
5961
def Decomposition : DDecl<Var>;
6062
def OMPCapturedExpr : DDecl<Var>;
6163
def NonTypeTemplateParm : DDecl<Declarator>;
62-
def Template : DDecl<Named, 1>;
63-
def RedeclarableTemplate : DDecl<Template, 1>;
64+
def Template : DDecl<Named, "templates", 1>;
65+
def RedeclarableTemplate : DDecl<Template, "redeclarable templates", 1>;
6466
def FunctionTemplate : DDecl<RedeclarableTemplate>;
6567
def ClassTemplate : DDecl<RedeclarableTemplate>;
6668
def VarTemplate : DDecl<RedeclarableTemplate>;
@@ -71,15 +73,16 @@ def Named : Decl<1>;
7173
def UsingPack : DDecl<Named>;
7274
def UsingShadow : DDecl<Named>;
7375
def ConstructorUsingShadow : DDecl<UsingShadow>;
74-
def ObjCMethod : DDecl<Named>, DeclContext;
75-
def ObjCContainer : DDecl<Named, 1>, DeclContext;
76+
def ObjCMethod : DDecl<Named, "Objective-C methods">, DeclContext;
77+
def ObjCContainer : DDecl<Named, "Objective-C containers", 1>, DeclContext;
7678
def ObjCCategory : DDecl<ObjCContainer>;
77-
def ObjCProtocol : DDecl<ObjCContainer>;
78-
def ObjCInterface : DDecl<ObjCContainer>;
79-
def ObjCImpl : DDecl<ObjCContainer, 1>;
79+
def ObjCProtocol : DDecl<ObjCContainer, "Objective-C protocols">;
80+
def ObjCInterface : DDecl<ObjCContainer, "Objective-C interfaces">;
81+
def ObjCImpl
82+
: DDecl<ObjCContainer, "Objective-C implementation declarations", 1>;
8083
def ObjCCategoryImpl : DDecl<ObjCImpl>;
8184
def ObjCImplementation : DDecl<ObjCImpl>;
82-
def ObjCProperty : DDecl<Named>;
85+
def ObjCProperty : DDecl<Named, "Objective-C properties">;
8386
def ObjCCompatibleAlias : DDecl<Named>;
8487
def LinkageSpec : Decl, DeclContext;
8588
def Export : Decl, DeclContext;
@@ -89,7 +92,7 @@ def AccessSpec : Decl;
8992
def Friend : Decl;
9093
def FriendTemplate : Decl;
9194
def StaticAssert : Decl;
92-
def Block : Decl, DeclContext;
95+
def Block : Decl<"blocks">, DeclContext;
9396
def Captured : Decl, DeclContext;
9497
def ClassScopeFunctionSpecialization : Decl;
9598
def Import : Decl;

include/clang/Basic/DiagnosticSemaKinds.td

+5-34
Original file line numberDiff line numberDiff line change
@@ -2799,55 +2799,26 @@ def err_ifunc_resolver_return : Error<
27992799
"ifunc resolver function must return a pointer">;
28002800
def err_ifunc_resolver_params : Error<
28012801
"ifunc resolver function must have no parameters">;
2802+
def warn_attribute_wrong_decl_type_str : Warning<
2803+
"%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
2804+
def err_attribute_wrong_decl_type_str : Error<
2805+
warn_attribute_wrong_decl_type_str.Text>;
28022806
def warn_attribute_wrong_decl_type : Warning<
28032807
"%0 attribute only applies to %select{"
28042808
"functions"
28052809
"|unions"
28062810
"|variables and functions"
2807-
"|functions and global variables"
2808-
"|functions, variables, and Objective-C interfaces"
28092811
"|functions and methods"
2810-
"|parameters"
28112812
"|functions, methods and blocks"
2812-
"|functions, methods, and classes"
28132813
"|functions, methods, and parameters"
2814-
"|functions, methods, and global variables"
2815-
"|classes"
2816-
"|enums"
28172814
"|variables"
2818-
"|methods"
2819-
"|fields and global variables"
2820-
"|structs"
2821-
"|parameters and typedefs"
2822-
"|variables and typedefs"
2823-
"|thread-local variables"
28242815
"|variables and fields"
28252816
"|variables, data members and tag types"
28262817
"|types and namespaces"
2827-
"|Objective-C interfaces"
2828-
"|methods and properties"
2829-
"|functions, methods, and properties"
2830-
"|struct or union"
2831-
"|struct, union or class"
2832-
"|types"
2833-
"|Objective-C instance methods"
2834-
"|init methods of interface or class extension declarations"
28352818
"|variables, functions and classes"
2836-
"|functions, variables, classes, and Objective-C interfaces"
2837-
"|Objective-C protocols"
2838-
"|variables with static or thread storage duration"
2839-
"|functions, methods, properties, and global variables"
2840-
"|structs, unions, and typedefs"
2841-
"|structs and typedefs"
2842-
"|interface or protocol declarations"
28432819
"|kernel functions"
28442820
"|non-K&R-style functions"
2845-
"|variables, enums, fields and typedefs"
2846-
"|functions, methods, enums, and classes"
2847-
"|structs, classes, variables, functions, and inline namespaces"
2848-
"|variables, functions, methods, types, enumerations, enumerators, labels, and non-static data members"
2849-
"|classes and enumerations"
2850-
"|named declarations}1">,
2821+
"|variables, functions, methods, types, enumerations, enumerators, labels, and non-static data members}1">,
28512822
InGroup<IgnoredAttributes>;
28522823
def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
28532824
def warn_type_attribute_wrong_type : Warning<

include/clang/Sema/AttributeList.h

-33
Original file line numberDiff line numberDiff line change
@@ -900,50 +900,17 @@ enum AttributeDeclKind {
900900
ExpectedFunction,
901901
ExpectedUnion,
902902
ExpectedVariableOrFunction,
903-
ExpectedFunctionOrGlobalVar,
904-
ExpectedFunctionVariableOrObjCInterface,
905903
ExpectedFunctionOrMethod,
906-
ExpectedParameter,
907904
ExpectedFunctionMethodOrBlock,
908-
ExpectedFunctionMethodOrClass,
909905
ExpectedFunctionMethodOrParameter,
910-
ExpectedFunctionMethodOrGlobalVar,
911-
ExpectedClass,
912-
ExpectedEnum,
913906
ExpectedVariable,
914-
ExpectedMethod,
915-
ExpectedFieldOrGlobalVar,
916-
ExpectedStruct,
917-
ExpectedParameterOrTypedef,
918-
ExpectedVariableOrTypedef,
919-
ExpectedTLSVar,
920907
ExpectedVariableOrField,
921908
ExpectedVariableFieldOrTag,
922909
ExpectedTypeOrNamespace,
923-
ExpectedObjectiveCInterface,
924-
ExpectedMethodOrProperty,
925-
ExpectedFunctionOrMethodOrProperty,
926-
ExpectedStructOrUnion,
927-
ExpectedStructOrUnionOrClass,
928-
ExpectedType,
929-
ExpectedObjCInstanceMethod,
930-
ExpectedObjCInterfaceDeclInitMethod,
931910
ExpectedFunctionVariableOrClass,
932-
ExpectedFunctionVariableClassOrObjCInterface,
933-
ExpectedObjectiveCProtocol,
934-
ExpectedStaticOrTLSVar,
935-
ExpectedFunctionGlobalVarMethodOrProperty,
936-
ExpectedStructOrUnionOrTypedef,
937-
ExpectedStructOrTypedef,
938-
ExpectedObjectiveCInterfaceOrProtocol,
939911
ExpectedKernelFunction,
940912
ExpectedFunctionWithProtoType,
941-
ExpectedVariableEnumFieldOrTypedef,
942-
ExpectedFunctionMethodEnumOrClass,
943-
ExpectedStructClassVariableFunctionOrInlineNamespace,
944913
ExpectedForMaybeUnused,
945-
ExpectedEnumOrClass,
946-
ExpectedNamedDecl,
947914
};
948915

949916
} // end namespace clang

test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
[[carries_dependency]] void f1(); // FIXME: warn here
88
[[carries_dependency]] int f2(); // ok
99
int f3(int param [[carries_dependency]]); // ok
10-
[[carries_dependency]] int (*f4)(); // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
11-
int (*f5 [[carries_dependency]])(); // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
10+
[[carries_dependency]] int (*f4)(); // expected-error {{'carries_dependency' attribute only applies to parameters, Objective-C methods, and functions}}
11+
int (*f5 [[carries_dependency]])(); // expected-error {{'carries_dependency' attribute only applies to}}
1212
int (*f6)() [[carries_dependency]]; // expected-error {{'carries_dependency' attribute cannot be applied to types}}
1313
int (*f7)(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}}
1414
int (((f8)))(int n [[carries_dependency]]); // ok
@@ -21,7 +21,7 @@ struct S {
2121
};
2222
void f() {
2323
[[carries_dependency]] int f(int n [[carries_dependency]]); // ok
24-
[[carries_dependency]] // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
24+
[[carries_dependency]] // expected-error {{'carries_dependency' attribute only applies to}}
2525
int (*p)(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}}
2626
}
2727

test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ struct [[nodiscard("Wrong")]] S3 {}; // expected-error {{'nodiscard' cannot have
77
[[nodiscard]] int f();
88
enum [[nodiscard]] E {};
99

10-
namespace [[nodiscard]] N {} // expected-warning {{'nodiscard' attribute only applies to functions, methods, enums, and classes}}
10+
namespace [[nodiscard]] N {} // expected-warning {{'nodiscard' attribute only applies to Objective-C methods, enums, structs, unions, classes, functions, and function pointers}}

test/CodeGenObjC/objc-asm-attribute-neg-test.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ @protocol Protocol
77

88
__attribute__((objc_runtime_name("MySecretNamespace.Message")))
99
@interface Message <Protocol> {
10-
__attribute__((objc_runtime_name("MySecretNamespace.Message"))) // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}}
10+
__attribute__((objc_runtime_name("MySecretNamespace.Message"))) // expected-error {{'objc_runtime_name' attribute only applies to Objective-C interfaces and Objective-C protocols}}
1111
id MyIVAR;
1212
}
1313
__attribute__((objc_runtime_name("MySecretNamespace.Message")))
1414
@property int MyProperty; // expected-error {{prefix attribute must be followed by an interface or protocol}}}}
1515

16-
- (int) getMyProperty __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}}
16+
- (int) getMyProperty __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to}}
1717

18-
- (void) setMyProperty : (int) arg __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}}
18+
- (void) setMyProperty : (int) arg __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to}}
1919

2020
@end
2121

test/Misc/pragma-attribute-supported-attributes-list.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@
6767
// CHECK-NEXT: Target (SubjectMatchRule_function)
6868
// CHECK-NEXT: TestTypestate (SubjectMatchRule_function_is_member)
6969
// CHECK-NEXT: WarnUnusedResult (SubjectMatchRule_objc_method, SubjectMatchRule_enum, SubjectMatchRule_record, SubjectMatchRule_hasType_functionType)
70-
// CHECK-NEXT: XRayInstrument (SubjectMatchRule_function_is_member, SubjectMatchRule_objc_method, SubjectMatchRule_function)
71-
// CHECK-NEXT: XRayLogArgs (SubjectMatchRule_function_is_member, SubjectMatchRule_objc_method, SubjectMatchRule_function)
70+
// CHECK-NEXT: XRayInstrument (SubjectMatchRule_function, SubjectMatchRule_objc_method)
71+
// CHECK-NEXT: XRayLogArgs (SubjectMatchRule_function, SubjectMatchRule_objc_method)

test/Parser/MicrosoftExtensions.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct __declspec(uuid("0000000-0000-0000-Z234-000000000047")) uuid_attr_bad4 {
5151
struct __declspec(uuid("000000000000-0000-1234-000000000047")) uuid_attr_bad5 { };// expected-error {{uuid attribute contains a malformed GUID}}
5252
[uuid("000000000000-0000-1234-000000000047")] struct uuid_attr_bad6 { };// expected-error {{uuid attribute contains a malformed GUID}}
5353

54-
__declspec(uuid("000000A0-0000-0000-C000-000000000046")) int i; // expected-warning {{'uuid' attribute only applies to classes}}
54+
__declspec(uuid("000000A0-0000-0000-C000-000000000046")) int i; // expected-warning {{'uuid' attribute only applies to structs, unions, classes, and enums}}
5555

5656
struct __declspec(uuid("000000A0-0000-0000-C000-000000000046"))
5757
struct_with_uuid { };
@@ -69,7 +69,7 @@ enum __declspec(uuid("000000A0-0000-0000-C000-000000000046"))
6969
enum_with_uuid { };
7070
enum enum_without_uuid { };
7171

72-
int __declspec(uuid("000000A0-0000-0000-C000-000000000046")) inappropriate_uuid; // expected-warning {{'uuid' attribute only applies to classes and enumerations}}
72+
int __declspec(uuid("000000A0-0000-0000-C000-000000000046")) inappropriate_uuid; // expected-warning {{'uuid' attribute only applies to}}
7373

7474
int uuid_sema_test()
7575
{

test/Parser/cxx0x-attributes.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ int v5()[[gnu::unused]]; // expected-warning {{attribute 'unused' ignored}}
307307

308308
[[attribute_declaration]]; // expected-warning {{unknown attribute 'attribute_declaration' ignored}}
309309
[[noreturn]]; // expected-error {{'noreturn' attribute only applies to functions}}
310-
[[carries_dependency]]; // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
310+
[[carries_dependency]]; // expected-error {{'carries_dependency' attribute only applies to parameters, Objective-C methods, and functions}}
311311

312312
class A {
313313
A([[gnu::unused]] int a);

test/Parser/ms-square-bracket-attributes.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void use_it() {
133133
(void)__uuidof(OuterClass::sic);
134134
}
135135

136-
// expected-warning@+1 {{'uuid' attribute only applies to classes}}
136+
// expected-warning@+1 {{'uuid' attribute only applies to structs, unions, classes, and enums}}
137137
[uuid("000000A0-0000-0000-C000-000000000049")] void f();
138138
}
139139

test/Sema/attr-capabilities.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ typedef union { int a; char* b; } __attribute__((capability("mutex"))) MutexUnio
1111
// Test an invalid capability name
1212
struct __attribute__((capability("wrong"))) IncorrectName {}; // expected-warning {{invalid capability name 'wrong'; capability name must be 'mutex' or 'role'}}
1313

14-
int Test1 __attribute__((capability("test1"))); // expected-error {{'capability' attribute only applies to structs, unions, and typedefs}}
15-
int Test2 __attribute__((shared_capability("test2"))); // expected-error {{'shared_capability' attribute only applies to structs, unions, and typedefs}}
14+
int Test1 __attribute__((capability("test1"))); // expected-error {{'capability' attribute only applies to structs, unions, classes, and typedefs}}
15+
int Test2 __attribute__((shared_capability("test2"))); // expected-error {{'shared_capability' attribute only applies to structs, unions, classes, and typedefs}}
1616
int Test3 __attribute__((acquire_capability("test3"))); // expected-warning {{'acquire_capability' attribute only applies to functions}}
1717
int Test4 __attribute__((try_acquire_capability("test4"))); // expected-error {{'try_acquire_capability' attribute only applies to functions}}
1818
int Test5 __attribute__((release_capability("test5"))); // expected-warning {{'release_capability' attribute only applies to functions}}

test/Sema/attr-disable-tail-calls.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ void __attribute__((naked,disable_tail_calls)) foo2(int a) { // expected-error {
88
__asm__("");
99
}
1010

11-
int g0 __attribute__((disable_tail_calls)); // expected-warning {{'disable_tail_calls' attribute only applies to functions and methods}}
11+
int g0 __attribute__((disable_tail_calls)); // expected-warning {{'disable_tail_calls' attribute only applies to functions and Objective-C methods}}
1212

1313
int foo3(int a) __attribute__((disable_tail_calls("abc"))); // expected-error {{'disable_tail_calls' attribute takes no arguments}}

test/Sema/attr-minsize.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
int foo() __attribute__((__minsize__));
44

5-
int var1 __attribute__((__minsize__)); // expected-error{{'__minsize__' attribute only applies to functions and methods}}
5+
int var1 __attribute__((__minsize__)); // expected-error{{'__minsize__' attribute only applies to functions and Objective-C methods}}

test/Sema/attr-mode.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ typedef unsigned unwind_word __attribute((mode(unwind_word)));
2626

2727
int **__attribute((mode(QI)))* i32; // expected-error{{mode attribute}}
2828

29-
__attribute__((mode(QI))) int invalid_func() { return 1; } // expected-error{{'mode' attribute only applies to variables, enums, fields and typedefs}}
30-
enum invalid_enum { A1 __attribute__((mode(QI))) }; // expected-error{{'mode' attribute only applies to variables, enums, fields and typedefs}}
29+
__attribute__((mode(QI))) int invalid_func() { return 1; } // expected-error{{'mode' attribute only applies to variables, enums, typedefs, and non-static data members}}
30+
enum invalid_enum { A1 __attribute__((mode(QI))) }; // expected-error{{'mode' attribute only applies to}}
3131

3232
typedef _Complex double c32 __attribute((mode(SC)));
3333
int c32_test[sizeof(c32) == 8 ? 1 : -1];

test/Sema/attr-nodebug.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
int a __attribute__((nodebug));
44

5-
void b(int p __attribute__((nodebug))) { // expected-warning {{'nodebug' attribute only applies to variables and functions}}
5+
void b(int p __attribute__((nodebug))) { // expected-warning {{'nodebug' attribute only applies to functions, function pointers, Objective-C methods, and variables and functions}}
66
int b __attribute__((nodebug));
77
}
88

test/Sema/attr-section.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ int y __attribute__((section(
1010

1111
// PR6007
1212
void test() {
13-
__attribute__((section("NEAR,x"))) int n1; // expected-error {{'section' attribute only applies to functions, methods, properties, and global variables}}
13+
__attribute__((section("NEAR,x"))) int n1; // expected-error {{'section' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties}}
1414
__attribute__((section("NEAR,x"))) static int n2; // ok.
1515
}
1616

1717
// pr9356
1818
void __attribute__((section("foo,zed"))) test2(void); // expected-note {{previous attribute is here}}
1919
void __attribute__((section("bar,zed"))) test2(void) {} // expected-warning {{section does not match previous declaration}}
2020

21-
enum __attribute__((section("NEAR,x"))) e { one }; // expected-error {{'section' attribute only applies to functions, methods, properties, and global variables}}
21+
enum __attribute__((section("NEAR,x"))) e { one }; // expected-error {{'section' attribute only applies to}}
2222

2323
extern int a; // expected-note {{previous declaration is here}}
2424
int *b = &a;

0 commit comments

Comments
 (0)