Closed mborland closed 5 months ago
An automated preview of the documentation is available at https://177.charconv.prtest.cppalliance.org/libs/charconv/doc/html/index.html
The problem with opt-in is that many people don't build Boost themselves, they rely on prebuilt binaries from e.g. the system package manager, and if the prebuilt one hasn't opted in, it won't have quadmath support.
I suppose this isn't that problematic, but it's something to be aware of.
Why does autodetection fail in this case?
Why does autodetection fail in this case?
I can check for three things:
1) Does the system have __float128
2) Is <quadmath.h>
installed
3) Is the user compiling with GNU extensions.
On the linked issue all of these are met but Alpine uses the musl standard library, and has quadmath installed somewhere unexpected so target_link_libraries(... quadmath)
also fails.
But you can do a configure check, and reliably set a macro if it works.
I'm with @pdimov. Why don't you just use the config check you have in B2 and CMake to define a macro? Something along the line
[ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : <library>"quadmath" <define>BOOST_CHARCONV_HAS_QUADMATH ]
(and the equivalent in CMake).
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 93.29%. Comparing base (
d1236ab
) to head (147b1f4
).
@pdimov When you get a chance can you please double check me on this. Changes are:
1) Cmake and B2 now define a macro BOOST_CHARCONV_BUILD_FLOAT128_SUPPORT
if the config test passes
2) Everything related to implementation of __float128
and std::float128_t
are now in a header and source file in the src/ directory.
3) The only time <quadmath.h>
or any implementation __float128 is included is if BOOST_CHARCONV_BUILD_FLOAT128_SUPPORT
is defined. Otherwise it's all #ifed out. This includes the declarations in to_chars.hpp
and from_chars.hpp
There's probably no need to repeat
target_link_libraries(boost_charconv
PUBLIC
Boost::config
Boost::assert
Boost::core
)
in both quadmath branches; we can pull it out and just add target_link_libraries(boost_charconv PUBLIC quadmath)
in the second one.
This looks like it's going to work, except (1) the actual to_chars
and from_chars
definitions in to_chars.cpp
and from_chars.cpp
haven't been ifdef
-ed on the new macro and (2) the limits
specialization is not going to work, because there's no way limits<__float128>::max_chars
can be a constant if the specialization is only in a .cpp file. The specialization needs to remain in the header, with the condition adjusted appropriately.
float128.cpp
seems to be unnecessary, as it doesn't contain anything.
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin.v2/libs/charconv/build/clang-darwin-14/release/cxxstd-11-iso/link-static/threading-multi/visibility-hidden/libboost_charconv.a(float128.o) has no symbols
I'm not sure I understand why CI passes even though the conditions in to_chars.cpp
and from_chars.cpp
haven't been adjusted; it's probably because we don't have a configuration where quadmath.h
exists but libquadmath
does not.
The limits thing should also cause failures but doesn't; maybe we aren't testing it, or maybe I'm missing something.
float128.cpp
seems to be unnecessary, as it doesn't contain anything./Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin.v2/libs/charconv/build/clang-darwin-14/release/cxxstd-11-iso/link-static/threading-multi/visibility-hidden/libboost_charconv.a(float128.o) has no symbols
Won't it only have symbols if __float128
is supported? I thought Intel Macs didn't support the type, and I know ARM is unsupported by <quadmath.h>
.
Yes, we are only testing limits
for the three standard floating point types:
https://github.com/boostorg/charconv/blob/d1236abb2e003825d5ccda4cb628aadde9fd92c5/test/limits.cpp#L228-L230
Won't it only have symbols if
__float128
is supported? I thought Intel Macs didn't support the type, and I know ARM is unsupported by<quadmath.h>
.
Yes, you're right.
Although... since float128_impl.hpp
is included in to_chars.cpp
and from_chars.cpp
, I'm not sure float128.cpp
is needed for anything even when quadmath is supported.
Yes, we are only testing
limits
for the three standard floating point types:
Although I think these tests are getting completely skipped because they used the macro. It was the workaround for the Cmake tests failing on quadmath a while back.
Won't it only have symbols if
__float128
is supported? I thought Intel Macs didn't support the type, and I know ARM is unsupported by<quadmath.h>
.Yes, you're right.
Although... since
float128_impl.hpp
is included into_chars.cpp
andfrom_chars.cpp
, I'm not surefloat128.cpp
is needed for anything even when quadmath is supported.
I will get rid of it.
Although I think these tests are getting completely skipped because they used the macro.
Should probably be changed to use the new macro, and the tests in limits.cpp
updated for the rest of the floating point types when supported.
I wonder whether BOOST_CHARCONV_HAS_QUADMATH
isn't a better name for this macro, especially if the user needs to define it himself in case the library is used directly, without b2 or CMake.
I wonder whether
BOOST_CHARCONV_HAS_QUADMATH
isn't a better name for this macro, especially if the user needs to define it himself in case the library is used directly, without b2 or CMake.
I'd agree with that. I'll add it to the build section of the docs too.
An automated preview of the documentation is available at https://177.charconv.prtest.cppalliance.org/libs/charconv/doc/html/index.html
An automated preview of the documentation is available at https://177.charconv.prtest.cppalliance.org/libs/charconv/doc/html/index.html
GCC 13 fails the _Float16 limits tests on Drone.
Looks like we need to update our CI - GHA is missing GCC 13, Clang 16, Clang 17, macos-13, Drone is missing Clang 16 and 17.
Although it occurs to me that (a) updating the CI and (b) adding the float16/float32 tests to limits.cpp can be done in separate branches/PRs, as they are off-topic here.
GCC 13 fails the _Float16 limits tests on Drone.
Looks like we need to update our CI - GHA is missing GCC 13, Clang 16, Clang 17, macos-13, Drone is missing Clang 16 and 17.
It's probably the exact same issue as: https://github.com/boostorg/charconv/issues/156. I guess I can knock them both out in a different PR.
An automated preview of the documentation is available at https://177.charconv.prtest.cppalliance.org/libs/charconv/doc/html/index.html
Closes: #176
@pdimov What do you think of this? I think the number of people who want quadmath support is smaller than the number of people using CMake, which makes it really easy to hit the linked issue.