[cfe-commits] r70362 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td test/Sema/format-strings.c
Chris Lattner
sabre at nondot.org
Tue Apr 28 21:15:08 PDT 2009
Author: lattner
Date: Tue Apr 28 23:15:07 2009
New Revision: 70362
URL: http://llvm.org/viewvc/llvm-project?rev=70362&view=rev
Log:
tweak warning options to be more like gcc:
1. All all variants of -Wformat*, make them imply -Wformat. GCC warns
if you use -Wformatfoo without -Wformat. We just make one imply the
other.
2. Make -Wformat-nonliteral default to off, like gcc. It is an incredible
nuisance.
3. Accept but currently ignore -Wformat-extra-args.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/Sema/format-strings.c
Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=70362&r1=70361&r2=70362&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Tue Apr 28 23:15:07 2009
@@ -31,9 +31,14 @@
def : DiagGroup<"conversion">;
def : DiagGroup<"declaration-after-statement">;
def ExtraTokens : DiagGroup<"extra-tokens">;
-def : DiagGroup<"format-security">;
-def : DiagGroup<"format=2">;
-def : DiagGroup<"format">;
+
+def Format : DiagGroup<"format">;
+def Format2 : DiagGroup<"format=2", [Format]>;
+def : DiagGroup<"format-extra-args", [Format]>;
+def FormatNonLiteral : DiagGroup<"format-nonliteral", [Format]>;
+def FormatSecurity : DiagGroup<"format-security", [Format]>;
+def : DiagGroup<"format-y2k", [Format]>;
+
def FourByteMultiChar : DiagGroup<"four-char-constants">;
@@ -47,7 +52,6 @@
def MultiChar : DiagGroup<"multichar">;
def : DiagGroup<"nested-externs">;
def : DiagGroup<"newline-eof">;
-def : DiagGroup<"format-y2k">;
def : DiagGroup<"long-long">;
def : DiagGroup<"missing-field-initializers">;
def : DiagGroup<"nonportable-cfstrings">;
@@ -95,6 +99,7 @@
def Most : DiagGroup<"most", [
Comment,
+ Format,
Implicit,
MultiChar,
Switch,
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=70362&r1=70361&r2=70362&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Apr 28 23:15:07 2009
@@ -1059,7 +1059,7 @@
"array types cannot be value-initialized">;
def warn_printf_not_string_constant : Warning<
"format string is not a string literal (potentially insecure)">,
- InGroup<DiagGroup<"format-nonliteral">>;
+ InGroup<FormatNonLiteral>, DefaultIgnore;
def err_unexpected_interface : Error<
"unexpected interface name %0: expected expression">;
Modified: cfe/trunk/test/Sema/format-strings.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-strings.c?rev=70362&r1=70361&r2=70362&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-strings.c (original)
+++ cfe/trunk/test/Sema/format-strings.c Tue Apr 28 23:15:07 2009
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: clang-cc -fsyntax-only -verify -Wformat-nonliteral %s
// Define this to get vasprintf on Linux
#define _GNU_SOURCE
More information about the cfe-commits
mailing list