[jdk11u-dev] RFR: 8299254: Support dealing with standard assert macro
George Adams
gdams at openjdk.org
Tue Jul 16 10:41:57 UTC 2024
On Tue, 9 Jul 2024 11:18:04 GMT, Antonio Vieiro <duke at openjdk.org> wrote:
> Backport of [JDK-8299254](https://bugs.openjdk.org/browse/JDK-8299254) that solves the clash between OpenJDK's and standard lib's `assert` macro when building with XCode 14/clang 14 on GHA macos-13.
>
> Clean changes:
>
>
> make/hotspot/lib/JvmFlags.gmk
> src/hotspot/share/utilities/vmassert_reinstall.hpp
> src/hotspot/share/utilities/vmassert_uninstall.hpp
> test/hotspot/gtest/gc/shared/test_memset_with_concurrent_readers.cpp
>
>
> Conflicts solved in:
>
>
> test/hotspot/gtest/jfr/test_networkUtilization.cpp
> test/hotspot/gtest/unittest.hpp
>
>
> Not included:
>
> test/hotspot/gtest/code/test_codestrings.cpp
> test/hotspot/gtest/gc/shenandoah/test_shenandoahNumberSeq.cpp
>
>
> in `test/hotspot/gtest/unittest.hpp` I've removed [some lines](https://github.com/openjdk/jdk/blob/3e2314d08218dc8a4f4fc61bd4e1d5e58a0129c7/test/hotspot/gtest/unittest.hpp#L52) to avoid including "gmock/gmock.h" that was introduced in [JDK-8222414](https://bugs.openjdk.org/browse/JDK-8222414) and has not been backported to 11.
>
> The macos-13 will continue to fail after this PR, the next errors to solve on macos-13 (under investigation) are:
>
> - Missing `sprintf` in `test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp`
>
>
> In file included from /Users/runner/work/jdk11u-dev/jdk11u-dev/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/libVirtualMachine07agent02.cpp:26:
> /Users/runner/work/jdk11u-dev/jdk11u-dev/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp:282:13: 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, " %02X", b);
>
>
> - Flag `-Wdeprecated-non-prototype` should be removed when compiling `awt_ImagingLib.c`:
>
>
> * For target support_native_java.desktop_libawt_awt_ImagingLib.o:
> /Users/runner/work/jdk11u-dev/jdk11u-dev/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c:430:43: 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]
> if ((*sMlibFns[MLIB_CONVKERNCVT].fptr)(kdata, &scale, dkern, w, h,
test/hotspot/gtest/gc/shared/test_memset_with_concurrent_readers.cpp line 27:
> 25: #include "gc/shared/memset_with_concurrent_readers.hpp"
> 26: #include "utilities/globalDefinitions.hpp"
> 27: #include "unittest.hpp"
Suggestion:
test/hotspot/gtest/gc/shared/test_memset_with_concurrent_readers.cpp line 32:
> 30: #include <string.h>
> 31: #include <sstream>
> 32: #include "utilities/vmassert_reinstall.hpp"
Suggestion:
#include "utilities/vmassert_reinstall.hpp"
#include "unittest.hpp"
test/hotspot/gtest/jfr/test_networkUtilization.cpp line 45:
> 43: #include "utilities/growableArray.hpp"
> 44:
> 45: #include "unittest.hpp"
Suggestion:
test/hotspot/gtest/jfr/test_networkUtilization.cpp line 51:
> 49: #include <list>
> 50: #include <map>
> 51: #include "utilities/vmassert_reinstall.hpp"
Suggestion:
#include "utilities/vmassert_reinstall.hpp"
#include "unittest.hpp"
test/hotspot/gtest/unittest.hpp line 31:
> 29:
> 30: #define GTEST_DONT_DEFINE_TEST 1
> 31: #include "gtest/gtest.h"
Suggestion:
#include "utilities/vmassert_uninstall.hpp"
#include "gtest/gtest.h"
test/hotspot/gtest/unittest.hpp line 34:
> 32: #include "utilities/vmassert_reinstall.hpp"
> 33:
> 34: // gtest/gtest.h includes assert.h which will define the assert macro, but hotspot has its
This block needs removing. See https://github.com/openjdk/jdk17u-dev/pull/2689/files#diff-ff1dd449619fcf441d7a63b01c6c4b6bf3e6fd5dc1149ffa48f38d5e6d82e5baL63-L74
-------------
PR Review Comment: https://git.openjdk.org/jdk11u-dev/pull/2842#discussion_r1679166576
PR Review Comment: https://git.openjdk.org/jdk11u-dev/pull/2842#discussion_r1679166834
PR Review Comment: https://git.openjdk.org/jdk11u-dev/pull/2842#discussion_r1679167566
PR Review Comment: https://git.openjdk.org/jdk11u-dev/pull/2842#discussion_r1679167701
PR Review Comment: https://git.openjdk.org/jdk11u-dev/pull/2842#discussion_r1679169185
PR Review Comment: https://git.openjdk.org/jdk11u-dev/pull/2842#discussion_r1679168420
More information about the jdk-updates-dev
mailing list