RFR: 8347576: Error output in libjsound has non matching format strings
Matthias Baesken
mbaesken at openjdk.org
Tue Jan 14 09:11:39 UTC 2025
On Mon, 13 Jan 2025 14:54:09 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:
> When enabling the jsound ERROR and TRACE reporting (see src/java.desktop/share/native/libjsound/Configure.h https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/native/libjsound/Configure.h#L32 ), we run into some build warnings as errors (when building on Linux) because at 2 places the format specifiers do not match the number types .
Looks like this fixes Linux (when the libjsound trace is enabled) but Windows has more coding and more issues
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): error C2220: the following warning is treated as an error
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 1 has type 'HMIDIIN'
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): warning C4313: 'fprintf': '%x' in format string conflicts with argument 1 of type 'HMIDIIN'
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 3 has type 'UINT_PTR'
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): note: consider using '%llx' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): note: consider using '%Ix' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): note: consider using '%I64x' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 1 has type 'UINT_PTR'
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): note: consider using '%llx' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): note: consider using '%Ix' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): note: consider using '%I64x' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 2 has type 'UINT_PTR'
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): note: consider using '%llx' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): note: consider using '%Ix' in the format string
... (rest of output omitted)
* For target support_native_java.desktop_libjsound_PLATFORM_API_WinOS_Ports.obj:
PLATFORM_API_WinOS_Ports.c
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_Ports.c(254): error C2220: the following warning is treated as an error
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_Ports.c(254): warning C4473: 'fprintf' : not enough arguments passed for format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_Ports.c(254): note: placeholders and their parameters expect 3 variadic arguments, but 2 were provided
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_Ports.c(254): note: the missing variadic argument 3 is required by format string '%p'
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23076#issuecomment-2589381750
More information about the client-libs-dev
mailing list