|Summary:||Support C++11 static_assert|
|Product:||WebKit||Reporter:||Allan Sandfeld Jensen <allan.jensen>|
|Component:||Web Template Framework||Assignee:||Allan Sandfeld Jensen <allan.jensen>|
|Severity:||Normal||CC:||andersca, ap, benjamin, cmarcelo, ojan.autocc, webkit.review.bot, zan|
|Version:||528+ (Nightly build)|
Description Allan Sandfeld Jensen 2013-03-26 07:20:28 PDT
When available we use the Clang extension _Static_assert for compile assertion since this is just a C version of the C++11 static assert we should use the C++11 version when possible. Note this is not always possible since Assertions.h where COMPILE_ASSERT is defined can be used from both C and C++, and COMPILE_ASSERT will therefore still not be available in C for non clang compilers.
Comment 2 Alexey Proskuryakov 2013-03-26 11:01:43 PDT
Comment on attachment 195083 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=195083&action=review > Source/WTF/wtf/Assertions.h:348 > #if COMPILER_SUPPORTS(C_STATIC_ASSERT) > #define COMPILE_ASSERT(exp, name) _Static_assert((exp), #name) I think that this should have a comment explaining why we still have this: // Unlike static_assert below, this also works in plain C code. That said, I'm unsure if we ever use - or want to use - COMPILE_ASSERT in plain C code. > Source/WTF/wtf/Compiler.h:128 > +#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1 Shouldn't this be defined for clang too? The behavior in this patch would not be affected, but it's better to not leave such a tripmine for later IMO.
Comment 3 Allan Sandfeld Jensen 2013-03-27 03:55:01 PDT
Created attachment 195266 [details] Patch Added detection of C++11 static_assert to clang, and C11 _Static_assert to GCC.
Comment 4 Allan Sandfeld Jensen 2013-03-27 03:57:06 PDT
Created attachment 195267 [details] Patch Remove accidentially uploaded change.
Comment 5 Allan Sandfeld Jensen 2013-03-27 10:31:03 PDT
Comment on attachment 195267 [details] Patch Clearing flags on attachment: 195267 Committed r146993: <http://trac.webkit.org/changeset/146993>
Comment 6 Allan Sandfeld Jensen 2013-03-27 10:31:07 PDT
All reviewed patches have been landed. Closing bug.