[cfe-commits] r124175 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td test/Analysis/retain-release.m test/Rewriter/dllimport-typedef.c test/Sema/attr-naked.c test/Sema/attr-nodebug.c test/Sema/attr-noinline.c test/Sema/attr-used.c test/Sema/attr-weak.c test/Sema/constructor-attribute.c test/Sema/dllimport-dllexport.c test/Sema/sentinel-attribute.c test/Sema/unused-expr.c test/Sema/x86-attr-force-align-arg-pointer.c test/SemaObjC/format-arg-attribute.m
John McCall
rjmccall at apple.com
Mon Jan 24 19:51:08 PST 2011
Author: rjmccall
Date: Mon Jan 24 21:51:08 2011
New Revision: 124175
URL: http://llvm.org/viewvc/llvm-project?rev=124175&view=rev
Log:
Change the wording of the bad-decl-for-attribute warning and error
to make it clear that we're talking about the declarations and not the types.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/Analysis/retain-release.m
cfe/trunk/test/Rewriter/dllimport-typedef.c
cfe/trunk/test/Sema/attr-naked.c
cfe/trunk/test/Sema/attr-nodebug.c
cfe/trunk/test/Sema/attr-noinline.c
cfe/trunk/test/Sema/attr-used.c
cfe/trunk/test/Sema/attr-weak.c
cfe/trunk/test/Sema/constructor-attribute.c
cfe/trunk/test/Sema/dllimport-dllexport.c
cfe/trunk/test/Sema/sentinel-attribute.c
cfe/trunk/test/Sema/unused-expr.c
cfe/trunk/test/Sema/x86-attr-force-align-arg-pointer.c
cfe/trunk/test/SemaObjC/format-arg-attribute.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jan 24 21:51:08 2011
@@ -1038,17 +1038,17 @@
def err_alias_not_supported_on_darwin : Error <
"only weak aliases are supported on darwin">;
def warn_attribute_wrong_decl_type : Warning<
- "%0 attribute only applies to %select{function|union|"
- "variable and function|function or method|parameter|"
- "parameter or Objective-C method|function, method or block|"
- "virtual method or class|function, method, or parameter|class|virtual method"
- "|member|variable|method}1 types">;
+ "%0 attribute only applies to %select{functions|unions|"
+ "variables and functions|functions and methods|parameters|"
+ "parameters and methods|functions, methods and blocks|"
+ "classes and virtual methods|functions, methods, and parameters|"
+ "classes|virtual methods|class members|variables|methods}1">;
def err_attribute_wrong_decl_type : Error<
- "%0 attribute only applies to %select{function|union|"
- "variable and function|function or method|parameter|"
- "parameter or Objective-C method|function, method or block|"
- "virtual method or class|function, method, or parameter|class|virtual method"
- "|member|variable|method}1 types">;
+ "%0 attribute only applies to %select{functions|unions|"
+ "variables and functions|functions and methods|parameters|"
+ "parameters and methods|functions, methods and blocks|"
+ "classes and virtual methods|functions, methods, and parameters|"
+ "classes|virtual methods|class members|variables|methods}1">;
def warn_function_attribute_wrong_type : Warning<
"%0 only applies to function types; type here is %1">;
def warn_gnu_inline_attribute_requires_inline : Warning<
Modified: cfe/trunk/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/retain-release.m (original)
+++ cfe/trunk/test/Analysis/retain-release.m Mon Jan 24 21:51:08 2011
@@ -1213,7 +1213,7 @@
- (int) returnsAnOwnedInt NS_RETURNS_RETAINED; // expected-warning{{'ns_returns_retained' attribute only applies to methods that return an Objective-C object}}
@end
-static int ownership_attribute_doesnt_go_here NS_RETURNS_RETAINED; // expected-warning{{'ns_returns_retained' attribute only applies to function or method types}}
+static int ownership_attribute_doesnt_go_here NS_RETURNS_RETAINED; // expected-warning{{'ns_returns_retained' attribute only applies to functions and methods}}
void test_attr_1(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}}
Modified: cfe/trunk/test/Rewriter/dllimport-typedef.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/dllimport-typedef.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/dllimport-typedef.c (original)
+++ cfe/trunk/test/Rewriter/dllimport-typedef.c Mon Jan 24 21:51:08 2011
@@ -11,7 +11,7 @@
// CHECK-NEG: error: void function 'bar' should not return a value
// CHECK-NEG: 1 error generated
-// CHECK-POS: warning: 'dllimport' attribute only applies to variable and function type
+// CHECK-POS: warning: 'dllimport' attribute only applies to variables and functions
// CHECK-POS: error: void function 'bar' should not return a value
// CHECK-POS: 1 warning and 1 error generated
Modified: cfe/trunk/test/Sema/attr-naked.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-naked.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-naked.c (original)
+++ cfe/trunk/test/Sema/attr-naked.c Mon Jan 24 21:51:08 2011
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
-int a __attribute__((naked)); // expected-warning {{'naked' attribute only applies to function types}}
+int a __attribute__((naked)); // expected-warning {{'naked' attribute only applies to functions}}
void t1() __attribute__((naked));
Modified: cfe/trunk/test/Sema/attr-nodebug.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-nodebug.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-nodebug.c (original)
+++ cfe/trunk/test/Sema/attr-nodebug.c Mon Jan 24 21:51:08 2011
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
-int a __attribute__((nodebug)); // expected-warning {{'nodebug' attribute only applies to function types}}
+int a __attribute__((nodebug)); // expected-warning {{'nodebug' attribute only applies to functions}}
void t1() __attribute__((nodebug));
Modified: cfe/trunk/test/Sema/attr-noinline.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-noinline.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-noinline.c (original)
+++ cfe/trunk/test/Sema/attr-noinline.c Mon Jan 24 21:51:08 2011
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
-int a __attribute__((noinline)); // expected-warning {{'noinline' attribute only applies to function types}}
+int a __attribute__((noinline)); // expected-warning {{'noinline' attribute only applies to functions}}
void t1() __attribute__((noinline));
Modified: cfe/trunk/test/Sema/attr-used.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-used.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-used.c (original)
+++ cfe/trunk/test/Sema/attr-used.c Mon Jan 24 21:51:08 2011
@@ -3,7 +3,7 @@
extern int l0 __attribute__((used)); // expected-warning {{used attribute ignored}}
__private_extern__ int l1 __attribute__((used)); // expected-warning {{used attribute ignored}}
-struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variable and function types}}
+struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variables and functions}}
int x;
};
Modified: cfe/trunk/test/Sema/attr-weak.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-weak.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-weak.c (original)
+++ cfe/trunk/test/Sema/attr-weak.c Mon Jan 24 21:51:08 2011
@@ -8,8 +8,8 @@
void __attribute__((weak_import)) g5(void) {
}
-struct __attribute__((weak)) s0 {}; // expected-warning {{'weak' attribute only applies to variable and function types}}
-struct __attribute__((weak_import)) s1 {}; // expected-warning {{'weak_import' attribute only applies to variable and function types}}
+struct __attribute__((weak)) s0 {}; // expected-warning {{'weak' attribute only applies to variables and functions}}
+struct __attribute__((weak_import)) s1 {}; // expected-warning {{'weak_import' attribute only applies to variables and functions}}
static int x __attribute__((weak)); // expected-error {{weak declaration of 'x' must be public}}
Modified: cfe/trunk/test/Sema/constructor-attribute.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/constructor-attribute.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Sema/constructor-attribute.c (original)
+++ cfe/trunk/test/Sema/constructor-attribute.c Mon Jan 24 21:51:08 2011
@@ -1,12 +1,12 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-int x __attribute__((constructor)); // expected-warning {{'constructor' attribute only applies to function types}}
+int x __attribute__((constructor)); // expected-warning {{'constructor' attribute only applies to functions}}
int f() __attribute__((constructor));
int f() __attribute__((constructor(1)));
int f() __attribute__((constructor(1,2))); // expected-error {{attribute requires 0 or 1 argument(s)}}
int f() __attribute__((constructor(1.0))); // expected-error {{'constructor' attribute requires parameter 1 to be an integer constant}}
-int x __attribute__((destructor)); // expected-warning {{'destructor' attribute only applies to function types}}
+int x __attribute__((destructor)); // expected-warning {{'destructor' attribute only applies to functions}}
int f() __attribute__((destructor));
int f() __attribute__((destructor(1)));
int f() __attribute__((destructor(1,2))); // expected-error {{attribute requires 0 or 1 argument(s)}}
Modified: cfe/trunk/test/Sema/dllimport-dllexport.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/dllimport-dllexport.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Sema/dllimport-dllexport.c (original)
+++ cfe/trunk/test/Sema/dllimport-dllexport.c Mon Jan 24 21:51:08 2011
@@ -10,9 +10,9 @@
void __attribute__((dllexport)) foo5();
void __attribute__((dllimport)) foo5(); // expected-warning{{dllimport attribute ignored}}
-typedef int __attribute__((dllexport)) type6; // expected-warning{{'dllexport' attribute only applies to variable and function types}}
+typedef int __attribute__((dllexport)) type6; // expected-warning{{'dllexport' attribute only applies to variables and functions}}
-typedef int __attribute__((dllimport)) type7; // expected-warning{{'dllimport' attribute only applies to variable and function}}
+typedef int __attribute__((dllimport)) type7; // expected-warning{{'dllimport' attribute only applies to variables and functions}}
void __attribute__((dllimport)) foo6();
void foo6(){} // expected-warning {{'foo6' redeclared without dllimport attribute: previous dllimport ignored}}
@@ -28,9 +28,9 @@
void __declspec(dllexport) foo11();
void __declspec(dllimport) foo11(); // expected-warning{{dllimport attribute ignored}}
-typedef int __declspec(dllexport) type1; // expected-warning{{'dllexport' attribute only applies to variable and function types}}
+typedef int __declspec(dllexport) type1; // expected-warning{{'dllexport' attribute only applies to variables and functions}}
-typedef int __declspec(dllimport) type2; // expected-warning{{'dllimport' attribute only applies to variable and function}}
+typedef int __declspec(dllimport) type2; // expected-warning{{'dllimport' attribute only applies to variables and functions}}
void __declspec(dllimport) foo12();
void foo12(){} // expected-warning {{'foo12' redeclared without dllimport attribute: previous dllimport ignored}}
Modified: cfe/trunk/test/Sema/sentinel-attribute.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/sentinel-attribute.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Sema/sentinel-attribute.c (original)
+++ cfe/trunk/test/Sema/sentinel-attribute.c Mon Jan 24 21:51:08 2011
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-int x __attribute__((sentinel)); //expected-warning{{'sentinel' attribute only applies to function, method or block types}}
+int x __attribute__((sentinel)); //expected-warning{{'sentinel' attribute only applies to functions, methods and blocks}}
void f1(int a, ...) __attribute__ ((sentinel));
void f2(int a, ...) __attribute__ ((sentinel(1)));
Modified: cfe/trunk/test/Sema/unused-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/unused-expr.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Sema/unused-expr.c (original)
+++ cfe/trunk/test/Sema/unused-expr.c Mon Jan 24 21:51:08 2011
@@ -95,7 +95,7 @@
return 0;
}
-int t7 __attribute__ ((warn_unused_result)); // expected-warning {{'warn_unused_result' attribute only applies to function types}}
+int t7 __attribute__ ((warn_unused_result)); // expected-warning {{'warn_unused_result' attribute only applies to functions}}
// PR4010
int (*fn4)(void) __attribute__ ((warn_unused_result));
Modified: cfe/trunk/test/Sema/x86-attr-force-align-arg-pointer.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/x86-attr-force-align-arg-pointer.c?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/Sema/x86-attr-force-align-arg-pointer.c (original)
+++ cfe/trunk/test/Sema/x86-attr-force-align-arg-pointer.c Mon Jan 24 21:51:08 2011
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple i386-apple-darwin10 -fsyntax-only -verify %s
-int a __attribute__((force_align_arg_pointer)); // expected-warning{{attribute only applies to function types}}
+int a __attribute__((force_align_arg_pointer)); // expected-warning{{attribute only applies to functions}}
// It doesn't matter where the attribute is located.
void b(void) __attribute__((force_align_arg_pointer));
Modified: cfe/trunk/test/SemaObjC/format-arg-attribute.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/format-arg-attribute.m?rev=124175&r1=124174&r2=124175&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/format-arg-attribute.m (original)
+++ cfe/trunk/test/SemaObjC/format-arg-attribute.m Mon Jan 24 21:51:08 2011
@@ -9,9 +9,9 @@
extern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{attribute requires 1 argument(s)}}
extern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{attribute requires 1 argument(s)}}
-struct s1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to function types}}
-union u1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to function types}}
-enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to function types}}
+struct s1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
+union u1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
+enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
extern NSString *ff3 (const NSString *) __attribute__((format_arg(3-2)));
extern NSString *ff4 (const NSString *) __attribute__((format_arg(foo))); // expected-error {{attribute requires 1 argument(s)}}
More information about the cfe-commits
mailing list