<div dir="ltr"><div dir="ltr">On Fri, Mar 8, 2019 at 11:11 AM Nico Weber via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>I'm trying to enable -Wextra-semi in Chromium. I'm almost there; the last remaining issue is that we have a macro THREAD_CHECKER(name) that expands to nothing in release builds but to `ThreadChecker name` in debug builds. It's supposed to be used like</div><div><br></div><div>class C {</div><div>  THREAD_CHECKER(checker_);</div><div>};</div><div><br></div><div>[...] Since this is a declaration, this triggers -Wextra-semi. I figured the way to spell the usual `do {} while (0)` you tag on the end of a statement macro to silence this warning could be `static_assert(1, "")`, so I changed THREAD_CHECKER() to expand to that in release builds instead of nothing.</div></div></div></blockquote><div><br></div><div>For what little it's worth, my opinion is that supporting static_assert/_Static_assert in Objective-C++/Objective-C sounds like a great idea.</div><div><br></div><div>However, if you need something for Chromium that works right now and in previous versions of Clang too, have you considered</div><div><br></div><div>    #define THREAD_CHECKER(name) friend void __dummy()</div><div><br></div><div>or</div><div><br></div><div>    #define THREAD_CHECKER(name) static constexpr int __dummy = 0</div><div><br></div><div>The latter should work in most places (as long as you only need one per scope, or you could do `__COUNTER__` tricks if you need several in the same scope). The former should work as long as you only ever need it in class bodies.</div><div>(Bikeshedding the appropriate spelling of `__dummy` is left as an exercise for Chromium's maintainers.)</div><div><br></div><div>–Arthur</div></div></div>