diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-03-22 21:08:50 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-03-22 21:08:50 +0000 | 
| commit | 12161d3d1ac1a876b252e7cbf5fcfadbc0871181 (patch) | |
| tree | bc7cb34a665eb27d7b845dabc3e7bf3da1e67ce0 | |
| parent | cb5a828a4584934eb40b4c2274b33964009785ba (diff) | |
| download | bcm5719-llvm-12161d3d1ac1a876b252e7cbf5fcfadbc0871181.tar.gz bcm5719-llvm-12161d3d1ac1a876b252e7cbf5fcfadbc0871181.zip | |
(re)implement PR6542, accepting and discarding the __gcc_tdiag__
format attribute specifier.
llvm-svn: 99213
| -rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 8 | ||||
| -rw-r--r-- | clang/test/Sema/attr-format.c | 4 | 
2 files changed, 12 insertions, 0 deletions
| diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 73a34f8107e..5a7a3c31fe8 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -1115,6 +1115,7 @@ enum FormatAttrKind {    NSStringFormat,    StrftimeFormat,    SupportedFormat, +  IgnoredFormat,    InvalidFormat  }; @@ -1136,6 +1137,9 @@ static FormatAttrKind getFormatAttrKind(llvm::StringRef Format) {        Format == "zcmn_err")      return SupportedFormat; +  if (Format == "gcc_tdiag") +    return IgnoredFormat; +      return InvalidFormat;  } @@ -1171,6 +1175,10 @@ static void HandleFormatAttr(Decl *d, const AttributeList &Attr, Sema &S) {    // 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(); diff --git a/clang/test/Sema/attr-format.c b/clang/test/Sema/attr-format.c index 594e590e6ba..34102c66037 100644 --- a/clang/test/Sema/attr-format.c +++ b/clang/test/Sema/attr-format.c @@ -68,3 +68,7 @@ void __attribute__((format(printf, 1, 0)))  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))); | 

