geant4: fix 10.7 build with c++20 (#48347)

This commit is contained in:
Seth R. Johnson 2025-01-07 10:14:18 -05:00 committed by GitHub
parent aee2f5cf41
commit d16a578242
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 45 additions and 17 deletions

View File

@ -0,0 +1,26 @@
diff --git a/source/g3tog4/include/G3EleTable.hh b/source/g3tog4/include/G3EleTable.hh
index 0ab9c4fd566..18c6f73fde6 100644
--- a/source/g3tog4/include/G3EleTable.hh
+++ b/source/g3tog4/include/G3EleTable.hh
@@ -56,7 +56,7 @@ public: // with description
private:
void LoadUp();
- G4int parse(G4double& Z, char* name, char* sym, G4double& A);
+ G4int parse(G4double& Z, char (&name)[20], char (&sym)[3], G4double& A);
private:
diff --git a/source/g3tog4/src/G3EleTable.cc b/source/g3tog4/src/G3EleTable.cc
index cecc494b201..a2f3af3d6a2 100644
--- a/source/g3tog4/src/G3EleTable.cc
+++ b/source/g3tog4/src/G3EleTable.cc
@@ -64,7 +64,7 @@ G3EleTable::GetEle(G4double Z){
}
G4int
-G3EleTable::parse(G4double& Z, char* name, char* sym, G4double& A){
+G3EleTable::parse(G4double& Z, char (&name)[20], char (&sym)[3], G4double& A){
G4int rc = 0;
if (Z>0 && Z <=_MaxEle){
G4int z = (G4int) Z-1;

View File

@ -20,6 +20,7 @@ class Geant4(CMakePackage):
executables = ["^geant4-config$"]
maintainers("drbenmorgan", "sethrj")
version("11.3.0", sha256="d9d71daff8890a7b5e0e33ea9a65fe6308ad6713000b43ba6705af77078e7ead")
version("11.2.2", sha256="3a8d98c63fc52578f6ebf166d7dffaec36256a186d57f2520c39790367700c8d")
version("11.2.1", sha256="76c9093b01128ee2b45a6f4020a1bcb64d2a8141386dea4674b5ae28bcd23293")
@ -203,29 +204,30 @@ def std_when(values):
depends_on("qt@5.9:", when="@11.2:")
conflicts("@:11.1 ^[virtuals=qmake] qt-base", msg="Qt6 not supported before 11.2")
# CMAKE PROBLEMS #
# As released, 10.0.4 has inconsistently capitalised filenames
# in the cmake files; this patch also enables cxxstd 14
patch("geant4-10.0.4.patch", when="@10.0.4")
# Fix member field typo in g4tools wroot
# See https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2640
patch("columns-11.patch", when="@11:11.2.2")
patch("columns-10.patch", when="@10.4:10")
# As released, 10.03.03 has issues with respect to using external
# CLHEP.
patch("CLHEP-10.03.03.patch", level=1, when="@10.3")
# Build failure on clang 15, ubuntu 22: see Geant4 problem report #2444
# fixed by ascii-V10-07-03
patch("geant4-10.6.patch", level=1, when="@10.0:10.6")
# These patches can be applied independent of the cxxstd value?
patch("cxx17.patch", when="@10.3 cxxstd=17")
patch("cxx17_geant4_10_0.patch", level=1, when="@10.4.0 cxxstd=17")
patch("geant4-10.4.3-cxx17-removed-features.patch", level=1, when="@10.4.3 cxxstd=17")
patch("geant4-10.6.patch", when="@10.0:10.6")
# Enable "17" cxxstd option in CMake (2 different filenames)
patch("geant4-10.3-cxx17-cmake.patch", when="@10.3 cxxstd=17")
patch("geant4-10.4-cxx17-cmake.patch", when="@10.4:10.4.2 cxxstd=17")
# Fix exported cmake: https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2556
patch("package-cache.patch", when="@10.7.0:11.1.2^cmake@3.17:")
# See https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2556
patch("package-cache.patch", level=1, when="@10.7.0:11.1.2^cmake@3.17:")
# Issue with Twisted tubes, see https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2619
patch("twisted-tubes.patch", level=1, when="@11.2.0:11.2.2")
# BUILD ERRORS #
# Fix C++17: add -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES C++ flag
patch("geant4-10.4.3-cxx17-removed-features.patch", when="@10.4.3 cxxstd=17")
# Fix C++20: build error due to removed-in-C++20 `ostream::operator>>(char*)`
# (different, simpler approach than upstream Geant4 changes)
patch("geant4-10.7-cxx20-g3tog4.patch", when="@:10.7 cxxstd=20")
# Fix member field typo in g4tools wroot: https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2640
patch("columns-10.patch", when="@10.4:10")
patch("columns-11.patch", when="@11:11.2.2")
# Fix navigation errors with twisted tubes: https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2619
patch("twisted-tubes.patch", when="@11.2.0:11.2.2")
# NVHPC: "thread-local declaration follows non-thread-local declaration"
conflicts("%nvhpc", when="+threads")