summaryrefslogtreecommitdiff
path: root/Ports/OpenJDK/patches/0002-make-Build-with-c-20-when-targeting-serenity.patch
blob: 10fa2f0cd72347a51d0c4aa3e19eb39c04ba8790 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <andrewdkaster@gmail.com>
Date: Sun, 12 Jun 2022 23:13:56 -0600
Subject: [PATCH] make: Build with c++20 when targeting serenity

---
 make/autoconf/flags-cflags.m4                 | 8 ++++++--
 src/hotspot/share/utilities/chunkedList.hpp   | 2 +-
 src/hotspot/share/utilities/events.hpp        | 2 +-
 src/hotspot/share/utilities/growableArray.hpp | 2 +-
 src/hotspot/share/utilities/linkedlist.hpp    | 2 +-
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4
index 62e53a1c421c600ed92eaeb6805fd61e825e3072..9239dfb435521ab276ea1ca566e6bf539f649ddb 100644
--- a/make/autoconf/flags-cflags.m4
+++ b/make/autoconf/flags-cflags.m4
@@ -154,7 +154,8 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
       WARNINGS_ENABLE_ALL_CFLAGS="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
       WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX"
 
-      DISABLED_WARNINGS="unused-parameter unused"
+      DISABLED_WARNINGS="unused-parameter unused address stringop-overflow stringop-truncation format-truncation use-after-free"
+      DISABLED_WARNINGS_CXX="volatile deprecated-enum-enum-conversion deprecated-enum-float-conversion"
       ;;
 
     clang)
@@ -166,7 +167,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
           -Wunused-function -Wundef -Wunused-value -Woverloaded-virtual"
       WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
 
-      DISABLED_WARNINGS="unknown-warning-option unused-parameter unused"
+      DISABLED_WARNINGS="unknown-warning-option unused-parameter unused deprecated-volatile deprecated-anon-enum-enum-conversion deprecated-enum-float-conversion ambiguous-reversed-operator"
 
       ;;
 
@@ -529,6 +530,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
   else
     AC_MSG_ERROR([Don't know how to enable C++14 for this toolchain])
   fi
+  if test "x$OPENJDK_TARGET_OS" = xserenity; then
+    LANGSTD_CXXFLAGS="-std=c++20"
+  fi
   TOOLCHAIN_CFLAGS_JDK_CXXONLY="$TOOLCHAIN_CFLAGS_JDK_CXXONLY $LANGSTD_CXXFLAGS"
   TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $LANGSTD_CXXFLAGS"
   ADLC_LANGSTD_CXXFLAGS="$LANGSTD_CXXFLAGS"
diff --git a/src/hotspot/share/utilities/chunkedList.hpp b/src/hotspot/share/utilities/chunkedList.hpp
index 1a899ee2bfb2e8ef20bb98914fe909248f1aec45..13f05cd3a85acde45124b5cda6303f5198eecb9c 100644
--- a/src/hotspot/share/utilities/chunkedList.hpp
+++ b/src/hotspot/share/utilities/chunkedList.hpp
@@ -44,7 +44,7 @@ template <class T, MEMFLAGS F> class ChunkedList : public CHeapObj<F> {
   }
 
  public:
-  ChunkedList<T, F>() : _top(_values), _next_used(NULL), _next_free(NULL) {}
+  ChunkedList() : _top(_values), _next_used(NULL), _next_free(NULL) {}
 
   bool is_full() const {
     return _top == end();
diff --git a/src/hotspot/share/utilities/events.hpp b/src/hotspot/share/utilities/events.hpp
index b5d67bd6a8ad8eae3d844e904d2d105408f22719..3cf3b399f96cf0be0e5ff15c29fcd7ce12fc2ffd 100644
--- a/src/hotspot/share/utilities/events.hpp
+++ b/src/hotspot/share/utilities/events.hpp
@@ -99,7 +99,7 @@ template <class T> class EventLogBase : public EventLog {
   EventRecord<T>* _records;
 
  public:
-  EventLogBase<T>(const char* name, const char* handle, int length = LogEventsBufferEntries):
+  EventLogBase(const char* name, const char* handle, int length = LogEventsBufferEntries):
     _mutex(Mutex::event, name, true, Mutex::_safepoint_check_never),
     _name(name),
     _handle(handle),
diff --git a/src/hotspot/share/utilities/growableArray.hpp b/src/hotspot/share/utilities/growableArray.hpp
index b75283843eb798e476ffd15d2b8d7a06c8c41586..67074b86fe231fcf3efc93e0bef04c792e2f62c1 100644
--- a/src/hotspot/share/utilities/growableArray.hpp
+++ b/src/hotspot/share/utilities/growableArray.hpp
@@ -118,7 +118,7 @@ class GrowableArrayView : public GrowableArrayBase {
 protected:
   E* _data; // data array
 
-  GrowableArrayView<E>(E* data, int initial_max, int initial_len) :
+  GrowableArrayView(E* data, int initial_max, int initial_len) :
       GrowableArrayBase(initial_max, initial_len), _data(data) {}
 
   ~GrowableArrayView() {}
diff --git a/src/hotspot/share/utilities/linkedlist.hpp b/src/hotspot/share/utilities/linkedlist.hpp
index 16ee6a844fa1afb1cdbc8f3f0656c59710ac4e5e..2c5ffe6cb48085791598252c40b9c526a8b9ac97 100644
--- a/src/hotspot/share/utilities/linkedlist.hpp
+++ b/src/hotspot/share/utilities/linkedlist.hpp
@@ -82,7 +82,7 @@ template <class E> class LinkedListNode : public ResourceObj {
 template <class E> class LinkedList : public ResourceObj {
  protected:
   LinkedListNode<E>*    _head;
-  NONCOPYABLE(LinkedList<E>);
+  NONCOPYABLE(LinkedList);
 
  public:
   LinkedList() : _head(NULL) { }