Commit graph

12 commits

Author SHA1 Message Date
sin-ack 52d017c611 AK: Make CheckedFormatString pass the char array size to StringView
This makes the assumption that we never pass a stack-allocated char
array to CheckedFormatString arguments (dbgln, outln, warnln). This
assumption seems to hold true for the current state of Serenity code, at
least. :^)
2022-07-12 23:11:35 +02:00
Ali Mohammad Pur 2104e9a6e4 AK: Recognize __CLION_IDE__ as well as __CLION_IDE_
This used to be `__CLION_IDE_` before, but it seems to have been fixed
in the latest EAP.
2022-06-26 22:21:17 +01:00
Idan Horowitz 086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Daniel Bertalan 2b1864c53a AK: Add missing Array.h include to CheckedFormatString.h
GCC 12 complains that iota_array is used before it's declared. GCC 11
works fine without it though.
2021-12-24 14:35:33 -08:00
Andreas Kling c837bd551e AK: Don't define ENABLE_COMPILETIME_FORMAT_CHECK when parsed by CLion 2021-11-08 00:35:27 +01:00
Lenny Maiorani 97bd13264a Everywhere: Make use of container version of all_of
Problem:
- New `all_of` implementation takes the entire container so the user
  does not need to pass explicit begin/end iterators. This is unused
  except is in tests.

Solution:
- Make use of the new and more user-friendly version where possible.
2021-08-03 10:46:43 +02:00
Ali Mohammad Pur 944855ca18 AK+Everywhere: Fix compiletime format parsing of replacement fields 2021-06-01 23:12:17 +04:30
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
AnotherTest a6e4482080 AK+Everywhere: Make StdLibExtras templates less wrapper-y
This commit makes the user-facing StdLibExtras templates and utilities
arguably more nice-looking by removing the need to reach into the
wrapper structs generated by them to get the value/type needed.
The C++ standard library had to invent `_v` and `_t` variants (likely
because of backwards compat), but we don't need to cater to any codebase
except our own, so might as well have good things for free. :^)
2021-04-10 21:01:31 +02:00
Linus Groh 6ad3454bfb AK: Rename {DBGLN_NO => ENABLE}_COMPILETIME_FORMAT_CHECK
This is no longer limited to dbgln(). Also invert it to match all the
other ENABLE_FOO options.
2021-02-24 13:07:57 +01:00
Andreas Kling 5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
AnotherTest 347d741afb 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).
2021-02-23 13:59:33 +01:00