mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-28 20:03:39 +00:00
8324686: Remove redefinition of NULL for MSVC
Reviewed-by: shade, dholmes
This commit is contained in:
parent
51b3d6bba2
commit
6c2667018a
@ -54,25 +54,6 @@
|
||||
#error unsupported platform
|
||||
#endif
|
||||
|
||||
// 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
|
||||
// When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
|
||||
// system header files. On 32-bit architectures, there is no problem.
|
||||
// On 64-bit architectures, defining NULL as a 32-bit constant can cause
|
||||
// problems with varargs functions: C++ integral promotion rules say for
|
||||
// varargs, we pass the argument 0 as an int. So, if NULL was passed to a
|
||||
// varargs function it will remain 32-bits. Depending on the calling
|
||||
// convention of the machine, if the argument is passed on the stack then
|
||||
// only 32-bits of the "NULL" pointer may be initialized to zero. The
|
||||
// other 32-bits will be garbage. If the varargs function is expecting a
|
||||
// pointer when it extracts the argument, then we may have a problem.
|
||||
//
|
||||
// Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
|
||||
#undef NULL
|
||||
// 64-bit Windows uses a P64 data model (not LP64, although we define _LP64)
|
||||
// Since longs are 32-bit we cannot use 0L here. Use the Visual C++ specific
|
||||
// 64-bit integer-suffix (LL) instead.
|
||||
#define NULL 0LL
|
||||
|
||||
typedef int64_t ssize_t;
|
||||
|
||||
// Non-standard stdlib-like stuff:
|
||||
|
||||
@ -74,8 +74,7 @@ public class TestNoNULL {
|
||||
private static void initializeExcludedPaths(Path rootDir) {
|
||||
List<String> sourceExclusions = List.of(
|
||||
"src/hotspot/share/prims/jvmti.xml",
|
||||
"src/hotspot/share/prims/jvmti.xsl",
|
||||
"src/hotspot/share/utilities/globalDefinitions_visCPP.hpp"
|
||||
"src/hotspot/share/prims/jvmti.xsl"
|
||||
);
|
||||
|
||||
List<String> testExclusions = List.of(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user