From 60490f04de40769969d17dc07df1ed01923cf8fd Mon Sep 17 00:00:00 2001 From: Gregor Weiss Date: Tue, 26 Sep 2023 09:23:31 +0200 Subject: [PATCH] Add hacks due to remaining issues in port --- src/foam/containers/Lists/UList/UListIO.C | 5 +++++ .../db/IOstreams/SliceStreams/UListProxy.C | 10 ++++++++++ .../SliceStreams/primitives_traits.H | 19 +++++++++++++++++++ wmake/rules/linux64Gcc/c++ | 3 ++- 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/foam/containers/Lists/UList/UListIO.C b/src/foam/containers/Lists/UList/UListIO.C index 16d3272ad..e2b68ac51 100644 --- a/src/foam/containers/Lists/UList/UListIO.C +++ b/src/foam/containers/Lists/UList/UListIO.C @@ -105,6 +105,10 @@ Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList& L) bool uniform = false; +/****************** TODO port: hacks to circumvent errors in UListIO.C >>>>>>>>>>>>>>>*/ +// ALSO REQUIRES c++17 currently. roll-back required to c++11 + if constexpr (is_inequality_comparable::value) + { if (L.size() > 1 && contiguous()) { uniform = true; @@ -178,6 +182,7 @@ Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList& L) // Write end delimiter os << nl << token::END_LIST << nl; } + } } else if (os.format() == IOstream::BINARY) { diff --git a/src/foam/db/IOstreams/SliceStreams/UListProxy.C b/src/foam/db/IOstreams/SliceStreams/UListProxy.C index 26832de95..e6c1b1d3e 100644 --- a/src/foam/db/IOstreams/SliceStreams/UListProxy.C +++ b/src/foam/db/IOstreams/SliceStreams/UListProxy.C @@ -54,6 +54,10 @@ void Foam::UListProxy::writeFirstElement const char* data ) const { +/****************** TODO port: hacks to circumvent errors in UListIO.C >>>>>>>>>>>>>>>*/ +// ALSO REQUIRES c++17 currently. roll-back required to c++11 + if constexpr (is_inequality_comparable::value) + { if (data) { const T* dataT = reinterpret_cast(data); @@ -65,6 +69,7 @@ void Foam::UListProxy::writeFirstElement << "Given data pointer is nullptr." << abort(FatalError); } + } } @@ -160,6 +165,10 @@ Foam::UListProxy::determineUniformity() const { uListProxyBase::uniformity u = uListProxyBase::UNIFORM; +/****************** TODO port: hacks to circumvent errors in UListIO.C >>>>>>>>>>>>>>>*/ +// ALSO REQUIRES c++17 currently. roll-back required to c++11 + if constexpr (is_inequality_comparable::value) + { // Skip comparison of the first element with itself for (label i = 1; i < nElems; i++) { @@ -169,6 +178,7 @@ Foam::UListProxy::determineUniformity() const break; } } + } return u; } diff --git a/src/foam/db/IOstreams/SliceStreams/primitives_traits.H b/src/foam/db/IOstreams/SliceStreams/primitives_traits.H index 0768c1ba2..217237961 100644 --- a/src/foam/db/IOstreams/SliceStreams/primitives_traits.H +++ b/src/foam/db/IOstreams/SliceStreams/primitives_traits.H @@ -108,6 +108,25 @@ struct is_vectorspace std::true_type {}; +/****************** TODO port: hacks to circumvent errors in UListIO.C >>>>>>>>>>>>>>>*/ + +// IS_INEQUALITY_COMPARABLE +// primary template +template> +struct is_inequality_comparable : std::false_type {}; + +//partial specialization, maybe SFINAE'd away +template +struct is_inequality_comparable +< + T, + Void_T() != std::declval())> +> +: + std::true_type +{}; + +/*<<<<<<<<<<<<<<<<<<<<< TODO port: hacks to circumvent errors in UListIO.C *************/ // TODO: This should probably go somewhere else. Toward VectorSpace ecosystem? template diff --git a/wmake/rules/linux64Gcc/c++ b/wmake/rules/linux64Gcc/c++ index 19e6f87ce..ad398da2d 100644 --- a/wmake/rules/linux64Gcc/c++ +++ b/wmake/rules/linux64Gcc/c++ @@ -5,7 +5,8 @@ c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual # Suppress some warnings for flex++ and CGAL c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds -CC = g++ -std=c++11 -m64 +# TODO port: return to c++11 again +CC = g++ -std=c++17 -m64 include $(RULES)/c++$(WM_COMPILE_OPTION)