[RFC] Change compiler warnings for OpenMP runtimes

Hi all,

I'd like to change the way how compiler warnings are handled for the
OpenMP runtimes (libomp and libomptarget).
tl;dr: I propose to enable all warnings from -Wall and selectively
disable the ones that are not clean right now.

At the moment, the CMake configuration is not very consistent with
respect to compiler warnings: In standalone builds, libomp enables some
warnings while libomptarget is built with only the default warnings
(none, or only flagging very broken code). When built in-tree, LLVM
enables -Wall -Wextra -Wpedantic and then disables some warnings. As a
result, the OpenMP runtimes get exposed to a much larger set of
compiler warnings and from what I've seen, this basically renders the
output from GCC unreadable because it's just full of text.

I like the concept of enabling all warnings and then disable some to
get the build free of warnings. I've put together a patch [1] and I see
no warnings with recent versions of Clang, GCC, and the Intel Compiler.
Additionally, this scheme allows us to enable warnings not covered by
the generic -Wall when helpful, as the linked patch already does.

In that patch, the set of disabled warnings is quite large, but having
a list allows us to remove the -Wno-* arguments one-by-one and correct
the code in question (if possible). I've already started with some easy
ones [2-5] and I hope to do some others, but help would be welcome.

Feedback, comments, and / or review of the patches would be great!

Thanks,
Jonas

1: https://reviews.llvm.org/D65867
2: https://reviews.llvm.org/D65868
3: https://reviews.llvm.org/D65869
4: https://reviews.llvm.org/D65870
5: https://reviews.llvm.org/D65871

+100.

                -David

Jonas Hahnfeld via Openmp-dev <openmp-dev@lists.llvm.org> writes:

I'm very much in favor, warnings are just errors waiting to happen...

So far, I've only heard positive voices and I plan to land the first batch of accepted patches tomorrow.

Thanks,
Jonas