On Fri, 2 Feb 2024 15:22:03 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:

> Inspired by (the later backed-out) 
> [JDK-8296115](https://bugs.openjdk.org/browse/JDK-8296115), I propose to 
> enable `-Wpedantic` for clang. This has already found some irregularities in 
> the code, like mistakenly using `#import` instead of `#include`. In this 
> patch, I disable warnings for these individual buggy or badly written files, 
> but I intend to post follow-up issues on the respective teams to have them 
> properly fixed.
> 
> Unfortunately, it is not possible to enable `-Wpedantic` on gcc, since 
> individual warnings in `-Wpedantic` cannot be disabled. This means that code 
> like this:
> 
> 
> #define DEBUG_ONLY(code) code;
> 
> DEBUG_ONLY(foo());
> 
> 
> will result in a `; ;`. This breaks the C standard, but is benign, and we use 
> it all over the place. On clang, we can ignore this by `-Wno-extra-semi`, but 
> this is not available on gcc.

Also, a general note about the parts of `pedantic` that is globally disabled in 
this PR (like `extra-semi` and `format-pedantic`). It might very well be that 
the offending code is restricted to a few places (if these places are in 
commonly included header files, I was forced to disable the warning globally), 
and that it can be rather easily fixed.

All the better! But there is still no reason to do that *before* checking in 
this PR. Let's just get the minimum bar raised first. Then we can adress the 
issue of fixing the code to get rid of the exceptions for `extra-semi` and 
`format-pedantic`, if it is possible and if we want it. The latter is not at 
all clear; the rest of the list of globally disabled warnings (like 
`unused-parameter`) are warnings that we have agreed is useless, and only 
unfortunately dragged in with a catch-all flag like `-Wall` or `-Wextra`. From 
my PoV, the same could be said about `extra-semi`.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17687#issuecomment-1926569091

Reply via email to