Skip to content

Commit 1f56fbe

Browse files
committed
Add format checking to mbed_error_printf
1 parent 8976709 commit 1f56fbe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

platform/mbed_error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ typedef struct _mbed_error_ctx {
871871
*
872872
*/
873873

874-
MBED_NORETURN void error(const char *format, ...);
874+
MBED_NORETURN void error(const char *format, ...) MBED_PRINTF(1, 2);
875875

876876
/**
877877
* Call this Macro to generate a mbed_error_status_t value for a System error

platform/mbed_interface.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ MBED_NORETURN void mbed_die(void);
139139
* @endcode
140140
*
141141
*/
142-
void mbed_error_printf(const char *format, ...);
142+
void mbed_error_printf(const char *format, ...) MBED_PRINTF(1, 2);
143143

144144
/** Print out an error message. Similar to mbed_error_printf
145145
* but uses a va_list.
@@ -150,7 +150,7 @@ void mbed_error_printf(const char *format, ...);
150150
* @param arg Variable arguments list
151151
*
152152
*/
153-
void mbed_error_vprintf(const char *format, va_list arg);
153+
void mbed_error_vprintf(const char *format, va_list arg) MBED_PRINTF(1, 0);
154154

155155
/** Print out an error message. This is typically called when
156156
* handling a crash.
@@ -169,7 +169,7 @@ void mbed_error_puts(const char *str);
169169
/** @deprecated Renamed to mbed_error_vprintf to match functionality */
170170
MBED_DEPRECATED_SINCE("mbed-os-5.11",
171171
"Renamed to mbed_error_vprintf to match functionality.")
172-
void mbed_error_vfprintf(const char *format, va_list arg);
172+
void mbed_error_vfprintf(const char *format, va_list arg) MBED_PRINTF(1, 0);
173173
/** @}*/
174174

175175

0 commit comments

Comments
 (0)