[jdk11u-dev] RFR: 8299635: Hotspot update for deprecated sprintf in Xcode 14
George Adams
gdams at openjdk.org
Tue Jul 16 10:23:53 UTC 2024
On Tue, 9 Jul 2024 14:58:24 GMT, Antonio Vieiro <duke at openjdk.org> wrote:
> Backport of [JDK-8299635](https://bugs.openjdk.org/browse/JDK-8299635) as applied to JDK-17, in order to get building on macos-13/Xcode 14/clang 14.
>
> Mostly clean but for these files:
>
>
> src/hotspot/os/aix/os_aix.cpp
> src/hotspot/os/linux/os_linux.cpp
> src/hotspot/share/opto/cfgnode.cpp
> src/hotspot/share/opto/chaitin.cpp
> src/hotspot/share/opto/chaitin.hpp
> src/hotspot/share/opto/type.cpp
>
>
> In `src/hotspot/share/opto/type.cpp` we restored JDK-17's `nullptr` back to JDK-11's `NULL`.
>
> After this PR the macos-builds are expected to continue failing with error messages similar to:
>
> A) The `-Wdeprecated-non-prototype` flag. This seems JDK-11 specific as these files were later reorganized in next JDK versions. We may need a JDK-11 specific issue for this compilation failure.
>
>
> Compiling main.c (for pack200)
> /Users/runner/work/jdk11u-dev/jdk11u-dev/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c:922:48: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
> Creating support/modules_cmds/jdk.pack/unpack200 from 7 file(s)
> if ((status = (*sMlibFns[MLIB_AFFINE].fptr)(dst, src, mtx, filter,
> Compiling bands.cpp (for unpack200)
>
>
> B) Some missing `sprintf` in files in the `src/jdk.pack` directory, which is JDK-11 specific as Pack200 was removed in later versions.
>
>
> /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
> __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
> ^
> /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
> #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
> ^
> /Users/runner/work/jdk11u-dev/jdk11u-dev/src/jdk.pack/share/native/common-unpack/bands.cpp:165:25: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
> if (le_back != 0) { sprintf(bp, "/back%d", l...
@vieiro it looks like you should be able to apply the remaining changes to `src/hotspot/os/linux/os_linux.cpp`. Looking on Line 507 I still see the `sprintf` command which was replaced in https://github.com/openjdk/jdk17u-dev/pull/2663/files#diff-aeec57d804d56002f26a85359fc4ac8b48cfc249d57c656a30a63fc6bf3457adL488-R490
-------------
PR Comment: https://git.openjdk.org/jdk11u-dev/pull/2844#issuecomment-2230542433
More information about the jdk-updates-dev
mailing list