[cfe-commits] r99213 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/attr-format.c
Chris Lattner
sabre at nondot.org
Mon Mar 22 14:08:50 PDT 2010
Author: lattner
Date: Mon Mar 22 16:08:50 2010
New Revision: 99213
URL: http://llvm.org/viewvc/llvm-project?rev=99213&view=rev
Log:
(re)implement PR6542, accepting and discarding the __gcc_tdiag__
format attribute specifier.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/attr-format.c
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=99213&r1=99212&r2=99213&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Mar 22 16:08:50 2010
@@ -1115,6 +1115,7 @@
NSStringFormat,
StrftimeFormat,
SupportedFormat,
+ IgnoredFormat,
InvalidFormat
};
@@ -1136,6 +1137,9 @@
Format == "zcmn_err")
return SupportedFormat;
+ if (Format == "gcc_tdiag")
+ return IgnoredFormat;
+
return InvalidFormat;
}
@@ -1171,6 +1175,10 @@
// Check for supported formats.
FormatAttrKind Kind = getFormatAttrKind(Format);
+
+ if (Kind == IgnoredFormat)
+ return;
+
if (Kind == InvalidFormat) {
S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported)
<< "format" << Attr.getParameterName()->getName();
Modified: cfe/trunk/test/Sema/attr-format.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-format.c?rev=99213&r1=99212&r2=99213&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-format.c (original)
+++ cfe/trunk/test/Sema/attr-format.c Mon Mar 22 16:08:50 2010
@@ -68,3 +68,7 @@
foo2(const char *fmt, va_list va) {
xx_vprintf(foo(fmt), va);
}
+
+// PR6542
+extern void gcc_format (const char *, ...)
+ __attribute__ ((__format__(__gcc_tdiag__, 1, 2)));
More information about the cfe-commits
mailing list