RFR: 8325163: Enable -Wpedantic on clang

Magnus Ihse Bursie ihse at openjdk.org
Fri Feb 2 15:27:12 UTC 2024


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.

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

Commit messages:
 - 8325163: Enable -Wpedantic on clang

Changes: https://git.openjdk.org/jdk/pull/17687/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17687&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8325163
  Stats: 43 lines in 11 files changed: 31 ins; 0 del; 12 mod
  Patch: https://git.openjdk.org/jdk/pull/17687.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17687/head:pull/17687

PR: https://git.openjdk.org/jdk/pull/17687


More information about the build-dev mailing list