From de66432d4a374921010ec20770e39b248b8bdb12 Mon Sep 17 00:00:00 2001
From: Daniil Titov <dtitov@openjdk.org>
Date: Wed, 30 May 2018 08:59:56 -0700
Subject: [PATCH] 8203802: Jvmti test fails to build with VS2017

Reviewed-by: sspitsyn, erikj
---
 make/test/JtregNativeHotspot.gmk                          | 2 --
 .../nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.c           | 4 ++--
 .../hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h | 8 ++++++++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/make/test/JtregNativeHotspot.gmk b/make/test/JtregNativeHotspot.gmk
index 73b2d9d247c..1b09a0b61ca 100644
--- a/make/test/JtregNativeHotspot.gmk
+++ b/make/test/JtregNativeHotspot.gmk
@@ -851,8 +851,6 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
     BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT
     BUILD_HOTSPOT_JTREG_EXCLUDE += exesigtest.c
 
-    # Disable warning until JDK-8203802 is fixed
-    BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libtimers += -wd4477
 else
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libbootclssearch_agent += -lpthread
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libsystemclssearch_agent += -lpthread
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.c b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.c
index 176c5089978..d7b360d3a66 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.c
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.c
@@ -364,10 +364,10 @@ Java_nsk_jvmti_unit_timers_JvmtiTest_Analyze(JNIEnv * env, jclass cls) {
           }
 #endif
           if (passed) {
-            debug_printf("Pass: currThreadTime(%ld) >= %2.0f%% of threadTime(%ld)\n",
+            debug_printf("Pass: currThreadTime(" JLONG_FORMAT ") >= %2.0f%% of threadTime(" JLONG_FORMAT ")\n",
                          ctt, 100.0 - VARIANCE_PERCENT, tt);
           } else {
-            printf("FAIL: currThreadTime(%ld) < %2.0f%% of threadTime(%ld)\n",
+            printf("FAIL: currThreadTime(" JLONG_FORMAT ") < %2.0f%% of threadTime(" JLONG_FORMAT ")\n",
                    ctt, 100.0 - VARIANCE_PERCENT, tt);
             iGlobalStatus = 2;
           }
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h
index 1001a887b58..de3c9f1f6a5 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h
@@ -27,9 +27,17 @@
 /*************************************************************/
 
 #include <stdarg.h>
+#include <inttypes.h>
 
 /*************************************************************/
 
+#if defined(_LP64) && defined(__APPLE__)
+#define JLONG_FORMAT "%ld"
+#else  // _LP64 && __APPLE__
+#define JLONG_FORMAT "%" PRId64
+#endif // _LP64 && __APPLE__
+
+
 /**
  * Use examples:
  *