basic/{time,format}-util: warn when format result is unused

Now that anonymous buffers are used in almost all cases, code which
does not use the return value is usually broken.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-07-09 11:11:25 +02:00
parent bc2a4af25f
commit 6c6368e938
3 changed files with 7 additions and 4 deletions
+2 -1
View File
@@ -74,8 +74,9 @@ typedef enum {
#define FORMAT_BYTES_MAX 16U
char *format_bytes_full(char *buf, size_t l, uint64_t t, FormatBytesFlag flag);
char *format_bytes_full(char *buf, size_t l, uint64_t t, FormatBytesFlag flag) _warn_unused_result_;
_warn_unused_result_
static inline char *format_bytes(char *buf, size_t l, uint64_t t) {
return format_bytes_full(buf, l, t, FORMAT_BYTES_USE_IEC | FORMAT_BYTES_BELOW_POINT | FORMAT_BYTES_TRAILING_B);
}