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

AK+Userland: Extend the compiletime format string check to other functions

Thanks to @trflynn89 for the neat implicit consteval ctor trick!
This allows us to basically slap `CheckedFormatString` on any
formatting function, and have its format argument checked at compiletime.

Note that there is a validator bug where it doesn't parse inner replaced
fields like `{:~>{}}` correctly (what should be 'left align with next
argument as size' is parsed as `{:~>{` following a literal closing
brace), so the compiletime checks are disabled on these temporarily by
forcing them to be StringViews.

This commit also removes the now unused `AK::StringLiteral` type (which
was introduced for use with NTTP strings).
This commit is contained in:
AnotherTest 2021-02-22 02:37:24 +03:30 committed by Andreas Kling
parent 29c8d34be7
commit 347d741afb
6 changed files with 277 additions and 229 deletions

View file

@ -27,11 +27,12 @@
#pragma once
#include <AK/Assertions.h>
#include <AK/CheckedFormatString.h>
namespace AK {
template<typename... Parameters>
void warnln(const char* fmtstr, const Parameters&...);
void warnln(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&...);
}