Skip to content

Commit 346f7a1

Browse files
committed
sys/log: add format attribute to modlog_printf prototype
Add format(printf) attribute to modlog_printf to enable compile-time checking that format strings match arguments. Note that this will cause incorrect modlog_printf usage which previously compiled successfully, to no longer compile.
1 parent a52f357 commit 346f7a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sys/log/modlog/include/modlog/modlog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ int modlog_foreach(modlog_foreach_fn *fn, void *arg);
190190
* @param level The severity of the log entry to write.
191191
* @param msg The "printf" formatted string to write.
192192
*/
193-
void modlog_printf(uint8_t module, uint8_t level, const char *msg, ...);
193+
void modlog_printf(uint8_t module, uint8_t level, const char *msg, ...) __attribute((format(printf, 3, 4)));
194194

195195
/**
196196
* @brief Writes a specified number of bytes as a text entry to the specified log module.

0 commit comments

Comments
 (0)