Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8296812

sprintf is deprecated in Xcode 14

XMLWordPrintable

    • b02

        Build failed on MacOS, with build log information as:

        /Users/xueleifan/workspace/jdk-dev/src/hotspot/share/adlc/adlparse.cpp:215:11: 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]
                  sprintf(buf, "%s_%d", instr->_ident, match_rules_cnt++);
                  ^
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.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.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
                #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))

        The system is macOS Monterey version 12.6. Here is the related OpenJDK building configure summary:

        * Toolchain: clang (clang/LLVM from Xcode 14.1)
        * Sysroot: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk
        * C Compiler: Version 14.0.0 (at /usr/bin/clang)
        * C++ Compiler: Version 14.0.0 (at /usr/bin/clang++)

              xuelei Xuelei Fan
              xuelei Xuelei Fan
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: