From 60fd22c105a62539761892976ef2c852367626c2 Mon Sep 17 00:00:00 2001 From: Braxton Salyer Date: Sat, 21 Sep 2024 18:46:27 -0500 Subject: [PATCH] ignore clang warning --- include/hyperion/platform/types.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/include/hyperion/platform/types.h b/include/hyperion/platform/types.h index bceb35d..481d942 100644 --- a/include/hyperion/platform/types.h +++ b/include/hyperion/platform/types.h @@ -132,9 +132,9 @@ namespace hyperion { constexpr auto trim_separators([[maybe_unused]] string_literal literal) noexcept { constexpr auto new_size = []() { constexpr auto array = std::array{Chars...}; - auto size = array.size(); + auto size = array.size(); for(const auto& c : array) { - if (c == '\'') { + if(c == '\'') { size--; } } @@ -197,16 +197,21 @@ namespace hyperion { = str.size() > 2 && str[0] == '0' && (str[1] == 'b' || str[1] == 'B'); if constexpr(std::is_floating_point_v - && (std::is_same_v - || !std::is_same_v)) { + && (std::is_same_v || !std::is_same_v)) + { if(!is_hex && !is_binary) { constexpr auto trimmed = trim_separators(string_literal{}); Type res = 0; - auto result = fast_float::from_chars( - &(trimmed[0]), - &(trimmed[0]) + trimmed.size(), - res - ); +#if HYPERION_PLATFORM_COMPILER_IS_CLANG + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunsafe-buffer-usage" +#endif // HYPERION_PLATFORM_COMPILER_IS_CLANG + auto result = fast_float::from_chars(&(trimmed[0]), + &(trimmed[0]) + trimmed.size(), + res); +#if HYPERION_PLATFORM_COMPILER_IS_CLANG + #pragma GCC diagnostic pop +#endif // HYPERION_PLATFORM_COMPILER_IS_CLANG if(result.ptr != trimmed.end()) { if(result.ec == std::errc::invalid_argument) { return {.status = literal_status::InvalidCharacterSequence};