Add WUT_FORMAT_PRINTF and fix some format string bugs. (#404)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled

This commit is contained in:
Daniel K. O.
2025-05-17 17:35:56 -03:00
committed by GitHub
parent 1bbdc75f27
commit 81db8e5dd4
19 changed files with 77 additions and 55 deletions

View File

@@ -30,27 +30,32 @@ void
COSVReport(COSReportModule module,
COSReportLevel level,
const char* fmt,
...);
...)
WUT_FORMAT_PRINTF(3, 4);
void
COSError(COSReportModule module,
const char* fmt,
...);
...)
WUT_FORMAT_PRINTF(2, 3);
void
COSInfo(COSReportModule module,
const char* fmt,
...);
...)
WUT_FORMAT_PRINTF(2, 3);
void
COSVerbose(COSReportModule module,
const char* fmt,
...);
...)
WUT_FORMAT_PRINTF(2, 3);
void
COSWarn(COSReportModule module,
const char* fmt,
...);
...)
WUT_FORMAT_PRINTF(2, 3);
#ifdef __cplusplus
}

View File

@@ -65,25 +65,30 @@ __OSConsoleWrite(const char *msg,
uint32_t size);
void
OSReport(const char *fmt, ...);
OSReport(const char *fmt, ...)
WUT_FORMAT_PRINTF(1, 2);
void
OSReportVerbose(const char *fmt, ...);
OSReportVerbose(const char *fmt, ...)
WUT_FORMAT_PRINTF(1, 2);
void
OSReportInfo(const char *fmt, ...);
OSReportInfo(const char *fmt, ...)
WUT_FORMAT_PRINTF(1, 2);
void
OSReportWarn(const char *fmt, ...);
OSReportWarn(const char *fmt, ...)
WUT_FORMAT_PRINTF(1, 2);
void
OSPanic(const char *file,
uint32_t line,
const char *fmt, ...);
const char *fmt, ...)
WUT_FORMAT_PRINTF(3, 4);
void

View File

@@ -6,7 +6,8 @@ extern "C" {
#endif
int
__os_snprintf(char *buf, size_t n, const char *format, ... );
__os_snprintf(char *buf, size_t n, const char *format, ... )
WUT_FORMAT_PRINTF(3, 4);
#ifdef __cplusplus
}