mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:14:58 +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:
parent
29c8d34be7
commit
347d741afb
6 changed files with 277 additions and 229 deletions
|
@ -45,11 +45,11 @@ Print the value of EXPRESSION to standard output.)");
|
|||
exit(0);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
[[noreturn]] void fail(Args&&... args)
|
||||
template<typename Fmt, typename... Args>
|
||||
[[noreturn]] void fail(Fmt&& fmt, Args&&... args)
|
||||
{
|
||||
warn("ERROR: \e[31m");
|
||||
warnln(args...);
|
||||
warnln(StringView { fmt }, args...);
|
||||
warn("\e[0m");
|
||||
exit(1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue