Valgrind: r16437 - /trunk/include/pub_tool_basics.h

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Valgrind: r16437 - /trunk/include/pub_tool_basics.h

svn-2
Author: mjw
Date: Tue Jun  6 10:03:03 2017
New Revision: 16437

Log:
Fix pub_tool_basics.h build issue with g++ 4.4.7.

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.

Modified:
    trunk/include/pub_tool_basics.h

Modified: trunk/include/pub_tool_basics.h
==============================================================================
--- trunk/include/pub_tool_basics.h (original)
+++ trunk/include/pub_tool_basics.h Tue Jun  6 10:03:03 2017
@@ -480,7 +480,8 @@
       union {                                \
          void *in;                           \
          D out;                              \
-      } var = {.in = (void *) (x)}; var.out; \
+      } var;                                 \
+      var.in = (void *) (x); var.out;        \
    })
 
 // Poor man's static assert


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers