summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-04-29 20:41:13 +0200
committerMichał Górny <mgorny@gentoo.org>2021-04-29 21:55:43 +0200
commit30eb83dd80937406bc984e5834b82e73f8738be3 (patch)
treea66f2391fbfdcff1394a657910f2b3979602e686 /app-arch/advancecomp
parentdev-util/samurai: Security revbump to fix null pointer dereference (diff)
downloadgentoo-30eb83dd80937406bc984e5834b82e73f8738be3.tar.gz
gentoo-30eb83dd80937406bc984e5834b82e73f8738be3.tar.bz2
gentoo-30eb83dd80937406bc984e5834b82e73f8738be3.zip
app-arch/advancecomp: Backport C++17 (GCC 11) fix
Closes: https://bugs.gentoo.org/786534 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'app-arch/advancecomp')
-rw-r--r--app-arch/advancecomp/advancecomp-2.2_pre20190301.ebuild7
-rw-r--r--app-arch/advancecomp/files/advancecomp-2.2_pre20190301-gcc-11.patch184
2 files changed, 189 insertions, 2 deletions
diff --git a/app-arch/advancecomp/advancecomp-2.2_pre20190301.ebuild b/app-arch/advancecomp/advancecomp-2.2_pre20190301.ebuild
index e103631dcc47..edb31f6a8c44 100644
--- a/app-arch/advancecomp/advancecomp-2.2_pre20190301.ebuild
+++ b/app-arch/advancecomp/advancecomp-2.2_pre20190301.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -10,6 +10,7 @@ DESCRIPTION="Recompress ZIP, PNG and MNG, considerably improving compression"
HOMEPAGE="https://www.advancemame.it/comp-readme.html"
SRC_URI="https://github.com/amadvance/advancecomp/archive/${EGIT_COMMIT}.tar.gz
-> ${PN}-${EGIT_COMMIT}.tar.gz"
+S=${WORKDIR}/${PN}-${EGIT_COMMIT}
LICENSE="GPL-2+ Apache-2.0 LGPL-2.1+ MIT"
SLOT="0"
@@ -24,7 +25,9 @@ DEPEND="${RDEPEND}"
# https://sourceforge.net/p/advancemame/bugs/270/
RESTRICT="test"
-S=${WORKDIR}/${PN}-${EGIT_COMMIT}
+PATCHES=(
+ "${FILESDIR}"/${P}-gcc-11.patch
+)
src_prepare() {
default
diff --git a/app-arch/advancecomp/files/advancecomp-2.2_pre20190301-gcc-11.patch b/app-arch/advancecomp/files/advancecomp-2.2_pre20190301-gcc-11.patch
new file mode 100644
index 000000000000..b72a6824a305
--- /dev/null
+++ b/app-arch/advancecomp/files/advancecomp-2.2_pre20190301-gcc-11.patch
@@ -0,0 +1,184 @@
+From 7b08f7a2af3f66ab95437e4490499cebb20e5e41 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 28 Apr 2021 22:11:42 +0200
+Subject: [PATCH] Remove dynamic exception specification to fix C++17
+ compatibility
+
+The dynamic exception specifications have been deprecated in C++11
+and eventually removed in C++17 [1]. GCC-11 uses gnu++17 by default,
+causing advancecomp to fail to compile:
+
+ In file included from rezip.cc:24:
+ file.h:70:43: error: ISO C++17 does not allow dynamic exception specifications
+ 70 | bool file_exists(const std::string& file) throw (error);
+ | ^~~~~
+ file.h:71:75: error: ISO C++17 does not allow dynamic exception specifications
+ 71 | e(const std::string& path, const char* data, unsigned size) throw (error);
+ | ^~~~~
+ ...
+
+Since there is really no gain from having these specifications anymore,
+just remove them to fix the build.
+
+[1] https://en.cppreference.com/w/cpp/language/except_spec
+---
+ file.cc | 26 +++++++++++++-------------
+ file.h | 24 ++++++++++++------------
+ 2 files changed, 25 insertions(+), 25 deletions(-)
+
+diff --git a/file.cc b/file.cc
+index 1e90348..d676d25 100644
+--- a/file.cc
++++ b/file.cc
+@@ -98,7 +98,7 @@ void infopath::readonly_set(bool Areadonly)
+ /**
+ * Check if a file exists.
+ */
+-bool file_exists(const string& path) throw (error)
++bool file_exists(const string& path)
+ {
+ struct stat s;
+ if (stat(path.c_str(), &s) != 0) {
+@@ -114,7 +114,7 @@ bool file_exists(const string& path) throw (error)
+ /**
+ * Write a whole file.
+ */
+-void file_write(const string& path, const char* data, unsigned size) throw (error)
++void file_write(const string& path, const char* data, unsigned size)
+ {
+ FILE* f = fopen(path.c_str(), "wb");
+ if (!f)
+@@ -134,7 +134,7 @@ void file_write(const string& path, const char* data, unsigned size) throw (erro
+ /**
+ * Read a whole file.
+ */
+-void file_read(const string& path, char* data, unsigned size) throw (error)
++void file_read(const string& path, char* data, unsigned size)
+ {
+ file_read(path, data, 0, size);
+ }
+@@ -142,7 +142,7 @@ void file_read(const string& path, char* data, unsigned size) throw (error)
+ /**
+ * Read a whole file.
+ */
+-void file_read(const string& path, char* data, unsigned offset, unsigned size) throw (error)
++void file_read(const string& path, char* data, unsigned offset, unsigned size)
+ {
+ FILE* f = fopen(path.c_str(), "rb");
+ if (!f)
+@@ -166,7 +166,7 @@ void file_read(const string& path, char* data, unsigned offset, unsigned size) t
+ /**
+ * Get the time of a file.
+ */
+-time_t file_time(const string& path) throw (error)
++time_t file_time(const string& path)
+ {
+ struct stat s;
+ if (stat(path.c_str(), &s)!=0)
+@@ -178,7 +178,7 @@ time_t file_time(const string& path) throw (error)
+ /**
+ * Set the time of a file.
+ */
+-void file_utime(const string& path, time_t tod) throw (error)
++void file_utime(const string& path, time_t tod)
+ {
+ struct utimbuf u;
+
+@@ -192,7 +192,7 @@ void file_utime(const string& path, time_t tod) throw (error)
+ /**
+ * Get the size of a file.
+ */
+-unsigned file_size(const string& path) throw (error)
++unsigned file_size(const string& path)
+ {
+ struct stat s;
+ if (stat(path.c_str(), &s)!=0)
+@@ -204,7 +204,7 @@ unsigned file_size(const string& path) throw (error)
+ /**
+ * Get the crc of a file.
+ */
+-crc_t file_crc(const string& path) throw (error)
++crc_t file_crc(const string& path)
+ {
+ unsigned size = file_size(path);
+
+@@ -227,7 +227,7 @@ crc_t file_crc(const string& path) throw (error)
+ /**
+ * Copy a file.
+ */
+-void file_copy(const string& path1, const string& path2) throw (error)
++void file_copy(const string& path1, const string& path2)
+ {
+ unsigned size;
+
+@@ -249,7 +249,7 @@ void file_copy(const string& path1, const string& path2) throw (error)
+ /**
+ * Move a file.
+ */
+-void file_move(const string& path1, const string& path2) throw (error)
++void file_move(const string& path1, const string& path2)
+ {
+ if (rename(path1.c_str(), path2.c_str())!=0
+ && errno==EXDEV) {
+@@ -271,7 +271,7 @@ void file_move(const string& path1, const string& path2) throw (error)
+ /**
+ * Remove a file.
+ */
+-void file_remove(const string& path1) throw (error)
++void file_remove(const string& path1)
+ {
+ if (remove(path1.c_str())!=0) {
+ throw error() << "Failed remove of " << path1;
+@@ -281,7 +281,7 @@ void file_remove(const string& path1) throw (error)
+ /**
+ * Rename a file.
+ */
+-void file_rename(const string& path1, const string& path2) throw (error)
++void file_rename(const string& path1, const string& path2)
+ {
+ if (rename(path1.c_str(), path2.c_str())!=0) {
+ throw error() << "Failed rename of " << path1 << " to " << path2;
+@@ -409,7 +409,7 @@ string file_adjust(const string& path) throw ()
+ /**
+ * Make a drectory tree.
+ */
+-void file_mktree(const std::string& path) throw (error)
++void file_mktree(const std::string& path)
+ {
+ string dir = file_dir(path);
+ string name = file_name(path);
+diff --git a/file.h b/file.h
+index 1b0cf85..49429b5 100644
+--- a/file.h
++++ b/file.h
+@@ -67,18 +67,18 @@ typedef unsigned crc_t;
+ crc_t crc_compute(const char* data, unsigned len);
+ crc_t crc_compute(crc_t pred, const char* data, unsigned len);
+
+-bool file_exists(const std::string& file) throw (error);
+-void file_write(const std::string& path, const char* data, unsigned size) throw (error);
+-void file_read(const std::string& path, char* data, unsigned size) throw (error);
+-void file_read(const std::string& path, char* data, unsigned offset, unsigned size) throw (error);
+-time_t file_time(const std::string& path) throw (error);
+-void file_utime(const std::string& path, time_t tod) throw (error);
+-unsigned file_size(const std::string& path) throw (error);
+-crc_t file_crc(const std::string& path) throw (error);
+-void file_copy(const std::string& path1, const std::string& path2) throw (error);
+-void file_move(const std::string& path1, const std::string& path2) throw (error);
+-void file_remove(const std::string& path1) throw (error);
+-void file_mktree(const std::string& path1) throw (error);
++bool file_exists(const std::string& file);
++void file_write(const std::string& path, const char* data, unsigned size);
++void file_read(const std::string& path, char* data, unsigned size);
++void file_read(const std::string& path, char* data, unsigned offset, unsigned size);
++time_t file_time(const std::string& path);
++void file_utime(const std::string& path, time_t tod);
++unsigned file_size(const std::string& path);
++crc_t file_crc(const std::string& path);
++void file_copy(const std::string& path1, const std::string& path2);
++void file_move(const std::string& path1, const std::string& path2);
++void file_remove(const std::string& path1);
++void file_mktree(const std::string& path1);
+
+ std::string file_temp(const std::string& path) throw ();
+ std::string file_randomize(const std::string& path, int n) throw ();