edo9300 / irrlicht1-8-4 Goto Github PK
View Code? Open in Web Editor NEWFork of the irrlicht engine
License: Other
Fork of the irrlicht engine
License: Other
As is, this project fails to compile on Clang (and presumably any non-GCC compiler).
This is because wl_array_for_each performs pointer arithmetic on void pointers, which is illegal on ISO C/C++.[0] GCC allows this as an extension.[1]
-Werror=pointer-arith
should probably be passed to spot such things in the future, if possible.
Compiling on Clang:
CIrrDeviceWayland.cpp:857:9: error: arithmetic on a pointer to void
wl_array_for_each(state_p, states) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/01rcndpymayvrpswqx34znwfxx82bwvd-wayland-1.20.0-dev/include/wayland-util.h:594:12: note: expanded from macro 'wl_array_for_each'
(pos)++)
~~~~~^
CIrrDeviceWayland.cpp:922:9: error: arithmetic on a pointer to void
wl_array_for_each(state_p, states) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/01rcndpymayvrpswqx34znwfxx82bwvd-wayland-1.20.0-dev/include/wayland-util.h:594:12: note: expanded from macro 'wl_array_for_each'
(pos)++)
~~~~~^
Compiling on GCC with -Werror=pointer-arith
:
CIrrDeviceWayland.cpp: In static member function ‘static void irr::WaylandCallbacks::xdg_toplevel_configure(void*, xdg_toplevel*, int32_t, int32_t, wl_array*)’:
CIrrDeviceWayland.cpp:857:27: error: ISO C++ forbids incrementing a pointer of type ‘void*’ [-Werror=pointer-arith]
857 | wl_array_for_each(state_p, states) {
| ^
CIrrDeviceWayland.cpp: In static member function ‘static void irr::WaylandCallbacks::zxdg_toplevel_configure(void*, zxdg_toplevel_v6*, int32_t, int32_t, wl_array*)’:
CIrrDeviceWayland.cpp:922:27: error: ISO C++ forbids incrementing a pointer of type ‘void*’ [-Werror=pointer-arith]
922 | wl_array_for_each(state_p, states) {
| ^
A possible workaround is one used by the RetroArch team[2].
Something like this seems to fix the problem:
@@ -16,6 +16,27 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+/* RetroArch - A frontend for libretro.
+ * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
+ * Copyright (C) 2011-2017 - Daniel De Matteis
+ *
+ * RetroArch is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with RetroArch.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define WL_ARRAY_FOR_EACH(pos, array, type) \
+ for (pos = (type)(array)->data; \
+ (const char *) pos < ((const char *) (array)->data + (array)->size); \
+ (pos)++)
+
#include "CIrrDeviceWaylandKeycodesWorkaround.h"
#include "CIrrDeviceWayland.h"
@@ -852,9 +873,9 @@ public:
{
CIrrDeviceWayland* device = static_cast<CIrrDeviceWayland*>(data);
- void* state_p;
+ const uint32_t* state_p;
bool fullscreen = false;
- wl_array_for_each(state_p, states) {
+ WL_ARRAY_FOR_EACH(state_p, states, const uint32_t*) {
if(*(xdg_toplevel_state*)state_p == XDG_TOPLEVEL_STATE_FULLSCREEN) {
fullscreen = true;
}
@@ -917,9 +938,9 @@ public:
{
CIrrDeviceWayland* device = static_cast<CIrrDeviceWayland*>(data);
- void* state_p;
+ const uint32_t* state_p;
bool fullscreen = false;
- wl_array_for_each(state_p, states) {
+ WL_ARRAY_FOR_EACH(state_p, states, const uint32_t*) {
if(*(zxdg_toplevel_v6_state*)state_p == ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN) {
fullscreen = true;
}
[0] https://gitlab.freedesktop.org/wayland/wayland/-/issues/34
[1] https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Pointer-Arith.html
[2] libretro/RetroArch@8e638f4
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.