RFR: 8341135: Incorrect format string after JDK-8339475

Matthias Baesken mbaesken at openjdk.org
Tue Oct 1 12:43:39 UTC 2024


On Tue, 1 Oct 2024 12:22:34 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> This fixes a format string issue.
>> 
>> In the error report it was reported : 'The compiler should be able to catch this if JLI_ReportErrorMessageSys was declared with something like __attribute__ ((format (printf, 1, 2))).'
>> Should we maybe adjust  JLI_ReportErrorMessageSys , JLI_ReportErrorMessage  and related functions/methods  using a format string so that such errors can be found already at build time ?
>
> src/java.base/macosx/native/libjli/java_md_macosx.m line 315:
> 
>> 313:     rc = pthread_create(&main_thr, NULL, &apple_main, &args);
>> 314:     if (rc != 0) {
>> 315:         JLI_ReportErrorMessageSys("Could not create main thread, return code:%d\n", rc);
> 
> Shouldn't there be a space in between, `return code: %d`?

I can live with both, not sure what is preferred.  In the corresponding fprintf output of 8339475 there is no space.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21278#discussion_r1782698968


More information about the core-libs-dev mailing list