On Tue, 17 May 2022 04:39:06 GMT, David Holmes <dhol...@openjdk.org> wrote:
>> GCC 12 reports as following: > > You forced me to look at this in depth. The values are set via the build > system. In the build system it is impossible to get just -J because the -J is > only added as a prefix for an existing string. So basically this is > impossible code to reach unless you manually override the build system > definition. So as far as I can see this is a classic case where we want an > assert. > > > if (arg[0] == '-' && arg[1] == 'J') { > assert(arg[2] != '\0', "Invalid JAVA_ARGS or EXTRA_JAVA_ARGS defined by > build"); > *nargv++ = JLI_StringDup(arg + 2); > } @dholmes-ora Thanks for your comment! We cannot use `assert(cond, message)` at here because it is not HotSpot code. In imageFile.cpp for libjimage. It uses `assert(cond && message)`, so I use this style in new commit, and the warning has gone. I can change to "normal" `assert` usage at here if it is strange. ------------- PR: https://git.openjdk.java.net/jdk/pull/8694