[jdk11u-dev] RFR: 8299635: Hotspot update for deprecated sprintf in Xcode 14
Antonio Vieiro
duke at openjdk.org
Tue Jul 9 15:03:50 UTC 2024
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", le_back); bp += strlen(bp); }
-------------
Depends on: https://git.openjdk.org/jdk11u-dev/pull/2842
Commit messages:
- Backport faf55ddad00559be71ba7f4b34f9df3d4f251d11
Changes: https://git.openjdk.org/jdk11u-dev/pull/2844/files
Webrev: https://webrevs.openjdk.org/?repo=jdk11u-dev&pr=2844&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8299635
Stats: 97 lines in 34 files changed: 3 ins; 2 del; 92 mod
Patch: https://git.openjdk.org/jdk11u-dev/pull/2844.diff
Fetch: git fetch https://git.openjdk.org/jdk11u-dev.git pull/2844/head:pull/2844
PR: https://git.openjdk.org/jdk11u-dev/pull/2844
More information about the jdk-updates-dev
mailing list