From a7b4b84048e9a88c8e78f017fc98e8d2632f46af Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Tue, 2 May 2017 00:54:42 -0400 Subject: sherpa: fix for llvm 4 --- .../science/physics/sherpa/default.nix | 3 + .../physics/sherpa/explicit_overloads.patch | 119 +++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 pkgs/applications/science/physics/sherpa/explicit_overloads.patch (limited to 'pkgs/applications/science/physics') diff --git a/pkgs/applications/science/physics/sherpa/default.nix b/pkgs/applications/science/physics/sherpa/default.nix index e815ddfc1c2f..e1e7c43943a7 100644 --- a/pkgs/applications/science/physics/sherpa/default.nix +++ b/pkgs/applications/science/physics/sherpa/default.nix @@ -13,6 +13,9 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; + # LLVM 4 doesn't allow ambigous type in std::abs argument + patches = stdenv.lib.optional stdenv.cc.isClang [ ./explicit_overloads.patch ]; + configureFlags = [ "--with-sqlite3=${sqlite.dev}" "--enable-hepmc2=${hepmc}" diff --git a/pkgs/applications/science/physics/sherpa/explicit_overloads.patch b/pkgs/applications/science/physics/sherpa/explicit_overloads.patch new file mode 100644 index 000000000000..33e5a7632178 --- /dev/null +++ b/pkgs/applications/science/physics/sherpa/explicit_overloads.patch @@ -0,0 +1,119 @@ +diff --git a/ATOOLS/Phys/Flavour.C b/ATOOLS/Phys/Flavour.C +index 1986348..740eea3 100644 +--- a/ATOOLS/Phys/Flavour.C ++++ b/ATOOLS/Phys/Flavour.C +@@ -298,8 +298,8 @@ std::string Flavour::IDName() const + + bool Flavour::IsDiQuark() const + { +- if(abs(Kfcode())>=1103&&abs(Kfcode())<=5505) { +- double help=abs(Kfcode())/100.0-int(abs(Kfcode())/100.0); ++ if(abs((long)Kfcode())>=1103&&abs((long)Kfcode())<=5505) { ++ double help=abs((long)Kfcode())/100.0-int(abs((long)Kfcode())/100.0); + if(help<0.031) return true; + } + return false; +@@ -307,27 +307,27 @@ bool Flavour::IsDiQuark() const + + bool Flavour::IsBaryon() const + { +- if (abs(Kfcode())%10000<1000) return false; ++ if (abs((long)Kfcode())%10000<1000) return false; + return !IsDiQuark(); + } + + bool Flavour::IsB_Hadron() const + { +- if (abs(Kfcode())<100) return 0; ++ if (abs((long)Kfcode())<100) return 0; + if (Kfcode()-100*int(Kfcode()/100)<10) return 0; +- if (abs((Kfcode()-100*int(Kfcode()/100))/10)==5) return 1; +- if (abs((Kfcode()-1000*int(Kfcode()/1000))/100)==5) return 1; +- if (abs((Kfcode()-10000*int(Kfcode()/10000))/1000)==5) return 1; ++ if (abs((long)(Kfcode()-100*int(Kfcode()/100))/10)==5) return 1; ++ if (abs((long)(Kfcode()-1000*int(Kfcode()/1000))/100)==5) return 1; ++ if (abs((long)(Kfcode()-10000*int(Kfcode()/10000))/1000)==5) return 1; + return 0; + } + + bool Flavour::IsC_Hadron() const + { +- if (abs(Kfcode())<100) return 0; ++ if (abs((long)Kfcode())<100) return 0; + if (Kfcode()-100*int(Kfcode()/100)<10) return 0; +- if (abs((Kfcode()-100*int(Kfcode()/100))/10)==4) return 1; +- if (abs((Kfcode()-1000*int(Kfcode()/1000))/100)==4) return 1; +- if (abs((Kfcode()-10000*int(Kfcode()/10000))/1000)==4) return 1; ++ if (abs((long)(Kfcode()-100*int(Kfcode()/100))/10)==4) return 1; ++ if (abs((long)(Kfcode()-1000*int(Kfcode()/1000))/100)==4) return 1; ++ if (abs((long)(Kfcode()-10000*int(Kfcode()/10000))/1000)==4) return 1; + return 0; + } + +diff --git a/AddOns/Pythia/Pythia_Jet_Criterion.C b/AddOns/Pythia/Pythia_Jet_Criterion.C +index bbe9597..c1201e1 100644 +--- a/AddOns/Pythia/Pythia_Jet_Criterion.C ++++ b/AddOns/Pythia/Pythia_Jet_Criterion.C +@@ -117,8 +117,8 @@ namespace PYTHIA { + double Qsq = sign * Q.Abs2(); + // Mass term of radiator + DEBUG_VAR(ampl->MS()); +- double m2Rad = ( abs(RadAfterBranch.Flav().Kfcode()) >= 4 +- && abs(RadAfterBranch.Flav().Kfcode()) < 7) ++ double m2Rad = ( abs((long)RadAfterBranch.Flav().Kfcode()) >= 4 ++ && abs((long)RadAfterBranch.Flav().Kfcode()) < 7) + ? ampl->MS()->Mass2(RadAfterBranch.Flav()) + : 0.; + // Construct 2->3 variables for FSR +diff --git a/BEAM/Main/EPA.C b/BEAM/Main/EPA.C +index 861a1b2..340ac33 100644 +--- a/BEAM/Main/EPA.C ++++ b/BEAM/Main/EPA.C +@@ -54,7 +54,7 @@ double EPA::CosInt::GetCosInt(double X) + + double EPA::phi(double x, double qq) + { +- if (abs(m_beam.Kfcode()) == kf_p_plus) { ++ if (abs((long)m_beam.Kfcode()) == kf_p_plus) { + const double a = 7.16; + const double b = -3.96; + const double c = .028; +@@ -179,7 +179,7 @@ bool EPA::CalculateWeight(double x,double q2) + m_weight=0.0; + return 1; + } +- if (abs(m_beam.Kfcode()) == kf_e) { ++ if (abs((long)m_beam.Kfcode()) == kf_e) { + double f = alpha/M_PI*(1+sqr(1-m_x))/m_x*log(2.*m_energy/m_mass); + if (f < 0) f = 0.; + m_weight = f; +@@ -187,7 +187,7 @@ bool EPA::CalculateWeight(double x,double q2) + <<"energy = "<Get()<0.25) +- anti=Flavour((kf_code)(abs(rem[0])*1000+abs(rem[1])*100+1)); ++ anti=Flavour((kf_code)(abs((long)rem[0])*1000+abs((long)rem[1])*100+1)); + } + else { +- anti=Flavour((kf_code)(abs(rem[0])*1100+3)); ++ anti=Flavour((kf_code)(abs((long)rem[0])*1100+3)); + } + if (flav.IsAnti()) anti=anti.Bar(); + return anti; -- cgit 1.4.1