Fix deprecated and printf warnings.

[ Merge of http://go/wvgerrit/118703 ]

Bug: 182058081
Test: WV unit/integration tests
Change-Id: I2d8995b8aab864a2d2f5161d12a473d34e67bad4
This commit is contained in:
Rahul Frias
2021-03-07 00:03:17 -08:00
parent 71cf45fb3f
commit 24e4c33262
5 changed files with 30 additions and 10 deletions

View File

@@ -78,9 +78,7 @@ struct LoggingUidSetter {
// unit tests.
CORE_UTIL_EXPORT void InitLogging();
// Only enable format specifier warnings on LP64 systems. There is
// no easy portable method to handle format specifiers for int64_t.
#if (defined(__GNUC__) || defined(__clang__)) && defined(__LP64__)
#ifdef __GNUC__
[[gnu::format(printf, 5, 6)]] CORE_UTIL_EXPORT void Log(const char* file,
const char* function,
int line,

View File

@@ -11,12 +11,23 @@
# else
# define CORE_UTIL_EXPORT __declspec(dllimport)
# endif
# define CORE_UTIL_IGNORE_DEPRECATED
# define CORE_UTIL_RESTORE_WARNINGS
#else
# ifdef CORE_UTIL_IMPLEMENTATION
# define CORE_UTIL_EXPORT __attribute__((visibility("default")))
# else
# define CORE_UTIL_EXPORT
# endif
# ifdef __GNUC__
# define CORE_UTIL_IGNORE_DEPRECATED \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
# define CORE_UTIL_RESTORE_WARNINGS _Pragma("GCC diagnostic pop")
# else
# define CORE_UTIL_IGNORE_DEPRECATED
# define CORE_UTIL_RESTORE_WARNINGS
# endif
#endif
#endif // WVCDM_UTIL_UTIL_COMMON_H_