]> granicus.if.org Git - clang/commitdiff
Bad table discription of fromat-y2k causes
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 14 Jun 2011 21:54:00 +0000 (21:54 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 14 Jun 2011 21:54:00 +0000 (21:54 +0000)
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
test/Sema/no-format-y2k-turnsoff-format.c [new file with mode: 0644]

index 9abd6d3c5769904a789189db0197175175e1dedd..9d2bf03862566680497bbdfa85a7396193e143be 100644 (file)
@@ -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 (file)
index 0000000..bd06e50
--- /dev/null
@@ -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'}}
+}
+