aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-29 04:15:07 +0000
committerChris Lattner <sabre@nondot.org>2009-04-29 04:15:07 +0000
commitbe8434a0cc0355f652d59553f8aaa3c88bfe3c94 (patch)
tree1927729fdec905d24447f0f094588d2dae0a19c0
parentb9fc856696defc78750fdb4977c4dce34307a7f1 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70362 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/DiagnosticGroups.td13
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td2
-rw-r--r--test/Sema/format-strings.c2
3 files changed, 11 insertions, 6 deletions
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td
index 6ed8afb0ff..4aff9340f5 100644
--- a/include/clang/Basic/DiagnosticGroups.td
+++ b/include/clang/Basic/DiagnosticGroups.td
@@ -31,9 +31,14 @@ def Comment : DiagGroup<"comment">;
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 : DiagGroup<"missing-noreturn">;
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 Extra : DiagGroup<"extra">;
def Most : DiagGroup<"most", [
Comment,
+ Format,
Implicit,
MultiChar,
Switch,
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 306fcaccfa..88607f3a3b 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1059,7 +1059,7 @@ def err_value_init_for_array_type : Error<
"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">;
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index cbeadc20b8..c7392c1f0c 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -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