the function processing the format string can decided whether or not to accept a null format string (e.g., asl_log). Fixes <rdar://problem/
8269537>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113469
91177308-0d34-0410-b5e6-
96231b3b80d8
format_idx, firstDataArg, isPrintf);
}
+ case Stmt::IntegerLiteralClass:
+ // Technically -Wformat-nonliteral does not warn about this case.
+ // The behavior of printf and friends in this case is implementation
+ // dependent. Ideally if the format string cannot be null then
+ // it should have a 'nonnull' attribute in the function prototype.
+ return true;
+
case Stmt::ImplicitCastExprClass: {
E = cast<ImplicitCastExpr>(E)->getSubExpr();
goto tryAgain;
printf("%lc", c2); // no-warning
}
+// <rdar://problem/8269537> -Wformat-security says NULL is not a string literal
+void r8269537() {
+ // This is likely to crash in most cases, but -Wformat-nonliteral technically
+ // doesn't warn in this case.
+ printf(0); // no-warning
+}
+