AIDASoft / podio

PODIO
GNU General Public License v3.0
24 stars 60 forks source link

Change C-style casts to static_cast and remove unnecessary semicolons #668

Closed jmcarcell closed 1 month ago

jmcarcell commented 1 month ago

I have been playing a bit with some warnings in Key4hep and I get some from included files from podio. The C-style cast may be useful. I guess these don't hurt anyway.

BEGINRELEASENOTES

ENDRELEASENOTES

m-fila commented 1 month ago

Here is another semicolon to be removed https://github.com/AIDASoft/podio/blob/df5430c7cf2cbd7982130b6247d333799aa5dca5/include/podio/DataSource.h#L95-L97 There is a clang-format check for this https://clang.llvm.org/docs/ClangFormatStyleOptions.html#removesemicolon but there is a disclaimer that it may produce incorrect code so probably we don't want to add it

Also there is a clang-tidy check for casts but it misses some cases and flags the code in MurmurHash so I guess there is little reason to add it

jmcarcell commented 1 month ago

For casts there is -Wold-style-cast. I added a pragma for Murmurhash3 so that it doesn't complain.

m-fila commented 1 month ago

Are these flags and pragmas supported by all the compilers we have?

jmcarcell commented 1 month ago

With all the compilers we have being GCC yes, but they also work fine with Clang.