implement -Wformat-security properly, which is enabled by default.
This enables one specific class of non-literal format warnings.

llvm-svn: 70368
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index c7392c1..50903b0 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -113,3 +113,15 @@
   printf(s4); // expected-warning{{not a string literal}}
   printf(s5); // expected-warning{{not a string literal}}
 }
+
+
+// Test what happens when -Wformat-security only.
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#pragma GCC diagnostic warning "-Wformat-security"
+
+void test9(char *P) {
+  int x;
+  printf(P);   // expected-warning {{format string is not a string literal (potentially insecure)}}
+  printf(P, 42);
+  printf("%n", &x); // expected-warning {{use of '%n' in format string discouraged }}
+}