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

macosx: sprintf is deprecated (use snprintf instead).

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Withdrawn
    • Icon: P4 P4
    • None
    • None
    • hotspot
    • None

      I see:

      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk/usr/include/_stdio.h:274:1: note: 'sprintf' has been explicitly marked deprecated here
        274 | __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/MacOSX15.2.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        218 | #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
            | ^
      /Users/gerard/Work/bugs/reviews/8351661/jdk/test/hotspot/gtest/nmt/test_vmatree.cpp:790:5: warning: '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. [-Wdeprecated-declarations]
        790 | sprintf(for_this_node, "test at line: %d, for node: %d", line_no, et.nodes[i]);
            | ^
      /Users/gerard/Work/bugs/reviews/8351661/jdk/test/hotspot/gtest/nmt/test_vmatree.cpp:900:5: note: in instantiation of function template specialization 'check_tree<6>' requested here
        900 | check_tree(tree, et4, __LINE__);
            | ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk/usr/include/_stdio.h:274:1: note: 'sprintf' has been explicitly marked deprecated here
        274 | __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/MacOSX15.2.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        218 | #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
            | ^

      when trying to run gtest locally, ex:

      make test TEST="gtest:NMTVMATreeTest" MICRO="RESULTS_FORMAT=json" TEST_VM_OPTS="-XX:NativeMemoryTracking=detail"

            Unassigned Unassigned
            gziemski Gerard Ziemski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: