1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:27:45 +00:00

LibC+Utilities: Add gnu::format attributes

Without these attributes present on these custom formatting functions,
Clang would warn use about nonliteral format strings. As an added bonus,
we now get type checking on these.
This commit is contained in:
Daniel Bertalan 2021-07-06 06:29:49 +02:00 committed by Gunnar Beutner
parent e8e628de57
commit 98260c5862
2 changed files with 2 additions and 2 deletions

View file

@ -22,7 +22,7 @@ char* optarg = nullptr;
// processed". Well, this is how we do it. // processed". Well, this is how we do it.
static size_t s_index_into_multioption_argument = 0; static size_t s_index_into_multioption_argument = 0;
static inline void report_error(const char* format, ...) [[gnu::format(printf, 1, 2)]] static inline void report_error(const char* format, ...)
{ {
if (!opterr) if (!opterr)
return; return;

View file

@ -16,7 +16,7 @@
bool g_there_was_an_error = false; bool g_there_was_an_error = false;
[[noreturn]] static void fatal_error(const char* format, ...) [[noreturn, gnu::format(printf, 1, 2)]] static void fatal_error(const char* format, ...)
{ {
fputs("\033[31m", stderr); fputs("\033[31m", stderr);