mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-10-31 03:16:25 +08:00
Merge 78b6a96f28b9a7b66a4d95a34fb3ed9edbb73163 into 33785d5d61993b8c22eacc58108e1cf109eca490
This commit is contained in:
commit
b933b73541
10
.github/workflows/ubuntu22-clang.yml
vendored
10
.github/workflows/ubuntu22-clang.yml
vendored
@ -9,6 +9,14 @@ jobs:
|
||||
- uses: actions/checkout@v7
|
||||
- name: Install clang++-14
|
||||
run: sudo apt-get install -y clang++-14
|
||||
- name: Check for pedantic warnings in pre-C++20 modes (issue 427)
|
||||
run: |
|
||||
set -xe
|
||||
printf '#include "fast_float/fast_float.h"\nint main() { return 0; }\n' > pedantic_check.cpp
|
||||
for std in c++11 c++14 c++17 c++20; do
|
||||
clang++-14 -std=$std -Wall -Wextra -pedantic-errors -Werror \
|
||||
-Iinclude -fsyntax-only pedantic_check.cpp
|
||||
done
|
||||
- name: Use cmake
|
||||
run: |
|
||||
mkdir build &&
|
||||
@ -22,4 +30,4 @@ jobs:
|
||||
cd build20 &&
|
||||
CXX=clang++-14 cmake -DFASTFLOAT_CONSTEXPR_TESTS=ON -DFASTFLOAT_CXX_STANDARD=20 -DFASTFLOAT_TEST=ON .. &&
|
||||
cmake --build . &&
|
||||
ctest --output-on-failure
|
||||
ctest --output-on-failure
|
||||
|
||||
@ -622,10 +622,22 @@ parse_number_string(UC const *p, UC const *pend, parse_options_t<UC> options,
|
||||
// JSON and JavaScript are mutually exclusive, so only the non-JSON
|
||||
// instantiation has to look at the flag.
|
||||
FASTFLOAT_IF_CONSTEXPR17(!basic_json_fmt) {
|
||||
// We have to disable -Wc++20-extensions for the [[unlikely]] attribute
|
||||
// See comment for @jwakely at
|
||||
// https://github.com/fastfloat/fast_float/pull/387#discussion_r3366943539
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#if (!defined(__APPLE_CC__) && __clang_major__ >= 10) || (__clang_major__ >= 13)
|
||||
#pragma clang diagnostic ignored "-Wc++20-extensions"
|
||||
#endif
|
||||
#endif
|
||||
if fastfloat_unlikely (uint64_t(options.format &
|
||||
detail::basic_javascript_fmt)) {
|
||||
return parse_number_string_javascript<UC>(p, pend, options, store_spans);
|
||||
}
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
return parse_number_string_impl<basic_json_fmt, false, UC>(p, pend, options,
|
||||
store_spans);
|
||||
|
||||
@ -391,9 +391,19 @@ from_chars_float_advanced(UC const *first, UC const *last, T &value,
|
||||
// Leave for the javascript conversion before anything else is live, so this
|
||||
// compiles to a tail call and the common path keeps its registers. The cold
|
||||
// function repeats the leading-whitespace and empty-input handling below.
|
||||
// See the comment on -Wc++20-extensions further down in this function.
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#if (!defined(__APPLE_CC__) && __clang_major__ >= 10) || (__clang_major__ >= 13)
|
||||
#pragma clang diagnostic ignored "-Wc++20-extensions"
|
||||
#endif
|
||||
#endif
|
||||
if fastfloat_unlikely (uint64_t(fmt & detail::basic_javascript_fmt)) {
|
||||
return from_chars_float_javascript<T, UC>(first, last, value, options);
|
||||
}
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
from_chars_result_t<UC> answer;
|
||||
if (uint64_t(fmt & chars_format::skip_white_space)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user