Skip to content

fix all compiler warnings for AnalysisBase on latest MacOS

Nils Erik Krumnack requested to merge krumnack/athena:mac_warning into master

New compiler, new set of warnings...

The main theme here is that clang now checks for range-based for loops whether it introduces unneeded temporaries, i.e. if the user asks for a reference for the loop variable, but the iterator doesn't return a reference or a reference of a different type, or conversely if the user asked for const auto, but could have been const auto&.

In practice that usually hits us as:

for (const auto& jet : jetContainer)

which should be:

for (const auto *jet : jetContainer)

Also a couple of places like this (which miss the const qualifier on the first template parameter):

std::map<std::string,std::string> stringMap;
for (const std::pair<std::string,std::string>& stringPair : stringMap)

For the most part I just replaced the loop variable type with what seemed correct. In a few places I put explicit comments as to why I chose the type.

Also a fair number of warnings for unused member variables in various packages. Since I am not an expert on any of these packages and this can point to an actual bug, I commented out all unused variables and added a comment for actual experts to check and remove.

I removed a couple of checks for this != nullptr which were originally introduced to check whether the user called a member function via a null pointer. However those checks are assert-based, so with cmake they won't be included when the user calls them from a release, making this check mostly useless.

There some other warnings I fixed in the process that should hopefully be self-explanatory.

Merge request reports