Fix runtime support for C++20 mode (#1834782)

This commit is contained in:
Avi Kivity 2020-05-12 15:15:18 +03:00
parent e109a5d109
commit f1bb8d6396
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From 478902a7e57e2283c57410f5aa14939e743b5102 Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi@scylladb.com>
Date: Tue, 12 May 2020 14:51:18 +0300
Subject: [PATCH] antlr3memory.hpp: fix for C++20 mode
gcc 10 in C++20 mode requires that the allocator type match
the type used to allocate, so do that by adding "const" to the
key type.
---
runtime/Cpp/include/antlr3memory.hpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtime/Cpp/include/antlr3memory.hpp b/runtime/Cpp/include/antlr3memory.hpp
index 7713613..4667a00 100755
--- a/runtime/Cpp/include/antlr3memory.hpp
+++ b/runtime/Cpp/include/antlr3memory.hpp
@@ -98,17 +98,17 @@ public:
{
};
template<class KeyType, class ValueType>
class UnOrderedMapType : public std::map< KeyType, ValueType, std::less<KeyType>,
- AllocatorType<std::pair<KeyType, ValueType> > >
+ AllocatorType<std::pair<const KeyType, ValueType> > >
{
};
template<class KeyType, class ValueType>
class OrderedMapType : public std::map< KeyType, ValueType, std::less<KeyType>,
- AllocatorType<std::pair<KeyType, ValueType> > >
+ AllocatorType<std::pair<const KeyType, ValueType> > >
{
};
ANTLR_INLINE static void* operator new (std::size_t bytes)
{
--
2.26.2

View File

@ -1,7 +1,7 @@
%global antlr_version 3.5.2
%global c_runtime_version 3.4
%global javascript_runtime_version 3.1
%global baserelease 26
%global baserelease 27
Summary: ANother Tool for Language Recognition
Name: antlr3
@ -27,6 +27,8 @@ Patch3: 0003-fix-c-template.patch
Patch4: 0004-eof-token.patch
# Make parsers reproducible. Patch from Debian.
Patch5: 0005-reproducible-parsers.patch
# Fix for C++20
Patch6: 0006-antlr3memory.hpp-fix-for-C-20-mode.patch
BuildRequires: ant
BuildRequires: maven-local
@ -143,6 +145,7 @@ sed -i "s,\${buildNumber},`cat %{_sysconfdir}/fedora-release` `date`," tool/src/
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
# remove pre-built artifacts
find -type f -a -name *.jar -delete
@ -278,6 +281,9 @@ install -pm 644 runtime/Cpp/include/* $RPM_BUILD_ROOT/%{_includedir}/
%doc tool/LICENSE.txt
%changelog
* Tue May 12 2020 Avi Kivity <avi@scylladb.com> - 1:3.5.2-27
- Fix for C++20 mode (#1834782)
* Sat Apr 25 2020 Fabio Valentini <decathorpe@gmail.com> - 1:3.5.2-26
- Remove unnecessary dependency on deprecated parent pom.