8202051: Address compilation warnings in libawt with VS2017
authorserb
Thu, 31 May 2018 09:24:27 -0700
changeset 50357 2e0c4b2d567b
parent 50356 27d982661042
child 50358 1ba28f0dbc33
8202051: Address compilation warnings in libawt with VS2017 Reviewed-by: prr
make/lib/Awt2dLibraries.gmk
src/java.desktop/windows/native/libawt/windows/awt_Debug.cpp
src/java.desktop/windows/native/libawt/windows/awt_Debug.h
src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp
--- a/make/lib/Awt2dLibraries.gmk	Thu May 31 16:50:10 2018 +0530
+++ b/make/lib/Awt2dLibraries.gmk	Thu May 31 09:24:27 2018 -0700
@@ -224,7 +224,7 @@
         format-nonliteral parentheses, \
     DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
     DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
-    DISABLED_WARNINGS_microsoft := 4297 4244 4267 4291 4302 4311 4996, \
+    DISABLED_WARNINGS_microsoft := 4297 4244 4267 4996, \
     ASFLAGS := $(LIBAWT_ASFLAGS), \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_macosx := -L$(INSTALL_LIBRARIES_HERE), \
--- a/src/java.desktop/windows/native/libawt/windows/awt_Debug.cpp	Thu May 31 16:50:10 2018 +0530
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Debug.cpp	Thu May 31 09:24:27 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -56,11 +56,14 @@
     return ptr;
 }
 
-#if _MSC_VER >= 1200
 void operator delete(void *ptr, const char*, int) {
     DASSERTMSG(FALSE, "This version of 'delete' should never get called!!!");
 }
-#endif
+
+void operator delete[](void *ptr, const char*, int) {
+    DASSERTMSG(FALSE, "This version of 'delete' should never get called!!!");
+}
+
 void operator delete(void *ptr) throw() {
     DMem_FreeBlock(ptr);
 }
--- a/src/java.desktop/windows/native/libawt/windows/awt_Debug.h	Thu May 31 16:50:10 2018 +0530
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Debug.h	Thu May 31 09:24:27 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -50,10 +50,8 @@
     extern void * operator new(size_t size, const char * filename, int linenumber);
     extern void * operator new[](size_t size, const char * filename, int linenumber);
 
-#if _MSC_VER >= 1200
-    /* VC 6.0 is more strict about enforcing matching placement new & delete */
     extern void operator delete(void *ptr, const char*, int);
-#endif
+    extern void operator delete[](void *ptr, const char*, int);
 
     extern void operator delete(void *ptr) throw();
     extern void DumpClipRectangle(const char * file, int line, int argc, const char * fmt, va_list arglist);
--- a/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp	Thu May 31 16:50:10 2018 +0530
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp	Thu May 31 09:24:27 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -3137,11 +3137,11 @@
 void AwtToolkit::ShowTouchKeyboard() {
     if (m_isWin8OrLater && m_touchKbrdAutoShowIsEnabled &&
         (m_touchKbrdExeFilePath != NULL)) {
-        HINSTANCE retVal = ::ShellExecute(NULL, _T("open"),
-            m_touchKbrdExeFilePath, NULL, NULL, SW_SHOW);
-        if ((int)((intptr_t)retVal) <= 32) {
+        int retVal = (int)((intptr_t)::ShellExecute(NULL, _T("open"),
+            m_touchKbrdExeFilePath, NULL, NULL, SW_SHOW));
+        if (retVal <= 32) {
             DTRACE_PRINTLN1("AwtToolkit::ShowTouchKeyboard: Failed"
-                ", retVal='%d'", (int)retVal);
+                ", retVal='%d'", retVal);
         }
     }
 }