<div dir="ltr"><div>On Mon, Oct 12, 2015 at 4:11 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Mon, Oct 12, 2015 at 3:04 PM, Nico Weber via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Mon, Oct 12, 2015 at 3:02 PM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Mon, Oct 12, 2015 at 2:18 PM, Reid Kleckner via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I'd really rather not do 2. Fighting with MSVC CRT headers over va_start has been pretty awkward. Users have reported issues with our header override fails. I'd rather not start fighting with winnt.h.<div><br></div><div>I'm OK with 3, but I'm desensitized to having to do this kind of pattern matching for __uuidof, etc. Maybe we should wait for another +1. :)</div></div></blockquote><div><br></div></span><div>A +1 from me for option #3 as well.  I'd feel more comfortable doing #2 if it was for correctness (along the lines of our  va_start/va_arg hack).</div><div><br></div><div>On what basis does MSVC decide that UNREFERENCED_PARAMETER should silence an unused parameter?  IIRC, it expands to wrapping it's argument in parenthesis.  Could we teach clang to do the same?  Sounds like it could be a more general fix.</div></div></div></div></blockquote><div><br></div></span><div>That sounds like a really good idea to me – teach sema that "(x);" has the same meaning as "(void)x;".</div></div></div></div></blockquote><div><br></div></span><div>Hold on a moment.</div><div><br></div><div>`(x);` certainly seems like it should silence an "unreferenced parameter" warning (which is what this macro is for in MSVC), but it seems much less reasonable for it to suppress an "unused value" warning (which is the warning we're getting with Clang).</div></div></div></div></blockquote><div><br></div><div>The reason it seems kind of reasonable to me is that adding parentheses means "I really meant this" in a bunch of places. `if (a = b)` warns but `if ((a = b))` doesn't, for example. So `(x);` seems more natural than `(void)x;` to me. The latter admittedly does have going for it that it's an established convention.</div><div><br></div><div>Can you think of an example where not warning on `(x);` would catch a bug? Hm, I suppose many people like to always write parens after return, and part of the motivation of -Wunused-value is catching forgetting "return"s. So that's an argument for warning on `(x);`.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> This is not an idiom we should encourage for expressing "I am deliberately discarding this value", so I would prefer limiting this to the case where the parens come from a macro named UNREFERENCED_PARAMETER.</div></div></div></div></blockquote></div></div></div>