From c29c16f8cb98f4892dd13b0c7b6b08280687d6b0 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 26 Sep 2017 16:39:20 -0400 Subject: Enable PRINTF_FORMAT for clang This ports https://chromium-review.googlesource.com/c/chromium/src/+/599127 from Chromium to PDFium. Because VC++ does not have format-string checking for user-defined functions during normal compiles, because clang-cl had its format-string checking disabled, because some files are only compiled on Windows, and because VC++'s /analyze doesn't build all targets, and because VC++'s format-string checking is more lenient than clang's... 50 warnings about format-string mismatches crept in to Chromium's build. Seven of these were somewhat serious, with four being wchar_t*/char* mismatches because of base::FilePath and the other three being size_t/%d mismatches. Now that all of the mismatches are corrected this change enables PRINTF_FORMAT checking with clang-cl so that these bugs never return. Bug: pdfium:909 Change-Id: I683592f5015b31b4dd04dfe81e6866389b544efe Reviewed-on: https://pdfium-review.googlesource.com/14834 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- third_party/base/compiler_specific.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/base/compiler_specific.h b/third_party/base/compiler_specific.h index 832b95bf5f..3dbd1abb33 100644 --- a/third_party/base/compiler_specific.h +++ b/third_party/base/compiler_specific.h @@ -143,7 +143,7 @@ // |dots_param| is the one-based index of the "..." parameter. // For v*printf functions (which take a va_list), pass 0 for dots_param. // (This is undocumented but matches what the system C headers do.) -#if defined(COMPILER_GCC) +#if defined(COMPILER_GCC) || defined(__clang__) #define PRINTF_FORMAT(format_param, dots_param) \ __attribute__((format(printf, format_param, dots_param))) #else -- cgit v1.2.3