[log] add compile-time check for printf style arg check to log functions (#8339)

This commit adds compile-time check of format string to all log
functions and macros. It also updates different core modules to make
arg string formats consistent under different platforms. In particular
we use `'%lu` for `uint32_t` arguments and they are explicitly cast
to `unsigned long` using `ToUlong()`.
This commit is contained in:
Abtin Keshavarzian
2022-11-01 22:45:16 -07:00
committed by GitHub
parent f5acfb2dac
commit ac11f66419
28 changed files with 106 additions and 103 deletions
+2 -2
View File
@@ -228,7 +228,7 @@ void Notifier::LogEvents(Events aEvents) const
{
if (string.GetLength() >= kFlagsStringLineLimit)
{
LogInfo("StateChanged (0x%08x) %s%s ...", aEvents.GetAsFlags(), didLog ? "... " : "[",
LogInfo("StateChanged (0x%08lx) %s%s ...", ToUlong(aEvents.GetAsFlags()), didLog ? "... " : "[",
string.AsCString());
string.Clear();
didLog = true;
@@ -243,7 +243,7 @@ void Notifier::LogEvents(Events aEvents) const
}
exit:
LogInfo("StateChanged (0x%08x) %s%s]", aEvents.GetAsFlags(), didLog ? "... " : "[", string.AsCString());
LogInfo("StateChanged (0x%08lx) %s%s]", ToUlong(aEvents.GetAsFlags()), didLog ? "... " : "[", string.AsCString());
}
const char *Notifier::EventToString(Event aEvent) const