diff --git a/.github/toolchains/linux-gnu-powerpc64le.cmake b/.github/toolchains/linux-gnu-powerpc64le.cmake new file mode 100644 index 00000000..0a31efae --- /dev/null +++ b/.github/toolchains/linux-gnu-powerpc64le.cmake @@ -0,0 +1,26 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CROSS_COMPILER_PREFIX /usr) +set(CROSS_COMPILER_TARGET powerpc64le-linux-gnu) +set(CMAKE_SYSTEM_PROCESSOR powerpc64le) +set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64le-static) +set(CMAKE_C_COMPILER ${CROSS_COMPILER_PREFIX}/bin/${CROSS_COMPILER_TARGET}-gcc) +set(CMAKE_CXX_COMPILER ${CROSS_COMPILER_PREFIX}/bin/${CROSS_COMPILER_TARGET}-g++) +set(CMAKE_AR ${CROSS_COMPILER_PREFIX}/bin/${CROSS_COMPILER_TARGET}-ar CACHE FILEPATH "Archiver") +set(CMAKE_MAKE_PROGRAM ${CROSS_COMPILER_PREFIX}/bin/make CACHE FILEPATH "make") + +# use -static to avoid having to install the dynamic loader +# see https://mfo.dev.br/2018/03/17/ppc64le-on-x86_64-cross-compilers.html +set(CMAKE_CXX_FLAGS -static) +set(CMAKE_C_FLAGS -static) + +set(CMAKE_FIND_ROOT_PATH ${CROSS_COMPILER_PREFIX}/${CROSS_COMPILER_TARGET}) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +# needed ubuntu packages: +# +# sudo apt-get install -y \ +# gcc-powerpc64le-linux-gnu \ +# g++-powerpc64le-linux-gnu \ +# qemu-user-system diff --git a/changelog/current.md b/changelog/current.md index e69de29b..714999d7 100644 --- a/changelog/current.md +++ b/changelog/current.md @@ -0,0 +1,8 @@ +## Fixes + +- Fix [#464](https://github.com/biojppm/rapidyaml/issues/464): test failures with g++14 -O2 in ppc64le ([PR#467](https://github.com/biojppm/rapidyaml/pull/467)) + + +## Thanks + +- @musicinmybrain diff --git a/src/c4/yml/parse_engine.def.hpp b/src/c4/yml/parse_engine.def.hpp index 4e46040a..ea20b5ac 100644 --- a/src/c4/yml/parse_engine.def.hpp +++ b/src/c4/yml/parse_engine.def.hpp @@ -3511,12 +3511,11 @@ csubstr ParseEngine::_filter_scalar_folded(substr s, size_t indent template csubstr ParseEngine::_maybe_filter_key_scalar_plain(ScannedScalar const& C4_RESTRICT sc, size_t indentation) { - csubstr maybe_filtered = sc.scalar; if(sc.needs_filter) { if(m_options.scalar_filtering()) { - maybe_filtered = _filter_scalar_plain(sc.scalar, indentation); + return _filter_scalar_plain(sc.scalar, indentation); } else { @@ -3528,18 +3527,17 @@ csubstr ParseEngine::_maybe_filter_key_scalar_plain(ScannedScalar { _c4dbgp("plain scalar doesn't need filtering"); } - return maybe_filtered; + return sc.scalar; } template csubstr ParseEngine::_maybe_filter_val_scalar_plain(ScannedScalar const& C4_RESTRICT sc, size_t indentation) { - csubstr maybe_filtered = sc.scalar; if(sc.needs_filter) { if(m_options.scalar_filtering()) { - maybe_filtered = _filter_scalar_plain(sc.scalar, indentation); + return _filter_scalar_plain(sc.scalar, indentation); } else { @@ -3551,7 +3549,7 @@ csubstr ParseEngine::_maybe_filter_val_scalar_plain(ScannedScalar { _c4dbgp("plain scalar doesn't need filtering"); } - return maybe_filtered; + return sc.scalar; } @@ -3560,12 +3558,11 @@ csubstr ParseEngine::_maybe_filter_val_scalar_plain(ScannedScalar template csubstr ParseEngine::_maybe_filter_key_scalar_squot(ScannedScalar const& C4_RESTRICT sc) { - csubstr maybe_filtered = sc.scalar; if(sc.needs_filter) { if(m_options.scalar_filtering()) { - maybe_filtered = _filter_scalar_squot(sc.scalar); + return _filter_scalar_squot(sc.scalar); } else { @@ -3577,18 +3574,17 @@ csubstr ParseEngine::_maybe_filter_key_scalar_squot(ScannedScalar { _c4dbgp("squo key scalar doesn't need filtering"); } - return maybe_filtered; + return sc.scalar; } template csubstr ParseEngine::_maybe_filter_val_scalar_squot(ScannedScalar const& C4_RESTRICT sc) { - csubstr maybe_filtered = sc.scalar; if(sc.needs_filter) { if(m_options.scalar_filtering()) { - maybe_filtered = _filter_scalar_squot(sc.scalar); + return _filter_scalar_squot(sc.scalar); } else { @@ -3600,7 +3596,7 @@ csubstr ParseEngine::_maybe_filter_val_scalar_squot(ScannedScalar { _c4dbgp("squo val scalar doesn't need filtering"); } - return maybe_filtered; + return sc.scalar; } @@ -3609,12 +3605,11 @@ csubstr ParseEngine::_maybe_filter_val_scalar_squot(ScannedScalar template csubstr ParseEngine::_maybe_filter_key_scalar_dquot(ScannedScalar const& C4_RESTRICT sc) { - csubstr maybe_filtered = sc.scalar; if(sc.needs_filter) { if(m_options.scalar_filtering()) { - maybe_filtered = _filter_scalar_dquot(sc.scalar); + return _filter_scalar_dquot(sc.scalar); } else { @@ -3626,18 +3621,17 @@ csubstr ParseEngine::_maybe_filter_key_scalar_dquot(ScannedScalar { _c4dbgp("dquo scalar doesn't need filtering"); } - return maybe_filtered; + return sc.scalar; } template csubstr ParseEngine::_maybe_filter_val_scalar_dquot(ScannedScalar const& C4_RESTRICT sc) { - csubstr maybe_filtered = sc.scalar; if(sc.needs_filter) { if(m_options.scalar_filtering()) { - maybe_filtered = _filter_scalar_dquot(sc.scalar); + return _filter_scalar_dquot(sc.scalar); } else { @@ -3649,7 +3643,7 @@ csubstr ParseEngine::_maybe_filter_val_scalar_dquot(ScannedScalar { _c4dbgp("dquo scalar doesn't need filtering"); } - return maybe_filtered; + return sc.scalar; } @@ -3658,33 +3652,31 @@ csubstr ParseEngine::_maybe_filter_val_scalar_dquot(ScannedScalar template csubstr ParseEngine::_maybe_filter_key_scalar_literal(ScannedBlock const& C4_RESTRICT sb) { - csubstr maybe_filtered = sb.scalar; if(m_options.scalar_filtering()) { - maybe_filtered = _filter_scalar_literal(sb.scalar, sb.indentation, sb.chomp); + return _filter_scalar_literal(sb.scalar, sb.indentation, sb.chomp); } else { _c4dbgp("literal scalar left unfiltered"); m_evt_handler->mark_key_scalar_unfiltered(); } - return maybe_filtered; + return sb.scalar; } template csubstr ParseEngine::_maybe_filter_val_scalar_literal(ScannedBlock const& C4_RESTRICT sb) { - csubstr maybe_filtered = sb.scalar; if(m_options.scalar_filtering()) { - maybe_filtered = _filter_scalar_literal(sb.scalar, sb.indentation, sb.chomp); + return _filter_scalar_literal(sb.scalar, sb.indentation, sb.chomp); } else { _c4dbgp("literal scalar left unfiltered"); m_evt_handler->mark_val_scalar_unfiltered(); } - return maybe_filtered; + return sb.scalar; } @@ -3693,33 +3685,31 @@ csubstr ParseEngine::_maybe_filter_val_scalar_literal(ScannedBlock template csubstr ParseEngine::_maybe_filter_key_scalar_folded(ScannedBlock const& C4_RESTRICT sb) { - csubstr maybe_filtered = sb.scalar; if(m_options.scalar_filtering()) { - maybe_filtered = _filter_scalar_folded(sb.scalar, sb.indentation, sb.chomp); + return _filter_scalar_folded(sb.scalar, sb.indentation, sb.chomp); } else { _c4dbgp("folded scalar left unfiltered"); m_evt_handler->mark_key_scalar_unfiltered(); } - return maybe_filtered; + return sb.scalar; } template csubstr ParseEngine::_maybe_filter_val_scalar_folded(ScannedBlock const& C4_RESTRICT sb) { - csubstr maybe_filtered = sb.scalar; if(m_options.scalar_filtering()) { - maybe_filtered = _filter_scalar_folded(sb.scalar, sb.indentation, sb.chomp); + return _filter_scalar_folded(sb.scalar, sb.indentation, sb.chomp); } else { _c4dbgp("folded scalar left unfiltered"); m_evt_handler->mark_val_scalar_unfiltered(); } - return maybe_filtered; + return sb.scalar; }