Open tvami opened 9 months ago
return {};
outside the switch statements? GetShape()
, but I have no idea if it's a one to one translation (meaning, will the same arguments be needed)?Thanks for making this issue! Cleaning up our builds and allowing us to start making use of more static analysis as part of the CI is an important goal. There's a overarching issue for these things in https://github.com/LDMX-Software/ldmx-sw/issues/1176. I'll make a list of related issues in there and link this one
Since https://github.com/LDMX-Software/docker/pull/67 and https://github.com/LDMX-Software/cmake/pull/19 we have some additional tools in the development container that can give additional static analysis. For compiler warnings, there are some CMake flags you can enable to add additional warnings that you can see in https://github.com/LDMX-Software/cmake/blob/trunk/CompilerWarnings.cmake
You can also build ldmx-sw with the clang++
compiler instead of GCC. There will be some warnings that clang catches that GCC doesn't and vice versa and sometimes the different compilers give better/worse feedback (see e.g. the warning in https://github.com/LDMX-Software/Hcal/pull/70 and https://github.com/LDMX-Software/Framework/issues/70).
Finally, for memory-issues we also have https://github.com/LDMX-Software/ldmx-sw/issues/1172 so if you find anything in that realm it might be discussed in there already.
w.r.t. the first one here, I think reaching the end of these functions should clearly signal a bug. From looking at the code, it isn't immediately obvious to me if there is a way to reach the end of those functions with valid input so I would probably suggest raising an exception.
I should say that it isn't obvious to me there's a way to trigger the end of those functions doesn't mean that the warning is silly, there have been similar problems caught by this warning before https://github.com/LDMX-Software/ldmx-sw/pull/1182/commits/ebbe456cb6b2e6e102051aecf56f301ac0dc7be7
For building with clang
, you may have to manually merge https://github.com/LDMX-Software/TrigScint/pull/54 first. This reminded me that we should probably get around to merging it anyways.
The second one is in the G4DarkBreM repo which I can patch pretty quickly.
For the 3rd...
I also am unsure if GetShape
is just a drop-in replacement, but there is an additional complexity. The v3 development container images have ONNX v1.2 which does not have GetShape
while the v4 images have ONNX v1.15 which issues this deprecation warning. The good news is that we pin the ONNX version so we can pretty safely assume that GetDimension won't disppear on us despite this deprecation warning. The bad news is that if we want to remove this deprecation warning, we'd need to either completely drop v3 images (not something I'm willing to do) or do some ugly preprocessor stuff to align the APIs like I do with getting names:
The other option is to disable the warning, but I would prefer doing some #pragma's if it isnt happening in a lot of places
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
With some comment referencing this issue of course
hey @tomeichlersmith your point in https://github.com/LDMX-Software/ldmx-sw/issues/1208#issuecomment-1723386035 is now relevant again since you did drop v3 images recently, right?
Describe the bug In the idea of having clean compiler logs, here are a few more warnings I see:
Type "control reaches end of non-void function"
Type " declaration of 'm' shadows a global declaration "
Type "deprecated"
Additional context
Similar issue at https://github.com/LDMX-Software/ldmx-sw/issues/1199