On Wed, 11 May 2022 12:48:38 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> Yasumasa Suenaga has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Avoid pragma error in before GCC 12 > > src/java.base/unix/native/libjli/java_md_common.c line 135: > >> 133: if ((JLI_StrLen(indir) + JLI_StrLen(cmd) + 2) > sizeof(name)) >> return 0; >> 134: JLI_Snprintf(name, sizeof(name), "%s%c%s", indir, FILE_SEPARATOR, >> cmd); >> 135: #pragma GCC diagnostic pop > > Can we just replace this code rather than putting pragmas here? I tried several patterns, but I couldn't find out a solution other than pragmas. Do you have any ideas? For example: if ((JLI_StrLen(indir) + JLI_StrLen(cmd) + 2) < sizeof(name)) { JLI_Snprintf(name, sizeof(name), "%s%c%s", indir, FILE_SEPARATOR, cmd); } else { return 0; } Compiler warnings: ------------- PR: https://git.openjdk.java.net/jdk/pull/8646