We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4543

Summary: Unable to build Fcitx support [-Werror=declaration-after-statement]
Product: SDL Reporter: Marius Bakke <mbakke>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sylvain.becker
Version: 2.0.9   
Hardware: x86_64   
OS: Linux   

Description Marius Bakke 2019-03-11 19:07:03 UTC
Hello!

I'm trying to build SDL2 2.0.9 with Fcitx support and get this build failure:

libtool: compile:  gcc -g -O3 -DUSING_GENERATED_CONFIG_H -Iinclude -I/tmp/guix-build-sdl2-2.0.9.drv-0/SDL2-2.0.9/include -idirafter /tmp/guix-build-sdl2-2.0.9.drv-0/SDL2-2.0.9/src/video/khronos -mmmx
 -m3dnow -msse -msse2 -msse3 -Wall -fvisibility=hidden -Wdeclaration-after-statement -Werror=declaration-after-statement -D_REENTRANT -I/gnu/store/yhqvcv9pscd1lwp6v2imqda7zmn3nsgn-libdrm-2.4.97/include/libdrm -Igen -I/gnu/store/pwpa9iqdk5pmz8077yk08a9kl1d5jdad-dbus-1.12.12/include/dbus-1.0 -I/gnu/store/pwpa9iqdk5pmz8077yk08a9kl1d5jdad-dbus-1.12.12/lib/dbus-1.0/include -pthread -I/gnu/store/rgma5i4p3kl8zp2rs0icns0gkag2wq3g-glib-2.56.3/include/glib-2.0 -I/gnu/store/rgma5i4p3kl8zp2rs0icns0gkag2wq3g-glib-2.56.3/lib/glib-2.0/include -I/gnu/store/pridjzzwf458shq9z1cbmsd9agax4qm2-ibus-1.5.19/include/ibus-1.0 -D_REENTRANT -DHAVE_LINUX_VERSION_H -MMD -MT build/SDL_fcitx.lo -c /tmp/guix-build-sdl2-2.0.9.drv-0/SDL2-2.0.9/src/core/linux/SDL_fcitx.c  -fPIC -DPIC -o build/.libs/SDL_fcitx.o 
In file included from /gnu/store/zwhjc14ds2y6a8ym0vpbxr45nfm3d42j-fcitx-4.2.9.6/include/fcitx/frontend.h:31:0,
                 from /tmp/guix-build-sdl2-2.0.9.drv-0/SDL2-2.0.9/src/core/linux/SDL_fcitx.c:25:
/gnu/store/zwhjc14ds2y6a8ym0vpbxr45nfm3d42j-fcitx-4.2.9.6/include/fcitx-utils/utarray.h: In function ‘utarray_prev’:
/gnu/store/zwhjc14ds2y6a8ym0vpbxr45nfm3d42j-fcitx-4.2.9.6/include/fcitx-utils/utarray.h:332:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     int idx = utarray_eltidx(a, e) - 1;
     ^~~
/gnu/store/zwhjc14ds2y6a8ym0vpbxr45nfm3d42j-fcitx-4.2.9.6/include/fcitx-utils/utils.h: In function ‘fcitx_array_move’:
/gnu/store/zwhjc14ds2y6a8ym0vpbxr45nfm3d42j-fcitx-4.2.9.6/include/fcitx-utils/utarray.h:178:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
         void *_temp = malloc((a)->icd->sz);                             \
         ^
/gnu/store/zwhjc14ds2y6a8ym0vpbxr45nfm3d42j-fcitx-4.2.9.6/include/fcitx-utils/utils.h:889:9: note: in expansion of macro ‘utarray_move’
         utarray_move(ary, (unsigned)from, (unsigned)to);
         ^~~~~~~~~~~~

This is using GCC7 and glibc 2.28.
Comment 1 Sylvain 2019-03-12 07:09:14 UTC
Issue seems to be in fcitx and not in SDL2:

https://github.com/fcitx/fcitx/blob/master/src/lib/fcitx-utils/utarray.h#L178

https://github.com/fcitx/fcitx/blob/master/src/lib/fcitx-utils/utarray.h#L332


this is wrong if you compile with -Werror=declaration-after-statement

I close this as invalid