TTimo / GtkRadiant

The open source, cross platform level editor for idtech games
http://icculus.org/gtkradiant/
Other
586 stars 155 forks source link

scons build fails on Debian 10, gcc 8.3.0 #664

Closed quakemmo closed 2 years ago

quakemmo commented 3 years ago

g++ -o build/release/radiant/radiant/camwindow.o -c -pipe -Wall -fmessage-length=0 -fvisibility=hidden -I/usr/include/libxml2 -fpermissive -fvisibility-inlines-hidden -O2 -fno-strict-aliasing -pthread -pipe -Wall -fmessage-length=0 -fvisibility=hidden -I/usr/include/libxml2 -DQ_NO_STLPORT -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/harfbuzz -I/usr/include/fribidi -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/gtkglext-1.0 -I/usr/lib/x86_64-linux-gnu/gtkglext-1.0/include -Ibuild/release/radiant/include -Iinclude -Ibuild/release/radiant/libs -Ilibs radiant/camwindow.cpp radiant/camwindow.cpp: In member function ‘void CamWnd::Cam_MouseControl(float)’: radiant/camwindow.cpp:384:11: warning: variable ‘xh’ set but not used [-Wunused-but-set-variable] int xl, xh; ^~ radiant/camwindow.cpp:385:11: warning: variable ‘yh’ set but not used [-Wunused-but-set-variable] int yl, yh; ^~


radiant/camwindow.cpp: In member function ‘void CamWnd::Cam_KeyControl(float)’: radiant/camwindow.cpp:479:65: error: taking address of temporary array VectorMA( velocity, dtime * g_PrefsDlg.m_nMoveSpeed, (vec3_t) { 0, 0, 1 }, velocity); ^~~

radiant/camwindow.cpp:482:66: error: taking address of temporary array VectorMA( velocity, -dtime * g_PrefsDlg.m_nMoveSpeed, (vec3_t) { 0, 0, 1 }, velocity); ^~~


scons: *** [build/release/radiant/radiant/camwindow.o] Error 1 scons: building terminated because of errors.

jdolan commented 3 years ago

This is in my newish smooth camera movement code. Weird. gcc must be getting more strict.

I've opened a PR to address this here: https://github.com/TTimo/GtkRadiant/pull/665

We may want to look at specifying a C language standard (-std=c99 or similar) so that this kind of syntax is supported.

tkoeppe commented 3 years ago

Hm, maybe this is a bug in GCC? See https://stackoverflow.com/a/56196014. C++ allows array-to-pointer conversion even on prvalues.

I don't think we want to compile a .cpp file as C99.

jdolan commented 3 years ago

Why not? It'd be fun.

ensiform commented 3 years ago

According to some answers here it is indeed a quirk of gcc that makes this not work, but clang and modern msvc accept it.

https://stackoverflow.com/questions/32941846/c-error-taking-address-of-temporary-array#32941939

illwieckz commented 2 years ago

@jdolan since #665 is merged, do you believe this issue be closed?

jdolan commented 2 years ago

Yes! Thanks.