|
From: Florian K. <fl...@ei...> - 2015-03-27 22:19:05
|
On 27.03.2015 18:11, Julian Seward wrote: > > /me thinks .. Uh huh .. Florian has been doing home-grown static > asserts :-) > Just this one :) > Except, there are dozens of places where I would like to have static asserts > generally available. Insanely enough, there is, in include/vki/vki-linux.h, > a definition of VKI_STATIC_ASSERT. Maybe we should pull it out, rename it > VG_STATIC_ASSERT, and make it generally available. What do you think? I didn't know about VKI_STATIC_ASSERT. include/vki wasn't a likely place to look for that sort of thing.. VKI_STATIC_ASSERT is used inside vki-linux.h so pulling it out is probably not ideal. It just creates a dependency as include/vki/*.h does not depend on valgrind headers right now. It's best to just leave it alone. Now, we want static asserts in VEX and valgrind. So we add VEX_STATIC_ASSERT to main_util.h and VG_STATIC_ASSERT in pub_tool_basics.h, like we do with LIKELY and friends. I like the implementation of VKI_STATIC_ASSERT (without the C++ mumbo-jumbo) better than what I came up with, as it avoids adding a symbol. So I would use that approach for VEX/VG_STATIC_ASSERT as well. Florian |