jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
4.91k stars 1.78k forks source link

Fix testsuite with gcc-13 #1216

Closed LocutusOfBorg closed 10 months ago

LocutusOfBorg commented 10 months ago

cd /<>/build-static/test && /usr/bin/c++ -DYAML_CPP_STATIC_DEFINE -I/<>/test/integration -I/<>/test -I/<>/src -I/<>/include -isystem /usr/src/googletest/googlemock/include -isystem /usr/src/googletest/googlemock -isystem /usr/src/googletest/googletest/include -isystem /usr/src/googletest/googletest -g -O2 -ffile-prefix-map=/<>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fdebug-prefix-map=/<>=/usr/src/yaml-cpp-0.8.0+dfsg-1~build1 -Wdate-time -D_FORTIFY_SOURCE=2 -std=gnu++14 -Wno-variadic-macros -Wno-sign-compare -DGTEST_HAS_PTHREAD=1 -MD -MT test/CMakeFiles/yaml-cpp-tests.dir/binary_test.cpp.o -MF CMakeFiles/yaml-cpp-tests.dir/binary_test.cpp.o.d -o CMakeFiles/yaml-cpp-tests.dir/binary_test.cpp.o -c /<>/test/binary_test.cpp /<>/test/binary_test.cpp: In member function ‘virtual void BinaryTest_DecodingNoCrashOnNegative_Test::TestBody()’: /<>/test/binary_test.cpp:11:38: error: narrowing conversion of ‘-58’ from ‘int’ to ‘char’ [-Wnarrowing] 11 | std::string input{-58, -1, -99, 109}; | ^

jbeder commented 10 months ago

What does this do? It looks like you just enabled a warning.

LocutusOfBorg commented 10 months ago

@jbeder the -Wnarrowing is now default in gcc-13, and you can't convert -58 and -99 into unsigned char. I pushed -Wno-narrowing flag in cmake file, to disable that check for tests

LocutusOfBorg commented 10 months ago

See e.g. https://launchpadlibrarian.net/682795834/buildlog_ubuntu-mantic-s390x.yaml-cpp_0.8.0+dfsg-1~build1_BUILDING.txt.gz