diff options
author | Ivan Puntiy | 2021-07-03 17:35:11 +0300 |
---|---|---|
committer | Ivan Puntiy | 2021-07-04 21:37:52 +0300 |
commit | 6768405356b8d3236efb07870e38181bb155c348 (patch) | |
tree | 7971e1c4b7e99eb2fb9a0d7d2d956f5681386d6a | |
parent | a4fb7af24a2433e165375ded534263c8963eecef (diff) | |
download | aur-6768405356b8d3236efb07870e38181bb155c348.tar.gz |
fixed min/max macros conflict
-rw-r--r-- | PKGBUILD | 7 | ||||
-rw-r--r-- | cpp17-minmax.patch | 45 |
2 files changed, 50 insertions, 2 deletions
@@ -15,15 +15,18 @@ options=(staticlibs !strip !buildflags) conflicts=(mingw-w64-wxmsw2.9 mingw-w64-wxmsw-static) provides=(mingw-w64-wxmsw2.9 mingw-w64-wxmsw-static) source=("https://github.com/wxWidgets/wxWidgets/releases/download/v${pkgver}/wxWidgets-${pkgver}.tar.bz2" - "fix-narrowing.patch") + "fix-narrowing.patch" + "cpp17-minmax.patch") sha1sums=('406ac736f61d88a3a866aa501e01e408a642c6e7' - '8657efb04e2c7befb83c3c9e5981f99b8484babf') + '8657efb04e2c7befb83c3c9e5981f99b8484babf' + 'a427db2f11b4f69d6aaca5c840e7a9b43883f782') _architectures="i686-w64-mingw32 x86_64-w64-mingw32" prepare() { cd "${srcdir}/wxWidgets-${pkgver}" patch --forward --strip=1 --input="${srcdir}/fix-narrowing.patch" + patch --forward --strip=1 --input="${srcdir}/cpp17-minmax.patch" } build() { diff --git a/cpp17-minmax.patch b/cpp17-minmax.patch new file mode 100644 index 000000000000..7425ea383f28 --- /dev/null +++ b/cpp17-minmax.patch @@ -0,0 +1,45 @@ +From a195bf86a21e9334c68eb5e4a5b0973104553460 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bron?= <frederic.bron@m4x.org> +Date: Tue, 22 May 2018 07:46:11 +0200 +Subject: [PATCH] Make compilation with mingw-w64 possible with -std=c++17. + +The definition of macros min and max in include/wx/msw/wrapgdip.h +b/include/wx/msw/wrapgdip.h was clashing with the new bessel functions +that use std::numeric_limits<T>::min/max. + +So #include <cmath> before #include <gdiplus.h> and use using +declarations of std::min and max instead of macros. +--- + include/wx/msw/wrapgdip.h | 19 ++++++++----------- + 1 file changed, 8 insertions(+), 11 deletions(-) + +diff --git a/include/wx/msw/wrapgdip.h b/include/wx/msw/wrapgdip.h +index 7b12ea51f99..06f14019120 100644 +--- a/include/wx/msw/wrapgdip.h ++++ b/include/wx/msw/wrapgdip.h +@@ -12,17 +12,14 @@ + + #include "wx/msw/wrapwin.h" + +-// these macros must be defined before gdiplus.h is included but we explicitly +-// prevent windows.h from defining them in wx/msw/wrapwin.h as they conflict +-// with standard functions of the same name elsewhere, so we have to pay for it +-// by manually redefining them ourselves here +-#ifndef max +- #define max(a,b) (((a) > (b)) ? (a) : (b)) +-#endif +- +-#ifndef min +- #define min(a,b) (((a) < (b)) ? (a) : (b)) +-#endif ++// min and max must be available for gdiplus.h but we cannot define them as ++// macros because they conflict with std::numeric_limits<T>::min and max when ++// compiling with mingw-w64 and -std=c++17. This happens because with c++17, ++// math.h includes bessel_function which requires std::numeric_limits. ++ ++#include <cmath> ++using std::min; ++using std::max; + + // There are many clashes between the names of the member fields and parameters + // in the standard gdiplus.h header and each of them results in C4458 with |