jdk11u-dev icon indicating copy to clipboard operation
jdk11u-dev copied to clipboard

8299635: Hotspot update for deprecated sprintf in Xcode 14

Open vieiro opened this issue 7 months ago • 7 comments

Backport of 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); }

Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue
  • [ ] JDK-8299635 needs maintainer approval

Integration blocker

 ⚠️ Dependency #2842 must be integrated first

Issue

  • JDK-8299635: Hotspot update for deprecated sprintf in Xcode 14 (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/2844/head:pull/2844
$ git checkout pull/2844

Update a local copy of the PR:
$ git checkout pull/2844
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/2844/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2844

View PR using the GUI difftool:
$ git pr show -t 2844

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/2844.diff

Webrev

Link to Webrev Comment

vieiro avatar Jul 09 '24 14:07 vieiro