diff --git a/include/arm9/fmt.h b/include/arm9/fmt.h index d6dc629..97e94f3 100644 --- a/include/arm9/fmt.h +++ b/include/arm9/fmt.h @@ -32,8 +32,8 @@ u32 ee_vsprintf(char *buf, const char *fmt, va_list args); -u32 ee_sprintf(char *buf, const char *fmt, ...); -u32 ee_snprintf(char *const buf, UNUSED u32 size, const char *const fmt, ...); +__attribute__ ((format (printf, 2, 3))) u32 ee_sprintf(char *const buf, const char *const fmt, ...); +__attribute__ ((format (printf, 3, 4))) u32 ee_snprintf(char *const buf, UNUSED u32 size, const char *const fmt, ...); u32 ee_vsnprintf(char *const buf, UNUSED u32 size, const char *const fmt, va_list arg); -u32 ee_printf(const char *const fmt, ...); +__attribute__ ((format (printf, 1, 2))) u32 ee_printf(const char *const fmt, ...); u32 ee_puts(const char *const str); diff --git a/include/util.h b/include/util.h index 91d079a..622c61c 100644 --- a/include/util.h +++ b/include/util.h @@ -28,7 +28,7 @@ void wait(u32 cycles); -int mysscanf(const char *s, const char *fmt, ...); +__attribute__ ((format (scanf, 2, 3))) int mysscanf(const char *s, const char *fmt, ...); // case insensitive string compare function int strnicmp(const char *str1, const char *str2, u32 len); diff --git a/source/arm9/fmt.c b/source/arm9/fmt.c index 532b35b..42e5485 100644 --- a/source/arm9/fmt.c +++ b/source/arm9/fmt.c @@ -321,7 +321,7 @@ return str - buf; } -u32 ee_sprintf(char *const buf, const char *const fmt, ...) +__attribute__ ((format (printf, 2, 3))) u32 ee_sprintf(char *const buf, const char *const fmt, ...) { va_list args; va_start(args, fmt); @@ -331,7 +331,7 @@ return res; } -u32 ee_snprintf(char *const buf, UNUSED u32 size, const char *const fmt, ...) +__attribute__ ((format (printf, 3, 4))) u32 ee_snprintf(char *const buf, UNUSED u32 size, const char *const fmt, ...) { va_list args; va_start(args, fmt); @@ -346,7 +346,7 @@ return ee_vsprintf(buf, fmt, arg); } -u32 ee_printf(const char *const fmt, ...) +__attribute__ ((format (printf, 1, 2))) u32 ee_printf(const char *const fmt, ...) { char buf[256]; va_list args; diff --git a/source/util.c b/source/util.c index 4faa4b7..9b3bcf2 100644 --- a/source/util.c +++ b/source/util.c @@ -33,7 +33,7 @@ } } -int mysscanf(const char *s, const char *fmt, ...) +__attribute__ ((format (scanf, 2, 3))) int mysscanf(const char *s, const char *fmt, ...) { va_list args; va_start(args, fmt);