mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1369622 - Add a static_assert when no variadic argument is given to MOZ_CRASH_UNSAFE_PRINTF. r=froydnj
If MOZ_CRASH_UNSAFE_PRINTF is only given a format string, it means either arguments are missing, or MOZ_CRASH should be used instead. Hint at that with a static_assert. --HG-- extra : rebase_source : 355c37deb8b007e61939a4c657e411d110e7bbe7
This commit is contained in:
parent
e9c25fa403
commit
05a36a133a
@ -314,6 +314,10 @@ MOZ_CrashPrintf(const char* aFilename, int aLine, const char* aFormat, ...);
|
||||
*/
|
||||
#define MOZ_CRASH_UNSAFE_PRINTF(format, ...) \
|
||||
do { \
|
||||
static_assert( \
|
||||
MOZ_ARG_COUNT(__VA_ARGS__) > 0, \
|
||||
"Did you forget arguments to MOZ_CRASH_UNSAFE_PRINTF? " \
|
||||
"Or maybe you want MOZ_CRASH instead?"); \
|
||||
static_assert( \
|
||||
MOZ_ARG_COUNT(__VA_ARGS__) <= sPrintfMaxArgs, \
|
||||
"Only up to 4 additional arguments are allowed!"); \
|
||||
|
Loading…
Reference in New Issue
Block a user