]> granicus.if.org Git - clang/commitdiff
Merging r196387:
authorBill Wendling <isanbard@gmail.com>
Thu, 5 Dec 2013 18:35:37 +0000 (18:35 +0000)
committerBill Wendling <isanbard@gmail.com>
Thu, 5 Dec 2013 18:35:37 +0000 (18:35 +0000)
------------------------------------------------------------------------
r196387 | aaronballman | 2013-12-04 07:32:26 -0800 (Wed, 04 Dec 2013) | 1 line

When parsing ignored attribute arguments, presuming the first argument is an unresolved identifier the same way that we do for unknown arguments. This resolves PR18075, where we regressed the handling of OpenBSD's bounded attribute.
------------------------------------------------------------------------

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

lib/Parse/ParseDecl.cpp
test/Sema/attr-bounded.c [new file with mode: 0644]

index a1c4ccdb6d5092c7ff0cf0f3d1cc06a78c84971a..61b57a1d90772ccd5e149dfc13ff298d096c8f97 100644 (file)
@@ -288,7 +288,8 @@ void Parser::ParseGNUAttributeArgs(IdentifierInfo *AttrName,
 
     // If we don't know how to parse this attribute, but this is the only
     // token in this argument, assume it's meant to be an identifier.
-    if (AttrKind == AttributeList::UnknownAttribute) {
+    if (AttrKind == AttributeList::UnknownAttribute ||
+        AttrKind == AttributeList::IgnoredAttribute) {
       const Token &Next = NextToken();
       IsIdentifierArg = Next.is(tok::r_paren) || Next.is(tok::comma);
     }
diff --git a/test/Sema/attr-bounded.c b/test/Sema/attr-bounded.c
new file mode 100644 (file)
index 0000000..bf71fed
--- /dev/null
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only %s\r
+// Make sure OpenBSD's bounded extension is accepted.\r
+\r
+typedef long ssize_t;\r
+typedef unsigned long size_t;\r
+typedef struct FILE FILE;\r
+\r
+ssize_t read(int, void *, size_t)\r
+    __attribute__((__bounded__(__buffer__,2,3)));\r
+int readlink(const char *, char *, size_t)\r
+    __attribute__((__bounded__(__string__,2,3)));\r
+size_t fread(void *, size_t, size_t, FILE *)\r
+    __attribute__((__bounded__(__size__,1,3,2)));\r
+char *getwd(char *)\r
+    __attribute__((__bounded__(__minbytes__,1,1024)));
\ No newline at end of file