Skip to content

Commit 1805298

Browse files
committed
Fix mismatched enum value name and diagnostic text.
ExpectedFunctionGlobalVarMethodOrProperty would previously say "functions and global variables" instead of "functions, methods, properties, and global variables" The newly added ExpectedFunctionOrGlobalVariable says "functions and global variables" Differential Revision: https://reviews.llvm.org/D26459 llvm-svn: 286599
1 parent a6ccd19 commit 1805298

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ def Alias : Attr {
382382
let Spellings = [GCC<"alias">];
383383
let Args = [StringArgument<"Aliasee">];
384384
let Subjects = SubjectList<[Function, GlobalVar], ErrorDiag,
385-
"ExpectedFunctionGlobalVarMethodOrProperty">;
385+
"ExpectedFunctionOrGlobalVar">;
386386
let Documentation = [Undocumented];
387387
}
388388

@@ -1746,7 +1746,7 @@ def NoSanitizeSpecific : InheritableAttr {
17461746
GCC<"no_sanitize_thread">,
17471747
GNU<"no_sanitize_memory">];
17481748
let Subjects = SubjectList<[Function, GlobalVar], ErrorDiag,
1749-
"ExpectedFunctionGlobalVarMethodOrProperty">;
1749+
"ExpectedFunctionOrGlobalVar">;
17501750
let Documentation = [NoSanitizeAddressDocs, NoSanitizeThreadDocs,
17511751
NoSanitizeMemoryDocs];
17521752
let ASTNode = 0;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2599,6 +2599,7 @@ def warn_attribute_wrong_decl_type : Warning<
25992599
"functions"
26002600
"|unions"
26012601
"|variables and functions"
2602+
"|functions and global variables"
26022603
"|functions, variables, and Objective-C interfaces"
26032604
"|functions and methods"
26042605
"|parameters"
@@ -2629,7 +2630,7 @@ def warn_attribute_wrong_decl_type : Warning<
26292630
"|functions, variables, classes, and Objective-C interfaces"
26302631
"|Objective-C protocols"
26312632
"|variables with static or thread storage duration"
2632-
"|functions and global variables"
2633+
"|functions, methods, properties, and global variables"
26332634
"|structs, unions, and typedefs"
26342635
"|structs and typedefs"
26352636
"|interface or protocol declarations"

clang/include/clang/Sema/AttributeList.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@ enum AttributeDeclKind {
885885
ExpectedFunction,
886886
ExpectedUnion,
887887
ExpectedVariableOrFunction,
888+
ExpectedFunctionOrGlobalVar,
888889
ExpectedFunctionVariableOrObjCInterface,
889890
ExpectedFunctionOrMethod,
890891
ExpectedParameter,

clang/test/Sema/attr-section.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ 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 and global variables}}
13+
__attribute__((section("NEAR,x"))) int n1; // expected-error {{'section' attribute only applies to functions, methods, properties, and global variables}}
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 and global variables}}
21+
enum __attribute__((section("NEAR,x"))) e { one }; // expected-error {{'section' attribute only applies to functions, methods, properties, and global variables}}

0 commit comments

Comments
 (0)