]> granicus.if.org Git - clang/commitdiff
When parsing ignored attribute arguments, presuming the first argument is an unresolv...
authorAaron Ballman <aaron@aaronballman.com>
Wed, 4 Dec 2013 15:32:26 +0000 (15:32 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Wed, 4 Dec 2013 15:32:26 +0000 (15:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196387 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 4fce10fc32fc235ebb1c8e0fed78050debc8a296..944942658ab2e9c7cf20512586184de2b0bfe480 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