Enabled log formatting warnings.
[ Merge of http://go/wvgerrit/105025 ] Clang and GCC allow for warnings against the arguments for printf-like functions (e.i. LOGx). These validate that the format type specified in the format string match the corresponding argument type. Most of the time, format specifer errors are benign; hence why they haven't been seen as an error so far. However, with the enabling of specifier warnings and the enabling of warnings as errors on certain platforms, these existing errors need to be addressed. This CL enables format specifier warnings for most of the Widevine code, with the OEMCrypto L3 implementation which has a single error which requires a fix in the haystack code before being fixed in the Widevine branch. Strict format string warnings are not enabled for non-LP64 systems. Bug: 137583127 Test: Compiled for Linux and Android Change-Id: I051398332d31a20457b86563a90ad8f6d428445f
This commit is contained in:
@@ -33,8 +33,18 @@ extern LogPriority g_cutoff;
|
||||
// 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__)
|
||||
[[gnu::format(printf, 5, 6)]] CORE_UTIL_EXPORT void Log(const char* file,
|
||||
const char* function,
|
||||
int line,
|
||||
LogPriority level,
|
||||
const char* fmt, ...);
|
||||
#else
|
||||
CORE_UTIL_EXPORT void Log(const char* file, const char* function, int line,
|
||||
LogPriority level, const char* fmt, ...);
|
||||
#endif
|
||||
|
||||
// Log APIs
|
||||
#ifndef LOGE
|
||||
|
||||
Reference in New Issue
Block a user