diff options
author | Billy Donahue <BillyDonahue@users.noreply.github.com> | 2017-05-07 05:07:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-07 05:07:16 (GMT) |
commit | 887d569eb0bac3760cb3adf5877c8284e4d7768e (patch) | |
tree | 8897d6e42dd8da0ac178e7749ffbafc855cd01d3 /googletest/include | |
parent | 0ad83afdaa3319dadd9f03299bd62f93e6afe2d3 (diff) | |
parent | 53c478d639b8eebd2942e88266610ebc79c541f6 (diff) | |
download | googletest-887d569eb0bac3760cb3adf5877c8284e4d7768e.zip googletest-887d569eb0bac3760cb3adf5877c8284e4d7768e.tar.gz googletest-887d569eb0bac3760cb3adf5877c8284e4d7768e.tar.bz2 |
Merge pull request #965 from davidben/format-attr
Annotate ColoredPrintf with the format attribute and fix bugs.
Diffstat (limited to 'googletest/include')
-rw-r--r-- | googletest/include/gtest/internal/gtest-port.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 38a8365..863f6e7 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -874,6 +874,23 @@ using ::std::tuple_size; # define GTEST_ATTRIBUTE_UNUSED_ #endif +// Use this annotation before a function that takes a printf format string. +#if defined(__GNUC__) && !defined(COMPILER_ICC) +# if defined(__MINGW_PRINTF_FORMAT) +// MinGW has two different printf implementations. Ensure the format macro +// matches the selected implementation. See +// https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/. +# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \ + __attribute__((__format__(__MINGW_PRINTF_FORMAT, string_index, \ + first_to_check))) +# else +# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \ + __attribute__((__format__(__printf__, string_index, first_to_check))) +# endif +#else +# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) +#endif + // A macro to disallow operator= // This should be used in the private: declarations for a class. #define GTEST_DISALLOW_ASSIGN_(type)\ |