commit a462521e24331c838d0be9aa3a5c84f53e9cc466
Author: Hans de Goede <hdegoede(a)redhat.com>
Date: Sat Mar 12 13:14:08 2022 +0100
Fix compilation on armv7hl
d1x-disable-Werror-useless-cast.patch | 62 +++++++++++++++++++++++++++++++++++
d1x.spec | 3 ++
2 files changed, 65 insertions(+)
---
diff --git a/d1x-disable-Werror-useless-cast.patch
b/d1x-disable-Werror-useless-cast.patch
new file mode 100644
index 0000000..68a8dc8
--- /dev/null
+++ b/d1x-disable-Werror-useless-cast.patch
@@ -0,0 +1,62 @@
+diff -up dxx-rebirth-7258b7fd5966fc38e53f4d8192b0c810829ada02/SConstruct~
dxx-rebirth-7258b7fd5966fc38e53f4d8192b0c810829ada02/SConstruct
+--- dxx-rebirth-7258b7fd5966fc38e53f4d8192b0c810829ada02/SConstruct~ 2022-01-30
05:40:54.000000000 +0100
++++ dxx-rebirth-7258b7fd5966fc38e53f4d8192b0c810829ada02/SConstruct 2022-03-12
13:00:09.405774342 +0100
+@@ -2455,58 +2455,6 @@ $ x86_64-pc-linux-gnu-g++-5.4.0 -x c++ -
+ context.sconf.Define('DXX_PRI_size_type', f)
+ return
+ raise SCons.Errors.StopError("C++ compiler rejects all candidate format strings
for std::size_t.")
+- implicit_tests.append(_implicit_test.RecordedTest('check_compiler_accepts_useless_cast',
"assume compiler accepts -Wuseless-cast"))
+-
+- @_custom_test
+- def check_compiler_useless_cast(self,context):
+- Compile = self.Compile
+- flags = {'CXXFLAGS' : [get_Werror_string(context.env['CXXFLAGS']) +
'useless-cast']}
+- if Compile(context, text='''
+-/*
+- * SDL on Raspbian provokes a warning from -Wuseless-cast
+- *
+- * Reported-by: derhass <
https://github.com/dxx-rebirth/dxx-rebirth/issues/257>
+- */
+-#include <SDL_endian.h>
+-
+-/*
+- * Recent gcc[1] create a useless cast when synthesizing constructor
+- * inheritance, then warn the user about the compiler-generated cast.
+- * Since the user did not write the cast in the source, the user
+- * cannot remove the cast to eliminate the warning.
+- *
+- * The only way to avoid the problem is to avoid using constructor
+- * inheritance in cases where the compiler would synthesize a useless
+- * cast.
+- *
+- * Reported-by: zicodxx <
https://github.com/dxx-rebirth/dxx-rebirth/issues/316>
+- * gcc Bugzilla: <
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70844>
+- *
+- * [1] gcc-6.x, gcc-7.x (all currently released versions)
+- */
+-class base
+-{
+-public:
+- base(int &) {}
+-};
+-
+-class derived : public base
+-{
+-public:
+- using base::base;
+-};
+-
+-''', main='''
+- derived d(argc);
+- return SDL_Swap32(argc);
+-''', msg='whether compiler argument -Wuseless-cast works with SDL and
with constructor inheritance', successflags=flags):
+- return
+- # <=clang-3.7 does not understand -Wuseless-cast
+- # This test does not influence the compile environment, but is
+- # run to distinguish in the output whether the failure is
+- # because the compiler does not accept -Wuseless-cast or because
+- # SDL's headers provoke a warning from -Wuseless-cast.
+- Compile(context, text='', main='', msg='whether compiler accepts
-Wuseless-cast', testflags=flags,
calling_function='compiler_accepts_useless_cast')
+
+ @_custom_test
+ def check_compiler_ptrdiff_cast_int(self,context):
diff --git a/d1x.spec b/d1x.spec
index 5f68aba..8516e4e 100644
--- a/d1x.spec
+++ b/d1x.spec
@@ -18,6 +18,8 @@ Source6: d2x-rebirth.appdata.xml
Patch0: d1x-gcc10.patch
Patch1: d1x-gcc12.patch
Patch2: d1x-window_icon_bitmap.patch
+# Fix compilation on armv7hl, can be dropped when we drop armv7hl support
+Patch3: d1x-disable-Werror-useless-cast.patch
URL:
https://www.dxx-rebirth.com/
BuildRequires: gcc gcc-c++ libpng-devel
BuildRequires: SDL2-devel SDL2_mixer-devel SDL2_image-devel
@@ -69,6 +71,7 @@ robots-h.mvl files to the dir.
%patch0 -p1
%patch1 -p1
%patch2 -p1
+%patch3 -p1
# Fixup encoding and CTRL+Z at the end of the orderfrm.txt files
iconv -f CP850 -t UTF-8 d1shar/ORDERFRM.TXT | head -n-3 > ORDERFRM.TXT
touch -r d1shar/ORDERFRM.TXT ORDERFRM.TXT