]> granicus.if.org Git - clang/commitdiff
Change the wording of the bad-decl-for-attribute warning and error
authorJohn McCall <rjmccall@apple.com>
Tue, 25 Jan 2011 03:51:08 +0000 (03:51 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 25 Jan 2011 03:51:08 +0000 (03:51 +0000)
to make it clear that we're talking about the declarations and not the types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124175 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
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

index e29d098d82c5765c52c99d49cd1c2268d0a0dfbe..e31842da4e96c357da5c9b09b9542c63846bb5bd 100644 (file)
@@ -1038,17 +1038,17 @@ def err_attribute_weakref_without_alias : Error<
 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<
index ac136cb2983bf41696f29f2c36866c4a7b2ce94d..eefd132282ff6cef8c9373ee92dda719fea330cc 100644 (file)
@@ -1213,7 +1213,7 @@ typedef NSString* MyStringTy;
 - (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}}
index 441f498668174febf95057a191dd2501a2e08543..72cea70cf2d6ec6f84267ada250d558c277a7754 100644 (file)
@@ -11,7 +11,7 @@ void bar() { return 1; }
 
 // 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
 
index 7f181981f322010252cc166a46a078e69c46e57d..65d1726da1337b7086228dd4fc53fba055339b09 100644 (file)
@@ -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));
 
index 203c2a7300ab440e56a505a41ed07b5c0ec621f4..6865de060266cd31bac9a6dfbc0da77c48e774e0 100644 (file)
@@ -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));
 
index 92dc9007eb1932cd5dcb375b059f1d60c439e475..8c91b65b4f4863b78e7a37a1157a05104db95f69 100644 (file)
@@ -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));
 
index d50f4c09ac850cca87000c9e94e82afbbf0d53db..08388169247e5ae9c0daf2ddec53252f83c3efd1 100644 (file)
@@ -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;
 };
 
index 8e3e626c5d34b136cb8a011623f4312584b8a9a3..2abe0682df9f0872bce1edf46371ea2e0361429b 100644 (file)
@@ -8,8 +8,8 @@ int __attribute__((weak_import)) g4(void);
 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}}
 
index 3dfbbcbe281cb42311a4c2b07023ad6a99542464..2decebbd284ace1621fcf9885d4ee1eb7d5e64db 100644 (file)
@@ -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)}}
index eea2f6fe9637a1968f516988824f213b8bea70eb..f09e3cf69ab5f2b96e0f11d4564716412c23405a 100644 (file)
@@ -10,9 +10,9 @@ void __attribute__((dllimport, dllexport)) foo4(); // expected-warning{{dllimpor
 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(dllimport) __declspec(dllexport) foo10(); // expected-warning{{d
 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}}
index 4c092739676398c0ab8a3eb3e1dc03ea87076ee0..ed0ef89db70bf50c643339e4f12e48b057cae93b 100644 (file)
@@ -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)));
index 760e3cf8d30bd5ba9c89d710dc470af87e598e06..9949887b23e74ca91251e44bb73266580e31db46 100644 (file)
@@ -95,7 +95,7 @@ int t6() {
   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));
index b406a77e044c055de6ab2fb5c52d0951e94c3bc2..5d36e9af195bb2f92bf837299f6762c55f9ed91c 100644 (file)
@@ -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));
index 264e7a8179dab1f782e823881f426ef468170704..98dff3aa7a7beaba6bc4ab54313bdff30db7869c 100644 (file)
@@ -9,9 +9,9 @@ extern void fc1 (const NSString *) __attribute__((format_arg));  // expected-err
 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)}}