On Fri, 2 Feb 2024 15:22:03 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:
> #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. All of the -Wpedantic warnings for extra ';' in C++ code I looked at look to me like a gcc bug (or bugs). C++11 added "empty-declaration", which is permitted anywhere a normal declaration is permitted (C++14 7), as well as for class member declarations (C++14 9.2). https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96068 seems to have fixed some, but not all, cases. It looks like it only removed the warnings for empty declarations at namespace scope. I couldn't find anything for other cases, including empty class member declarations. I consider the "format '%p' expects argument of type 'void*" warnings to be not at all helpful. Fortunately we don't use '%p' in HotSpot, but I don't know how other groups might feel having this inflicted on them. Because of the vast numbers of those, I ran out of patience trying to find and examine other warnings triggered by this option. Based on that, I'm not feeling very keen on this change, at least not for a future version applying to gcc builds. ------------- PR Comment: https://git.openjdk.org/jdk/pull/17687#issuecomment-1926154325