Also define GTEST_ATTRIBUTE_PRINTF_ in clang-cl.

clang-cl is clang for Windows running in MSVC mode. Chromium uses it for
Windows builds. clang-cl is weird in that it defines __clang__ and
_MSC_VER, but *NOT* __GNUC__. This is vaguely analogous to how normal
clang defines __clang__ (what it is) and __GNUC__ (what it is compatible
with).

However, clang-cl still implements most GCC extensions, being clang.
Notably, the way to control -Wformat-literal is still with
__attribute__((__format__)). For better error-checking and strict
-Wformatl-literal compatibility (see
53c478d639b8eebd2942e88266610ebc79c541f6), define
GTEST_ATTRIBUTE_PRINTF_ in clang-cl too.
This commit is contained in:
David Benjamin 2018-01-03 14:55:52 -05:00
parent ba6ecedede
commit 1acf8c752e

View File

@ -879,7 +879,7 @@ using ::std::tuple_size;
#endif
// Use this annotation before a function that takes a printf format string.
#if defined(__GNUC__) && !defined(COMPILER_ICC)
#if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC)
# if defined(__MINGW_PRINTF_FORMAT)
// MinGW has two different printf implementations. Ensure the format macro
// matches the selected implementation. See