Index: clang/include/clang/Basic/DiagnosticGroups.td =================================================================== --- clang/include/clang/Basic/DiagnosticGroups.td +++ clang/include/clang/Basic/DiagnosticGroups.td @@ -239,6 +239,7 @@ def GNUFlexibleArrayInitializer : DiagGroup<"gnu-flexible-array-initializer">; def GNUFlexibleArrayUnionMember : DiagGroup<"gnu-flexible-array-union-member">; def GNUFoldingConstant : DiagGroup<"gnu-folding-constant">; +def FormatInsufficientArgs : DiagGroup<"format-insufficient-args">; def FormatExtraArgs : DiagGroup<"format-extra-args">; def FormatZeroLength : DiagGroup<"format-zero-length">; @@ -848,7 +849,8 @@ def FormatTypeConfusion : DiagGroup<"format-type-confusion">; def Format : DiagGroup<"format", [FormatExtraArgs, FormatZeroLength, NonNull, - FormatSecurity, FormatY2K, FormatInvalidSpecifier]>, + FormatSecurity, FormatY2K, FormatInvalidSpecifier, + FormatInsufficientArgs]>, DiagCategory<"Format String Issue">; def FormatNonLiteral : DiagGroup<"format-nonliteral">; def Format2 : DiagGroup<"format=2", Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -8851,7 +8851,7 @@ "array %0 declared here">; def warn_printf_insufficient_data_args : Warning< - "more '%%' conversions than data arguments">, InGroup; + "more '%%' conversions than data arguments">, InGroup; def warn_printf_data_arg_not_used : Warning< "data argument not used by format string">, InGroup; def warn_format_invalid_conversion : Warning< Index: clang/test/Misc/warning-wall.c =================================================================== --- clang/test/Misc/warning-wall.c +++ clang/test/Misc/warning-wall.c @@ -9,6 +9,7 @@ CHECK-NEXT: -Wdelete-non-abstract-non-virtual-dtor CHECK-NEXT: -Wdelete-abstract-non-virtual-dtor CHECK-NEXT: -Wformat +CHECK-NEXT: -Wformat-insufficient-args CHECK-NEXT: -Wformat-extra-args CHECK-NEXT: -Wformat-zero-length CHECK-NEXT: -Wnonnull Index: clang/test/Sema/warn-printf-insufficient-data-args.c =================================================================== --- /dev/null +++ clang/test/Sema/warn-printf-insufficient-data-args.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -fsyntax-only -verify=WARNING-ON %s +// RUN: %clang_cc1 -fsyntax-only -Wno-format-insufficient-args -verify=WARNING-OFF %s + + +int printf(const char * format, ...); + +int main(void) { + int patatino = 42; + printf("%i %i", patatino); // WARNING-ON-warning {{more '%' conversions than data arguments}} + // WARNING-OFF-no-diagnostics +}