In dbus 1.4 branch a compile error with msvc compilers happens. -- Configuring done -- Generating done -- Build files have been written to: K:/vc100d/build/win32libs-sources/dbus-src-1.4.10-20110302/work/msvc2010-Debug-1.4.14 entering: k:\vc100d\build\win32libs-sources\dbus-src-1.4.10-20110302\work\msvc2010-Debug-1.4.14 [ 0%] Building C object dbus/CMakeFiles/dbus-1.dir/k_/vc100d/git/dbus-src-git/dbus/dbus-marshal-basic.obj dbus-marshal-basic.c k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(41) : error C2059: Syntaxfehler: 'do' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(41) : error C2059: Syntaxfehler: 'while' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(44) : error C2059: Syntaxfehler: 'do' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(44) : error C2059: Syntaxfehler: 'while' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(46) : error C2059: Syntaxfehler: 'do' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(46) : error C2059: Syntaxfehler: 'while' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(49) : error C2059: Syntaxfehler: 'do' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(49) : error C2059: Syntaxfehler: 'while' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(51) : error C2059: Syntaxfehler: 'do' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(51) : error C2059: Syntaxfehler: 'while' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(53) : error C2059: Syntaxfehler: 'do' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(53) : error C2059: Syntaxfehler: 'while' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(56) : error C2059: Syntaxfehler: 'do' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(56) : error C2059: Syntaxfehler: 'while' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(60) : error C2059: Syntaxfehler: 'do' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(60) : error C2059: Syntaxfehler: 'while' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(62) : error C2059: Syntaxfehler: 'do' k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c(62) : error C2059: Syntaxfehler: 'while' NMAKE : fatal error U1077: "C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe": Rückgabe-Code "0x2" k:\vc100d\git\dbus-src-git\dbus\dbus-marshal-basic.c line 32ff #if defined(__GNUC__) && (__GNUC__ >= 4) # define _DBUS_ASSERT_ALIGNMENT(type, op, val) \ _DBUS_STATIC_ASSERT (__extension__ __alignof__ (type) op val) #else # define _DBUS_ASSERT_ALIGNMENT(type, op, val) do { } while (0) #endif line 39ff /* True by definition, but just for completeness... */ _DBUS_STATIC_ASSERT (sizeof (char) == 1); _DBUS_ASSERT_ALIGNMENT (char, ==, 1); The compile error is caused by the following line # define _DBUS_ASSERT_ALIGNMENT(type, op, val) do { } while (0)
> The compile error is caused by the following line > # define _DBUS_ASSERT_ALIGNMENT(type, op, val) do { } while (0) The preprocessed code show the main cause - there is a do while loop outside of any function as shown below: typedef struct { char _assertion[(sizeof (char) == 1) ? 1 : -1]; } _DBUS_STATIC_ASSERT_40; do { } while (0);
Created attachment 50220 [details] [review] Fix compilation of (no-op) alignment assertions on non-gcc This patch should hopefully work? --- Subject: [PATCH] Fix compilation of (no-op) alignment assertions on non-gcc do {} while (0) isn't valid at file scope, so the non-gcc code path was broken; in particular, this affected MSVC.
(In reply to comment #2) > Created an attachment (id=50220) [details] > Fix compilation of (no-op) alignment assertions on non-gcc > > This patch should hopefully work? > yes, I applied and pushed this patch according to your hints to upstream dbus-1.4 To be sure, now I have to merge dbus-1.4 into master and push master upstream ?
(In reply to comment #3) > To be sure, now I have to merge dbus-1.4 into master and push master upstream ? Yes please.
(In reply to comment #4) > (In reply to comment #3) > > To be sure, now I have to merge dbus-1.4 into master and push master upstream ? > > Yes please. done, merging worked as expected.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.