build: don't use a space in user string literals

This fixes errors in clang-17
This commit is contained in:
Danny Robson 2023-11-19 09:26:37 +10:00
parent ff1fcfa977
commit 19095934b2
5 changed files with 5 additions and 16 deletions

View File

@ -189,7 +189,7 @@ namespace cruft::ascii {
/// The supplied string must have a length that is a multiple of 2. /// The supplied string must have a length that is a multiple of 2.
std::vector<std::uint8_t> std::vector<std::uint8_t>
inline inline
operator"" _hex2u08 (const char *str, size_t len) operator""_hex2u08 (const char *str, size_t len)
{ {
CHECK_MOD (len, 2); CHECK_MOD (len, 2);
std::vector<uint8_t> res (len/2); std::vector<uint8_t> res (len/2);
@ -206,7 +206,7 @@ operator"" _hex2u08 (const char *str, size_t len)
/// The supplied string must have a length that is a multiple of 2. /// The supplied string must have a length that is a multiple of 2.
template <typename CharT, CharT ...StrV> template <typename CharT, CharT ...StrV>
constexpr auto constexpr auto
operator"" _hex2array (void) operator""_hex2array (void)
{ {
static_assert (sizeof ...(StrV) % 2 == 0); static_assert (sizeof ...(StrV) % 2 == 0);

View File

@ -5,17 +5,6 @@
#include <cinttypes> #include <cinttypes>
///////////////////////////////////////////////////////////////////////////////
std::vector<uint8_t>
operator"" _u8s (const char *str, size_t len)
{
std::vector<uint8_t> res;
res.resize (len);
std::copy_n (str, len, std::begin (res));
return res;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int int
main (void) main (void)

View File

@ -8,7 +8,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
std::vector<uint8_t> std::vector<uint8_t>
operator"" _u8s (const char *str, size_t len) operator""_u8s (const char *str, size_t len)
{ {
std::vector<uint8_t> res; std::vector<uint8_t> res;
res.resize (len); res.resize (len);

View File

@ -14,7 +14,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
std::vector<uint8_t> std::vector<uint8_t>
operator"" _u8s (const char *str, size_t len) operator""_u8s (const char *str, size_t len)
{ {
std::vector<uint8_t> res; std::vector<uint8_t> res;
res.resize (len); res.resize (len);

View File

@ -37,7 +37,7 @@ struct test {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static constexpr test<uint32_t> static constexpr test<uint32_t>
operator"" _test (const char *str, size_t len) operator""_test (const char *str, size_t len)
{ {
uint32_t mask = 0; uint32_t mask = 0;
uint32_t bits = 0; uint32_t bits = 0;