ETLCPP / etl

Embedded Template Library
https://www.etlcpp.com
MIT License
2.17k stars 388 forks source link

Allow Building Tests as Submodule and GCC < 11 #777

Closed jmartens-42 closed 11 months ago

jmartens-42 commented 11 months ago

moved BUILD_TESTS check outside of root cmake check to allow building tests when ETL is a submodule

added check for GNUC >= 11 for -Wstringop-overread ignore pragma since it isn't introduced until gcc/g++-11

semanticdiff-com[bot] commented 11 months ago

Review changes with SemanticDiff

jwellbelove commented 11 months ago

There seems to be an issue with the Clang C++20 STL tests. It seems to be unhappy with its own library.

In file included from /home/runner/work/etl/etl/test/test_bip_buffer_spsc_atomic.cpp:32:
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/chrono:2320:48: error: call to consteval function 'std::chrono::hh_mm_ss::_S_fractional_width' is not a constant expression
        static constexpr unsigned fractional_width = {_S_fractional_width()};
                                                      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/chrono:2320:48: note: undefined function '_S_fractional_width' cannot be used in a constant expression
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/chrono:22[75](https://github.com/ETLCPP/etl/actions/runs/6641670039/job/18073735184?pr=777#step:3:76):2: note: declared here
        _S_fractional_width()
jmartens-42 commented 11 months ago

I haven't found a way to reproduce the issue. I can build with the following cmake command on Ubuntu 22.04.3 VM:

cmake -S . -B build -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 -DCMAKE_EXE_LINKER_FLAGS="-lstdc++ -lm" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

I'm attaching my compile commands file, but this is the command used for our troublemaker:

"/usr/bin/clang++-14 -DETL_DEBUG -I/magna/etl/test/../include -isystem /magna/etl/test/UnitTest++/.. -fno-omit-frame-pointer -fno-common -Wall -Wextra -Werror -std=gnu++2a -o CMakeFiles/etl_tests.dir/test_bip_buffer_spsc_atomic.cpp.o -c /magna/etl/test/test_bip_buffer_spsc_atomic.cpp"

Any thoughts on the best way to troubleshoot this?

compile_commands.json

jwellbelove commented 11 months ago

It seems to be a Github Actions issue https://github.com/actions/runner-images/issues/8659