From 997e15cfdc5c78cf3cd9c520dd1bcf3eef4750c0 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Tue, 14 Jun 2011 21:54:00 +0000 Subject: [PATCH] Bad table discription of fromat-y2k causes no-format-y2k turn off -Wformat altogether. // rdar://9504680 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133015 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticGroups.td | 4 ++-- test/Sema/no-format-y2k-turnsoff-format.c | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 test/Sema/no-format-y2k-turnsoff-format.c diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 9abd6d3c57..9d2bf03862 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -217,12 +217,12 @@ def Unused : DiagGroup<"unused", // Format settings. def FormatSecurity : DiagGroup<"format-security">; +def FormatY2K : DiagGroup<"format-y2k">; def Format : DiagGroup<"format", [FormatExtraArgs, FormatZeroLength, NonNull, - FormatSecurity]>, + FormatSecurity, FormatY2K]>, DiagCategory<"Format String Issue">; def FormatNonLiteral : DiagGroup<"format-nonliteral", [FormatSecurity]>; -def FormatY2K : DiagGroup<"format-y2k", [Format]>; def Format2 : DiagGroup<"format=2", [FormatNonLiteral, FormatSecurity, FormatY2K]>; diff --git a/test/Sema/no-format-y2k-turnsoff-format.c b/test/Sema/no-format-y2k-turnsoff-format.c new file mode 100644 index 0000000000..bd06e506ce --- /dev/null +++ b/test/Sema/no-format-y2k-turnsoff-format.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -Wformat -Wno-format-y2k +// rdar://9504680 + +void foo(const char *, ...) __attribute__((__format__ (__printf__, 1, 2))); + +void bar(unsigned int a) { + foo("%s", a); // expected-warning {{conversion specifies type 'char *' but the argument has type 'unsigned int'}} +} + -- 2.50.1