Merge pull request #60 from MaddTheSane/printflike

Add printf-like macros to MVKLogImpl and mvkNotifyErrorWithText.
This commit is contained in:
Bill Hollings 2018-03-01 14:32:30 -05:00 committed by GitHub
commit d1a5128448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -176,6 +176,7 @@ extern "C" {
* Combine the specified log level and format string, then log * Combine the specified log level and format string, then log
* the specified args to one or both of ASL and printf. * the specified args to one or both of ASL and printf.
*/ */
static inline void MVKLogImplV(bool logToPrintf, bool logToASL, int aslLvl, const char* lvlStr, const char* format, va_list args) __printflike(5, 0);
static inline void MVKLogImplV(bool logToPrintf, bool logToASL, int aslLvl, const char* lvlStr, const char* format, va_list args) { static inline void MVKLogImplV(bool logToPrintf, bool logToASL, int aslLvl, const char* lvlStr, const char* format, va_list args) {
// Combine the level and format string // Combine the level and format string
@ -190,6 +191,7 @@ static inline void MVKLogImplV(bool logToPrintf, bool logToASL, int aslLvl, cons
* Combine the specified log level and format string, then log * Combine the specified log level and format string, then log
* the specified args to one or both of ASL and printf. * the specified args to one or both of ASL and printf.
*/ */
static inline void MVKLogImpl(bool logToPrintf, bool logToASL, int aslLvl, const char* lvlStr, const char* format, ...) __printflike(5, 6);
static inline void MVKLogImpl(bool logToPrintf, bool logToASL, int aslLvl, const char* lvlStr, const char* format, ...) { static inline void MVKLogImpl(bool logToPrintf, bool logToASL, int aslLvl, const char* lvlStr, const char* format, ...) {
va_list args; va_list args;
va_start(args, format); va_start(args, format);

View File

@ -103,7 +103,7 @@ char* mvkResultName(VkResult vkResult, char* name);
* *
* - Logs the error code and message to the console * - Logs the error code and message to the console
*/ */
VkResult mvkNotifyErrorWithText(VkResult vkErr, const char* errFmt, ...); VkResult mvkNotifyErrorWithText(VkResult vkErr, const char* errFmt, ...) __printflike(2, 3);
#pragma mark - #pragma mark -