changeset 49471:079d100b3d0e

8197859: VS2017 Complains about UINTPTR_MAX definition in globalDefinitions_VisCPP.hpp Summary: Use <stdint.h> and <inttypes.h> on Windows instead of emulation. Reviewed-by: coleenp, lfoltan, gtriantafill
author kbarrett
date Wed, 21 Feb 2018 23:30:01 -0500
parents 0f81d08a578e
children 44122f767467
files src/hotspot/share/utilities/globalDefinitions_visCPP.hpp
diffstat 1 files changed, 9 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp	Tue Feb 13 14:38:09 2018 +0100
+++ b/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp	Wed Feb 21 23:30:01 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 # include <string.h>
 # include <stdarg.h>
 # include <stdlib.h>
+# include <stdint.h>
 # include <stddef.h>// for offsetof
 # include <io.h>    // for stream.cpp
 # include <float.h> // for _isnan
@@ -42,6 +43,7 @@
 # include <time.h>
 # include <fcntl.h>
 # include <limits.h>
+# include <inttypes.h>
 // Need this on windows to get the math constants (e.g., M_PI).
 #define _USE_MATH_DEFINES
 # include <math.h>
@@ -77,43 +79,18 @@
 // pointer is stored as integer value.
 #define NULL_WORD NULL
 
-// Compiler-specific primitive types
-typedef unsigned __int8  uint8_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned __int32 uint32_t;
-typedef unsigned __int64 uint64_t;
-
 #ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
+typedef int64_t ssize_t;
 #else
-typedef unsigned int uintptr_t;
-#endif
-typedef signed   __int8  int8_t;
-typedef signed   __int16 int16_t;
-typedef signed   __int32 int32_t;
-typedef signed   __int64 int64_t;
-#ifdef _WIN64
-typedef signed   __int64 intptr_t;
-typedef signed   __int64 ssize_t;
-#else
-typedef signed   int intptr_t;
-typedef signed   int ssize_t;
-#endif
-
-#ifndef UINTPTR_MAX
-#ifdef _WIN64
-#define UINTPTR_MAX _UI64_MAX
-#else
-#define UINTPTR_MAX _UI32_MAX
-#endif
+typedef int32_t ssize_t;
 #endif
 
 // Additional Java basic types
 
-typedef unsigned char    jubyte;
-typedef unsigned short   jushort;
-typedef unsigned int     juint;
-typedef unsigned __int64 julong;
+typedef uint8_t  jubyte;
+typedef uint16_t jushort;
+typedef uint32_t juint;
+typedef uint64_t julong;
 
 // Non-standard stdlib-like stuff:
 inline int strcasecmp(const char *s1, const char *s2) { return _stricmp(s1,s2); }
@@ -187,26 +164,6 @@
 // Formatting.
 #define FORMAT64_MODIFIER "I64"
 
-// Visual Studio doesn't provide inttypes.h so provide appropriate definitions here.
-// The 32 bits ones might need I32 but seem to work ok without it.
-#define PRId32       "d"
-#define PRIu32       "u"
-#define PRIx32       "x"
-
-#define PRId64       "I64d"
-#define PRIu64       "I64u"
-#define PRIx64       "I64x"
-
-#ifdef _LP64
-#define PRIdPTR       "I64d"
-#define PRIuPTR       "I64u"
-#define PRIxPTR       "I64x"
-#else
-#define PRIdPTR       "d"
-#define PRIuPTR       "u"
-#define PRIxPTR       "x"
-#endif
-
 #define offset_of(klass,field) offsetof(klass,field)
 
 #ifndef USE_LIBRARY_BASED_TLS_ONLY