]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix pub_tool_basics.h build issue with g++ 4.4.7.
authorMark Wielaard <mark@klomp.org>
Tue, 6 Jun 2017 09:03:03 +0000 (09:03 +0000)
committerMark Wielaard <mark@klomp.org>
Tue, 6 Jun 2017 09:03:03 +0000 (09:03 +0000)
g++ 4.4.7 doesn't accept union field initializers:
In file included from ../../include/pub_tool_vki.h:50,
                 from valgrind_cpp_test.cpp:13:
../../include/vki/vki-linux.h: In function â€˜vki_cmsghdr* __vki_cmsg_nxthdr(void*, __vki_kernel_size_t, vki_cmsghdr*)’:
../../include/vki/vki-linux.h:673: error: expected primary-expression before â€˜.’ token

Assign value after declaration which works for any g++ version.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16437

include/pub_tool_basics.h

index 64e1929bff6201f3c57e5022aceb146712725477..e3af28339f4f8b3765f871e665e116b1fd1c24d0 100644 (file)
@@ -480,7 +480,8 @@ static inline Bool sr_EQ ( UInt sysno, SysRes sr1, SysRes sr2 ) {
       union {                                \
          void *in;                           \
          D out;                              \
-      } var = {.in = (void *) (x)}; var.out; \
+      } var;                                 \
+      var.in = (void *) (x); var.out;        \
    })
 
 // Poor man's static assert