<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 21, 2014 at 7:47 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@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"><p dir="ltr">Yep<br>
 Both of these sound like bugs and should be able to be fixed just by checking for a non-deleted definition. I'm not sure if there's a particular function to test that.</p></blockquote><div>I think the first warning is entirely appropriate. The point of this warning is that every external linkage function should be declared in a header file; it'd help if the warning suggested something like 'mark this function 'static' if it's not intended to be used in other files' or similar.</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"><p dir="ltr">The unused variable one might crop up in defaulted functions too, in which case we'll want to check for a user provided definition.</p>
</blockquote><div>I agree on both counts. The same warning is visible here:</div><div><br></div><div>struct S { S(const S&s); }; S::S(const S&s) = default;<br></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 class=""><div class="h5">
<div class="gmail_quote">On Apr 21, 2014 3:35 AM, "Nicola Gigante" <<a href="mailto:nicola.gigante@gmail.com" target="_blank">nicola.gigante@gmail.com</a>> wrote:<br type="attribution"><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">

Hello.<br>
<br>
Consider this:<br>
<br>
$ cat example.cpp<br>
void func(int x) = delete;<br>
$ clang++ -std=c++11 -fsyntax-only -Wunused-parameter -Wmissing-prototypes example.cpp<br>
example.cpp:1:6: warning: no previous prototype for function 'func' [-Wmissing-prototypes]<br>
void func(int x) = delete;<br>
     ^<br>
example.cpp:1:15: warning: unused parameter 'x' [-Wunused-parameter]<br>
void func(int x) = delete;<br>
              ^<br>
2 warnings generated.<br>
<br>
The two warnings seems false positives:<br>
<br>
1) why does it warn about a missing prototype? One can't add a prototype because<br>
he'll get this error:<br>
<br>
error: deleted definition must be first declaration<br>
void func(int x) = delete;<br>
<br>
So, the deleted definition is acting like a prototype itself, doesn't it? I think the warning<br>
is wrong.<br>
<br>
2) Does it make sense to warn about an unused parameter on a deleted definition?<br>
Of course is unused, but it can't be used anyway.<br>
This force the programmer to avoid parameters name, like:<br>
void func(int) = delete;<br>
but this can reduce readability and it seems to me there's no reason to force it.<br>
<br>
Note that these warnings pop up only on free functions. Deleted member functions<br>
don't generate these warnings in these cases.<br>
<br>
Does it make sense to fix these issues?<br>
<br>
This mail is a part of a more general effort of mine to be able to warning-less include<br>
(with -Weverything, more or less) the LLVM headers that I use in my project.<br>
I think (and hope) more will follow.<br>
<br>
Thanks,<br>
Nicola<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>