From c2a4fa1d83bd690e4e453eb1dbe59c6503b5281d Mon Sep 17 00:00:00 2001 From: Julian Waters Date: Thu, 8 May 2025 22:11:37 +0000 Subject: [PATCH] 8355573: Remove kludge_c++11.h from jpackage code Reviewed-by: asemenyuk, almatvee --- .../libapplauncher/LinuxLauncherLib.cpp | 2 - .../share/native/applauncher/CfgFile.cpp | 2 - .../share/native/applauncher/PackageFile.cpp | 2 - .../native/applauncher/StringProcessing.cpp | 2 - src/jdk.jpackage/share/native/common/Dll.h | 2 - src/jdk.jpackage/share/native/common/app.cpp | 2 - .../share/native/common/kludge_c++11.h | 170 ------------------ .../windows/native/common/MsiUtils.h | 1 + 8 files changed, 1 insertion(+), 182 deletions(-) delete mode 100644 src/jdk.jpackage/share/native/common/kludge_c++11.h diff --git a/src/jdk.jpackage/linux/native/libapplauncher/LinuxLauncherLib.cpp b/src/jdk.jpackage/linux/native/libapplauncher/LinuxLauncherLib.cpp index 52d3f2892cd..7d7c8b7213d 100644 --- a/src/jdk.jpackage/linux/native/libapplauncher/LinuxLauncherLib.cpp +++ b/src/jdk.jpackage/linux/native/libapplauncher/LinuxLauncherLib.cpp @@ -23,8 +23,6 @@ * questions. */ -#include "kludge_c++11.h" - #include #include "JvmLauncher.h" #include "AppLauncher.h" diff --git a/src/jdk.jpackage/share/native/applauncher/CfgFile.cpp b/src/jdk.jpackage/share/native/applauncher/CfgFile.cpp index 0e99d131e69..f9cce661155 100644 --- a/src/jdk.jpackage/share/native/applauncher/CfgFile.cpp +++ b/src/jdk.jpackage/share/native/applauncher/CfgFile.cpp @@ -23,8 +23,6 @@ * questions. */ -#include "kludge_c++11.h" - #include #include #include diff --git a/src/jdk.jpackage/share/native/applauncher/PackageFile.cpp b/src/jdk.jpackage/share/native/applauncher/PackageFile.cpp index aa78e5f711e..31b431215d5 100644 --- a/src/jdk.jpackage/share/native/applauncher/PackageFile.cpp +++ b/src/jdk.jpackage/share/native/applauncher/PackageFile.cpp @@ -23,8 +23,6 @@ * questions. */ -#include "kludge_c++11.h" - #include #include "PackageFile.h" #include "Log.h" diff --git a/src/jdk.jpackage/share/native/applauncher/StringProcessing.cpp b/src/jdk.jpackage/share/native/applauncher/StringProcessing.cpp index 207db25fd94..161b18fd99b 100644 --- a/src/jdk.jpackage/share/native/applauncher/StringProcessing.cpp +++ b/src/jdk.jpackage/share/native/applauncher/StringProcessing.cpp @@ -23,8 +23,6 @@ * questions. */ -#include "kludge_c++11.h" - #include #include "StringProcessing.h" diff --git a/src/jdk.jpackage/share/native/common/Dll.h b/src/jdk.jpackage/share/native/common/Dll.h index 491f0867868..c84242373a7 100644 --- a/src/jdk.jpackage/share/native/common/Dll.h +++ b/src/jdk.jpackage/share/native/common/Dll.h @@ -32,8 +32,6 @@ typedef void* HMODULE; #endif -#include "kludge_c++11.h" - #include #include "tstrings.h" #include "ErrorHandling.h" diff --git a/src/jdk.jpackage/share/native/common/app.cpp b/src/jdk.jpackage/share/native/common/app.cpp index 2a004b508d3..d9492785f06 100644 --- a/src/jdk.jpackage/share/native/common/app.cpp +++ b/src/jdk.jpackage/share/native/common/app.cpp @@ -23,8 +23,6 @@ * questions. */ -#include "kludge_c++11.h" - #include #include "app.h" #include "Log.h" diff --git a/src/jdk.jpackage/share/native/common/kludge_c++11.h b/src/jdk.jpackage/share/native/common/kludge_c++11.h deleted file mode 100644 index 5f475ff0ce9..00000000000 --- a/src/jdk.jpackage/share/native/common/kludge_c++11.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2020, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - -#ifndef kludge_cxx11_h -#define kludge_cxx11_h - -// -// This file contains kludge implementation of C++11 features needed to build -// jpackage until Open JDK moves forward from C++98 standard. -// - -#ifdef __GNUG__ -#ifndef __clang__ -#if __cplusplus < 201103L -#define JP_WITH_KLUDGE_CXX11 -#endif -#endif -#endif - -#ifdef JP_WITH_KLUDGE_CXX11 - -#include - - -namespace std { - -namespace impl { - -template -class unique_ptr_impl { -public: - typedef typename Dp::pointer pointer; - typedef Tp element_type; - typedef Dp deleter_type; - - unique_ptr_impl(): value(0) { - } - - unique_ptr_impl(pointer p): value(p) { - } - - pointer release() { - const pointer retValue = value; - value = 0; - return retValue; - } - - void swap(unique_ptr_impl& other) { - std::swap(value, other.value); - } - - pointer get() const { - return value; - } - -private: - unique_ptr_impl(const unique_ptr_impl&); - unique_ptr_impl& operator= (const unique_ptr_impl&); - -private: - pointer value; -}; - -} // namespace impl - - -template -struct default_delete { - typedef Tp* pointer; - - void operator()(Tp* ptr) const { - delete ptr; - } -}; - - -template > -class unique_ptr { - typedef impl::unique_ptr_impl impl_type; -public: - typedef typename impl_type::pointer pointer; - typedef typename impl_type::element_type element_type; - typedef typename impl_type::deleter_type deleter_type; - - unique_ptr() { - } - - unique_ptr(pointer p): impl(p) { - } - - ~unique_ptr() { - if (get() != 0) { - impl_type tmp; - tmp.swap(impl); - Dp()(tmp.get()); - } - } - - pointer release() { - return impl.release(); - } - - void swap(unique_ptr& other) { - impl.swap(other.impl); - } - - pointer get() const { - return impl.get(); - } - - element_type& operator *() const { - return *impl.get(); - } - - pointer operator ->() const { - return impl.get(); - } - -private: - impl_type impl; -}; - -template -typename Ctnr::const_iterator begin(const Ctnr& ctnr) { - return ctnr.begin(); -} - -template -typename Ctnr::iterator begin(Ctnr& ctnr) { - return ctnr.begin(); -} - -template -typename Ctnr::const_iterator end(const Ctnr& ctnr) { - return ctnr.end(); -} - -template -typename Ctnr::iterator end(Ctnr& ctnr) { - return ctnr.end(); -} - -} // namespace std - -#endif // #ifdef JP_WITH_KLUDGE_CXX11 - -#endif // #ifndef kludge_cxx11_h diff --git a/src/jdk.jpackage/windows/native/common/MsiUtils.h b/src/jdk.jpackage/windows/native/common/MsiUtils.h index ad75d758b0a..26fa9f91045 100644 --- a/src/jdk.jpackage/windows/native/common/MsiUtils.h +++ b/src/jdk.jpackage/windows/native/common/MsiUtils.h @@ -32,6 +32,7 @@ #include #include #include +#include #include "ErrorHandling.h" #include "Toolbox.h"