pythia8: Include patch for C++20 / Clang (#47400)

* pythia8: Include patch for C++20 / Clang

Pythia8 vendors some FJCore sources that are as of Pythia8 312
incompatible with C++20 on clang. This adds a patch that makes it
compatible in these scenarios

* Add issue link

* rename setup_cxxstd function

* Remove an accidental printout

* Apply patch to all compilers, add lower bound
This commit is contained in:
Paul Gessinger 2024-11-05 03:34:47 +01:00 committed by GitHub
parent 8650ba3cea
commit f8da72cffe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 47 additions and 7 deletions

View File

@ -132,17 +132,20 @@ class Pythia8(AutotoolsPackage):
filter_compiler_wrappers("Makefile.inc", relative_root="share/Pythia8/examples")
@run_before("configure")
def setup_cxxstd(self):
def setup_configure(self):
filter_file(
r"-std=c\+\+[0-9][0-9]", f"-std=c++{self.spec.variants['cxxstd'].value}", "configure"
)
# Fix for https://gitlab.com/Pythia8/releases/-/issues/428
@when("@:8.311")
def patch(self):
filter_file(
r"[/]examples[/]Makefile[.]inc\|;n' \\", "/examples/Makefile.inc|' \\", "configure"
)
# Fix for https://gitlab.com/Pythia8/releases/-/issues/428
with when("@:8.311"):
filter_file(
r"[/]examples[/]Makefile[.]inc\|;n' \\", "/examples/Makefile.inc|' \\", "configure"
)
# Fix for https://gitlab.com/Pythia8/releases/-/issues/523
with when("@8.307:8.312 cxxstd=20"):
patch("pythia8-cpp20-fjcore-forward-decl.patch")
def configure_args(self):
args = []

View File

@ -0,0 +1,37 @@
diff --git a/src/FJcore.cc b/src/FJcore.cc
index c60108e2..afd32eee 100644
--- a/src/FJcore.cc
+++ b/src/FJcore.cc
@@ -730,14 +730,10 @@ FJCORE_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
class ClosestPair2D : public ClosestPair2DBase {
public:
ClosestPair2D(const std::vector<Coord2D> & positions,
- const Coord2D & left_corner, const Coord2D & right_corner) {
- _initialize(positions, left_corner, right_corner, positions.size());
- };
+ const Coord2D & left_corner, const Coord2D & right_corner);
ClosestPair2D(const std::vector<Coord2D> & positions,
const Coord2D & left_corner, const Coord2D & right_corner,
- const unsigned int max_size) {
- _initialize(positions, left_corner, right_corner, max_size);
- };
+ const unsigned int max_size);
void closest_pair(unsigned int & ID1, unsigned int & ID2,
double & distance2) const;
void remove(unsigned int ID);
@@ -808,6 +804,15 @@ public:
return coord.distance2(other.coord);
};
};
+inline ClosestPair2D::ClosestPair2D(const std::vector<Coord2D> & positions,
+ const Coord2D & left_corner, const Coord2D & right_corner) {
+ _initialize(positions, left_corner, right_corner, positions.size());
+};
+inline ClosestPair2D::ClosestPair2D(const std::vector<Coord2D> & positions,
+ const Coord2D & left_corner, const Coord2D & right_corner,
+ const unsigned int max_size) {
+ _initialize(positions, left_corner, right_corner, max_size);
+};
inline bool floor_ln2_less(unsigned x, unsigned y) {
if (x>y) return false;
return (x < (x^y)); // beware of operator precedence...