Commit 8299b82e authored by Lynn Garren's avatar Lynn Garren

protect against warnings about variables that are used inside asserts

parent 952bf539
......@@ -4,13 +4,16 @@
* Vector, Random, Matrix: remove register declaration of ints and doubles
use of register is now redundant and ignored by modern compilers
* GenericFunctions, Geometry/test, Utility/test, Vector/test:
protect against warnings about variables that are used inside asserts
==============================
18.11.13 Release CLHEP-2.1.4.1
==============================
2013-11-18 Lynn Garren <garren@fnal.gov>
* src/setSystemOfUnits.cc: additional units to match Units
* Evaluator/src/setSystemOfUnits.cc: additional units to match Units
2013-11-14 Lynn Garren <garren@fnal.gov>
......
2014-02-24 Lynn Garren <garren@fnal.gov>
* protect against warnings about variables that are used inside asserts
==============================
14.11.13 Release CLHEP-2.1.4.1
==============================
......
......@@ -23,7 +23,17 @@ double ACos::operator() (double x) const {
return acos(x);
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative ACos::partial(unsigned int index) const {
assert(index==0);
......@@ -33,6 +43,14 @@ Derivative ACos::partial(unsigned int index) const {
const AbsFunction & fPrime = - 1.0/root(1.0-square) ;
return Derivative(& fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // end namespace Genfun
......
......@@ -23,8 +23,17 @@ double ASin::operator() (double x) const {
return asin(x);
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative ASin::partial(unsigned int index) const {
assert(index==0);
......@@ -34,5 +43,13 @@ Derivative ASin::partial(unsigned int index) const {
const AbsFunction & fPrime = 1.0/root(1.0-square) ;
return Derivative(& fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // end namespace Genfun
......@@ -22,8 +22,17 @@ double ATan::operator() (double x) const {
return atan(x);
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative ATan::partial(unsigned int index) const {
assert(index==0);
......@@ -32,5 +41,13 @@ Derivative ATan::partial(unsigned int index) const {
const AbsFunction & fPrime=1.0/(1.0+square);;
return Derivative(& fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // end namespace Genfun
......@@ -26,8 +26,17 @@ double Erf::operator() (double x) const {
return x<0 ? -_incompleteGamma(x*x): _incompleteGamma(x*x);
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative Erf::partial(unsigned int index) const {
assert(index==0);
Gaussian gauss = Gaussian();
......@@ -35,5 +44,13 @@ Derivative Erf::partial(unsigned int index) const {
const AbsFunction & fPrime = 2.0*gauss;
return Derivative(& fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -20,11 +20,29 @@ double Exp::operator() (double x) const {
return exp(x);
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative Exp::partial(unsigned int index) const {
assert(index==0);
return Derivative(this);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -33,12 +33,30 @@ const Parameter & Exponential::decayConstant() const {
return _decayConstant;
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative Exponential::partial(unsigned int index) const {
assert(index==0);
const AbsFunction & fPrime = -_decayConstant*(*this);
return Derivative(&fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -24,10 +24,29 @@ double FixedConstant::operator ()(double) const
return _value;
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative FixedConstant::partial(unsigned int index) const {
assert(index==0);
FixedConstant fPrime(0.0);
return Derivative(&fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -29,9 +29,28 @@ double FloatingConstant::operator ()(double) const
return _value->getValue();
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative FloatingConstant::partial(unsigned int index) const {
assert(index==0);
FixedConstant fPrime(0.0);
return Derivative(&fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -53,13 +53,30 @@ const Parameter & Gaussian::sigma() const {
return _sigma;
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative Gaussian::partial(unsigned int index) const {
assert(index==0);
Variable x;
const AbsFunction & fPrime = (*this)*(_mean-x)/_sigma/_sigma;
return Derivative(&fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -23,10 +23,29 @@ double KroneckerDelta::operator() (double x) const {
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative KroneckerDelta::partial(unsigned int index) const {
assert(index==0);
const AbsFunction & fPrime = FixedConstant(0);;
return Derivative(&fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -24,12 +24,29 @@ double Ln::operator() (double x) const {
return log(x);
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative Ln::partial(unsigned int index) const {
assert(index==0);
const AbsFunction & fPrime = 1.0/Variable();
return Derivative(& fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -49,12 +49,29 @@ Parameter & PeriodicRectangular::height() {
return _height;
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative PeriodicRectangular::partial(unsigned int index) const {
assert(index==0);
const AbsFunction & fPrime = FixedConstant(0);
return Derivative(&fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -70,11 +70,29 @@ const Parameter & Rectangular::height() const{
return _height;
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative Rectangular::partial(unsigned int index) const {
assert(index==0);
const AbsFunction & fPrime = FixedConstant(0);;
return Derivative(&fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -29,12 +29,29 @@ Parameter & ReverseExponential::decayConstant() {
return _decayConstant;
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative ReverseExponential::partial(unsigned int index) const {
assert(index==0);
const AbsFunction & fPrime = _decayConstant*(*this);
return Derivative(&fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -22,12 +22,29 @@ double Sin::operator() (double x) const {
return sin(x);
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative Sin::partial(unsigned int index) const {
assert(index==0);
const AbsFunction & fPrime = Cos();
return Derivative(& fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -20,12 +20,29 @@ double Sqrt::operator() (double x) const {
return sqrt(x);
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative Sqrt::partial(unsigned int index) const {
assert(index==0);
const AbsFunction & fPrime = (0.5)/Sqrt();
return Derivative(&fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -21,14 +21,30 @@ double Square::operator() (double x) const {
return x*x;
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative Square::partial(unsigned int index) const {
assert(index==0);
Variable x;
const AbsFunction & fPrime = 2*x;
return Derivative(&fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -24,12 +24,29 @@ double Tan::operator() (double x) const {
return tan(x);
}
// don't generate warnings about unused parameter inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
Derivative Tan::partial(unsigned int index) const {
assert(index==0);
const AbsFunction & fPrime = 1.0/Cos()/Cos();
return Derivative(& fPrime);
}
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic pop
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // namespace Genfun
......@@ -6,6 +6,18 @@
#include <assert.h>
#include <cmath>
// don't generate warnings about unused variables inside assert
#if defined __GNUC__
#if __GNUC__ > 3 && __GNUC_MINOR__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#endif