Fix stringent compiler warnings
Fixed various compiler warnings, some of which looked like real (albeit minor) bugs.
The compilers used were:
GCC 11.2.0: g++ -Wall -Wextra -Woverloaded-virtual -Wshadow
Clang 12.0.0: clang++ -Wall -Wextra -Woverloaded-virtual
This test can be repeated with LCG_102
:
source /cvmfs/sft.cern.ch/lcg/views/LCG_102/x86_64-centos7-gcc11-opt/setup.sh
mkdir build
cd build
CXXFLAGS="-Wall -Wextra -Woverloaded-virtual -Wshadow" cmake ..
make -j4
(and similarly for x86_64-centos7-clang12-opt
).
Alternatively, the stand-alone GNUmakefile
(make
in the repo root) has those warnings already enabled, but doesn't make all the test suite.
The particular warnings from GCC were:
-Woverloaded-virtual
-Wunused-parameter
-Wignored-qualifiers
-Wimplicit-fallthrough
After fixing those, Clang identified some more:
-Winconsistent-missing-override
-Wmismatched-tags
-Winstantiation-after-specialization
Clang identifies one remaining warning:
[ 26%] Building CXX object CMakeFiles/RooUnfold.dir/src/RooUnfoldInvert.o
src/RooFitUnfold.cxx:863:45: warning: unused parameter 'alg' ('regparam') [-Wunused-parameter]
RooAbsPdf* RooUnfoldSpec::makePdf(Algorithm alg, Double_t regparam){
but this is only activated with -DNO_WRAPPERPDF
, so not trivial to fix in general.
One other change: listed new algorithms in RooUnfoldTest -h
help.
Edited by Tim Adye