Pretty up the wrong-number-of-arguments-for-attribute diagnostic by
using a custom plural form.  Split out the range diagnostics as their
own message.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126840 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/annotate.c b/test/Sema/annotate.c
index 4d55075..6f81491 100644
--- a/test/Sema/annotate.c
+++ b/test/Sema/annotate.c
@@ -3,5 +3,5 @@
 void __attribute__((annotate("foo"))) foo(float *a) { 
   __attribute__((annotate("bar"))) int x;
   __attribute__((annotate(1))) int y; // expected-error {{argument to annotate attribute was not a string literal}}
-  __attribute__((annotate("bar", 1))) int z; // expected-error {{attribute requires 1 argument(s)}}
+  __attribute__((annotate("bar", 1))) int z; // expected-error {{attribute takes one argument}}
 }
diff --git a/test/Sema/attr-cleanup.c b/test/Sema/attr-cleanup.c
index 9057c27..59ebbfc 100644
--- a/test/Sema/attr-cleanup.c
+++ b/test/Sema/attr-cleanup.c
@@ -8,8 +8,8 @@
 
 void t1()
 {
-    int v1 __attribute((cleanup)); // expected-error {{attribute requires 1 argument(s)}}
-    int v2 __attribute((cleanup(1, 2))); // expected-error {{attribute requires 1 argument(s)}}
+    int v1 __attribute((cleanup)); // expected-error {{attribute takes one argument}}
+    int v2 __attribute((cleanup(1, 2))); // expected-error {{attribute takes one argument}}
     
     static int v3 __attribute((cleanup(c1))); // expected-warning {{cleanup attribute ignored}}
     
diff --git a/test/Sema/attr-naked.c b/test/Sema/attr-naked.c
index 65d1726..1ebd784 100644
--- a/test/Sema/attr-naked.c
+++ b/test/Sema/attr-naked.c
@@ -4,5 +4,5 @@
 
 void t1() __attribute__((naked));
 
-void t2() __attribute__((naked(2))); // expected-error {{attribute requires 0 argument(s)}}
+void t2() __attribute__((naked(2))); // expected-error {{attribute takes no arguments}}
 
diff --git a/test/Sema/attr-nodebug.c b/test/Sema/attr-nodebug.c
index 6865de0..a66e961 100644
--- a/test/Sema/attr-nodebug.c
+++ b/test/Sema/attr-nodebug.c
@@ -4,5 +4,5 @@
 
 void t1() __attribute__((nodebug));
 
-void t2() __attribute__((nodebug(2))); // expected-error {{attribute requires 0 argument(s)}}
+void t2() __attribute__((nodebug(2))); // expected-error {{attribute takes no arguments}}
 
diff --git a/test/Sema/attr-noinline.c b/test/Sema/attr-noinline.c
index 8c91b65..dfc88a8 100644
--- a/test/Sema/attr-noinline.c
+++ b/test/Sema/attr-noinline.c
@@ -4,5 +4,5 @@
 
 void t1() __attribute__((noinline));
 
-void t2() __attribute__((noinline(2))); // expected-error {{attribute requires 0 argument(s)}}
+void t2() __attribute__((noinline(2))); // expected-error {{attribute takes no arguments}}
 
diff --git a/test/Sema/attr-noreturn.c b/test/Sema/attr-noreturn.c
index 5333a2c..5c643ff 100644
--- a/test/Sema/attr-noreturn.c
+++ b/test/Sema/attr-noreturn.c
@@ -13,7 +13,7 @@
 
 int g0 __attribute__((noreturn)); // expected-warning {{'noreturn' only applies to function types; type here is 'int'}}
 
-int f2() __attribute__((noreturn(1, 2))); // expected-error {{attribute requires 0 argument(s)}}
+int f2() __attribute__((noreturn(1, 2))); // expected-error {{attribute takes no arguments}}
 
 void f3() __attribute__((noreturn));
 void f3() {
@@ -41,4 +41,4 @@
   x();
 }
 
-typedef void (*Fun)(void) __attribute__ ((noreturn(2))); // expected-error {{attribute requires 0 argument(s)}}
+typedef void (*Fun)(void) __attribute__ ((noreturn(2))); // expected-error {{attribute takes no arguments}}
diff --git a/test/Sema/attr-regparm.c b/test/Sema/attr-regparm.c
index 4049e0e..642c07e 100644
--- a/test/Sema/attr-regparm.c
+++ b/test/Sema/attr-regparm.c
@@ -4,7 +4,7 @@
 __attribute((regparm(1.0))) int x1(void); // expected-error{{'regparm' attribute requires integer constant}}
 __attribute((regparm(-1))) int x2(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
 __attribute((regparm(5))) int x3(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
-__attribute((regparm(5,3))) int x4(void); // expected-error{{attribute requires 1 argument(s)}}
+__attribute((regparm(5,3))) int x4(void); // expected-error{{attribute takes one argument}}
 
 void __attribute__((regparm(3))) x5(int);
 void x5(int); // expected-note{{previous declaration is here}}
diff --git a/test/Sema/attr-unused.c b/test/Sema/attr-unused.c
index 6a7ea95..07c65cb 100644
--- a/test/Sema/attr-unused.c
+++ b/test/Sema/attr-unused.c
@@ -9,7 +9,7 @@
 
 int g0 __attribute__((unused));
 
-int f2() __attribute__((unused(1, 2))); // expected-error {{attribute requires 0 argument(s)}}
+int f2() __attribute__((unused(1, 2))); // expected-error {{attribute takes no arguments}}
 
 struct Test0_unused {} __attribute__((unused));
 struct Test0_not_unused {};
diff --git a/test/Sema/callingconv.c b/test/Sema/callingconv.c
index 92a2057..25669f0 100644
--- a/test/Sema/callingconv.c
+++ b/test/Sema/callingconv.c
@@ -6,7 +6,7 @@
 void __attribute__((stdcall)) bar(float *a) { 
 }
 
-void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{attribute requires 0 argument(s)}}
+void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{attribute takes no arguments}}
 }
 
 void __attribute__((fastcall)) test0() { // expected-error {{function with no prototype cannot use fastcall calling convention}}
@@ -20,7 +20,7 @@
 
 void __attribute__((cdecl)) ctest0() {}
 
-void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{attribute requires 0 argument(s)}}
+void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{attribute takes no arguments}}
 
 void (__attribute__((fastcall)) *pfoo)(float*) = foo;
 
diff --git a/test/Sema/constructor-attribute.c b/test/Sema/constructor-attribute.c
index 2decebb..3825916 100644
--- a/test/Sema/constructor-attribute.c
+++ b/test/Sema/constructor-attribute.c
@@ -3,13 +3,13 @@
 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,2))); // expected-error {{attribute takes no more than 1 argument}}
 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 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)}}
+int f() __attribute__((destructor(1,2))); // expected-error {{attribute takes no more than 1 argument}}
 int f() __attribute__((destructor(1.0))); // expected-error {{'destructor' attribute requires parameter 1 to be an integer constant}}
 
 
diff --git a/test/Sema/neon-vector-types.c b/test/Sema/neon-vector-types.c
index 1f50177..cbf0133 100644
--- a/test/Sema/neon-vector-types.c
+++ b/test/Sema/neon-vector-types.c
@@ -16,7 +16,7 @@
 typedef __attribute__((neon_polyvector_type(8)))  poly16_t poly16x8_t;
 
 // The attributes must have a single argument.
-typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{attribute requires 1 argument(s)}}
+typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{attribute takes one argument}}
 
 // The number of elements must be an ICE.
 typedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{attribute requires integer constant}}
diff --git a/test/Sema/sentinel-attribute.c b/test/Sema/sentinel-attribute.c
index ed0ef89..e5cbf6e 100644
--- a/test/Sema/sentinel-attribute.c
+++ b/test/Sema/sentinel-attribute.c
@@ -5,7 +5,7 @@
 void f2(int a, ...) __attribute__ ((sentinel(1)));
 
 void f3(int a, ...) __attribute__ ((sentinel("hello"))); //expected-error{{'sentinel' attribute requires parameter 1 to be an integer constant}}
-void f4(int a, ...) __attribute__ ((sentinel(1, 2, 3))); //expected-error{{attribute requires 0, 1 or 2 argument(s)}}
+void f4(int a, ...) __attribute__ ((sentinel(1, 2, 3))); //expected-error{{attribute takes no more than 2 arguments}}
 void f4(int a, ...) __attribute__ ((sentinel(-1))); //expected-error{{parameter 1 less than zero}}
 void f4(int a, ...) __attribute__ ((sentinel(0, 2))); // expected-error{{parameter 2 not 0 or 1}}
 
diff --git a/test/SemaCXX/init-priority-attr.cpp b/test/SemaCXX/init-priority-attr.cpp
index 7605ee6..6facebf 100644
--- a/test/SemaCXX/init-priority-attr.cpp
+++ b/test/SemaCXX/init-priority-attr.cpp
@@ -19,7 +19,7 @@
 
 Two foo __attribute__((init_priority(101))) ( 5, 6 );
 
-Two goo __attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{attribute requires 1 argument(s)}}
+Two goo __attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{attribute takes one argument}}
 
 Two coo[2]  __attribute__((init_priority(3)));	// expected-error {{init_priority attribute requires integer constant between 101 and 65535 inclusive}}
 
diff --git a/test/SemaObjC/attr-objc-gc.m b/test/SemaObjC/attr-objc-gc.m
index 47da653..fd81855 100644
--- a/test/SemaObjC/attr-objc-gc.m
+++ b/test/SemaObjC/attr-objc-gc.m
@@ -4,5 +4,5 @@
 
 static id __attribute((objc_gc())) c; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}}
 static id __attribute((objc_gc(123))) d; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}}
-static id __attribute((objc_gc(foo, 456))) e; // expected-error{{attribute requires 1 argument(s)}}
+static id __attribute((objc_gc(foo, 456))) e; // expected-error{{attribute takes one argument}}
 static id __attribute((objc_gc(hello))) f; // expected-warning{{'objc_gc' attribute argument not supported: 'hello'}}
diff --git a/test/SemaObjC/format-arg-attribute.m b/test/SemaObjC/format-arg-attribute.m
index 98dff3a..6edb8fd 100644
--- a/test/SemaObjC/format-arg-attribute.m
+++ b/test/SemaObjC/format-arg-attribute.m
@@ -5,16 +5,16 @@
 extern NSString *fa2 (const NSString *) __attribute__((format_arg(1)));
 extern NSString *fa3 (NSString *) __attribute__((format_arg(1)));
 
-extern void fc1 (const NSString *) __attribute__((format_arg));  // expected-error {{attribute requires 1 argument(s)}}
-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)}}
+extern void fc1 (const NSString *) __attribute__((format_arg));  // expected-error {{attribute takes one argument}}
+extern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{attribute takes one argument}}
+extern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{attribute takes one argument}}
 
 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)}}
+extern NSString *ff4 (const NSString *) __attribute__((format_arg(foo))); // expected-error {{attribute takes one argument}}
 
 /* format_arg formats must take and return a string.  */
 extern NSString *fi0 (int) __attribute__((format_arg(1)));  // expected-error {{format argument not a string type}}
diff --git a/test/SemaObjC/iboutletcollection-attr.m b/test/SemaObjC/iboutletcollection-attr.m
index 217daa7..5c82c83 100644
--- a/test/SemaObjC/iboutletcollection-attr.m
+++ b/test/SemaObjC/iboutletcollection-attr.m
@@ -16,13 +16,13 @@
 
 typedef void *PV;
 @interface BAD {
-    __attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute requires 1 argument(s)}}
+    __attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute takes one argument}}
     __attribute__((iboutletcollection(B))) id ivar2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
     __attribute__((iboutletcollection(PV))) id ivar3; // expected-error {{invalid type 'PV' as argument of iboutletcollection attribute}}
     __attribute__((iboutletcollection(PV))) void *ivar4; // expected-error {{ivar with iboutletcollection attribute must have object type (invalid 'void *')}}
     __attribute__((iboutletcollection(int))) id ivar5; // expected-error {{type argument of iboutletcollection attribute cannot be a builtin type}}
 }
-@property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute requires 1 argument(s)}}
+@property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute takes one argument}}
 @property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
 
 @property __attribute__((iboutletcollection(BAD))) int prop3; // expected-error {{property with iboutletcollection attribute must have object type (invalid 'int')}}
diff --git a/test/SemaObjC/method-sentinel-attr.m b/test/SemaObjC/method-sentinel-attr.m
index 5375408..274e936 100644
--- a/test/SemaObjC/method-sentinel-attr.m
+++ b/test/SemaObjC/method-sentinel-attr.m
@@ -13,7 +13,7 @@
 - (void) foo8 : (int)x, ... __attribute__ ((__sentinel__("a")));  // expected-error {{'sentinel' attribute requires parameter 1 to be an integer constant}}
 - (void) foo9 : (int)x, ... __attribute__ ((__sentinel__(-1)));  // expected-error {{'sentinel' parameter 1 less than zero}}
 - (void) foo10 : (int)x, ... __attribute__ ((__sentinel__(1,1)));
-- (void) foo11 : (int)x, ... __attribute__ ((__sentinel__(1,1,3)));  // expected-error {{attribute requires 0, 1 or 2 argument(s)}}
+- (void) foo11 : (int)x, ... __attribute__ ((__sentinel__(1,1,3)));  // expected-error {{attribute takes no more than 2 arguments}}
 - (void) foo12 : (int)x, ... ATTR; // expected-note {{method has been explicitly marked sentinel here}}
 
 // rdar://7975788