]> granicus.if.org Git - clang/commitdiff
Fixing a typo, updating the diagnostic wording and logic based on post-commit review...
authorAaron Ballman <aaron@aaronballman.com>
Tue, 15 Apr 2014 00:36:39 +0000 (00:36 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Tue, 15 Apr 2014 00:36:39 +0000 (00:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206229 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticParseKinds.td
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
test/Parser/MicrosoftExtensions.c
test/Parser/cxx0x-attributes.cpp

index 86078027dfc1da5ed42a325a56e7c231c9e0c5a2..0b067842feb4e966a142b5d9707620bf99179e2e 100644 (file)
@@ -527,8 +527,8 @@ def warn_cxx98_compat_attribute : Warning<
   InGroup<CXX98Compat>, DefaultIgnore;
 def err_cxx11_attribute_forbids_arguments : Error<
   "attribute %0 cannot have an argument list">;
-def err_attribute_requires_arguements : Error<
-  "attribute %0 requires a nonempty argument list">;
+def err_attribute_requires_arguments : Error<
+  "parentheses must be omitted if %0 attribute's argument list is empty">;
 def err_cxx11_attribute_forbids_ellipsis : Error<
   "attribute '%0' cannot be used as an attribute pack">;
 def err_cxx11_attribute_repeated : Error<
index 3fa3031ad06f4775ddc23f059d9f6ae7c3c79dcd..07e606c98640023e9822e213dca78d0f1336c525 100644 (file)
@@ -517,7 +517,7 @@ bool Parser::ParseMicrosoftDeclSpecArgs(IdentifierInfo *AttrName,
   // arguments but none were provided, emit a diagnostic.
   const AttributeList *Attr = Attrs.getList();
   if (Attr && Attr->getMaxArgs() && !NumArgs) {
-    Diag(OpenParenLoc, diag::err_attribute_requires_arguements) << AttrName;
+    Diag(OpenParenLoc, diag::err_attribute_requires_arguments) << AttrName;
     return false;
   }
   return true;
index 94d46eff1df9b4c466b7720bf052b9e92405a3ec..be2349985e52963fce3cd7ddb38b8f93b34db25a 100644 (file)
@@ -3254,12 +3254,12 @@ bool Parser::ParseCXX11AttributeArgs(IdentifierInfo *AttrName,
       // parsing an argument list, we need to determine whether this attribute
       // was allowed to have an argument list (such as [[deprecated]]), and how
       // many arguments were parsed (so we can diagnose on [[deprecated()]]).
-      if (Attr->getMaxArgs() && !NumArgs) {
-        // The attribute was allowed to have arguments, but none were provided
-        // even though the attribute parsed successfully. This is an error.
-        Diag(LParenLoc, diag::err_attribute_requires_arguements) << AttrName;
+      if (!NumArgs) {
+        // Diagnose an empty argument list when parenthesis are present.
+        // FIXME: This is a good place for a fixit which removes the parens.
+        Diag(LParenLoc, diag::err_attribute_requires_arguments) << AttrName;
         return false;
-      } else if (!Attr->getMaxArgs()) {
+      } else if (NumArgs && !Attr->getMaxArgs()) {
         // The attribute parsed successfully, but was not allowed to have any
         // arguments. It doesn't matter whether any were provided -- the
         // presence of the argument list (even if empty) is diagnosed.
index 1998703e3d934b171fefd8599888af65686e7e16..badd2049f5c017da9a8659991067b85549abade5 100644 (file)
@@ -104,7 +104,7 @@ struct __declspec("testing") S3 {}; /* expected-warning {{__declspec attribute '
 
 /* declspecs with arguments cannot have an empty argument list, even if the
    arguments are optional. */
-__declspec(deprecated()) void dep_func_test(void); /* expected-error {{attribute 'deprecated' requires a nonempty argument list}} */
+__declspec(deprecated()) void dep_func_test(void); /* expected-error {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}} */
 __declspec(deprecated) void dep_func_test2(void);
 __declspec(deprecated("")) void dep_func_test3(void);
 
index 777a40a4e8ab99ede06d197a09df778d63daae97..f8abc76fb2f3cb584d81868bf3ac6f95f37d9ac8 100644 (file)
@@ -326,6 +326,6 @@ namespace GccASan {
 namespace {
   [[deprecated]] void bar();
   [[deprecated("hello")]] void baz();
-  [[deprecated()]] void foo(); // expected-error {{attribute 'deprecated' requires a nonempty argument list}}
+  [[deprecated()]] void foo(); // expected-error {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}}
   [[gnu::deprecated()]] void quux();
 }