<p dir="ltr"><br>
On 21 Apr 2014 12:43, "David Blaikie" <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
> On Mon, Apr 21, 2014 at 11:38 AM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>
> > On Mon, Apr 21, 2014 at 7:47 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
> >><br>
> >> Yep<br>
> >> Both of these sound like bugs and should be able to be fixed just by<br>
> >> checking for a non-deleted definition. I'm not sure if there's a particular<br>
> >> function to test that.<br>
> ><br>
> > I think the first warning is entirely appropriate. The point of this warning<br>
> > is that every external linkage function should be declared in a header file;<br>
><br>
> Sure, but how would you declare the deleted function in a header file<br>
> separate from its delete definition?<br>
><br>
> What you put in the header file is "void func() = delete;" and that's<br>
> where the warning fires, isn't it?</p>
<p dir="ltr">No, the warning fires if the first declaration of an externally visible function is in the main source file.</p>
<p dir="ltr">> > it'd help if the warning suggested something like 'mark this function<br>
> > 'static' if it's not intended to be used in other files' or similar.<br>
> >><br>
> >> The unused variable one might crop up in defaulted functions too, in which<br>
> >> case we'll want to check for a user provided definition.<br>
> ><br>
> > I agree on both counts. The same warning is visible here:<br>
> ><br>
> > struct S { S(const S&s); }; S::S(const S&s) = default;<br>
> ><br>
> >><br>
> >> On Apr 21, 2014 3:35 AM, "Nicola Gigante" <<a href="mailto:nicola.gigante@gmail.com">nicola.gigante@gmail.com</a>><br>
> >> wrote:<br>
> >>><br>
> >>> 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<br>
> >>> -Wmissing-prototypes example.cpp<br>
> >>> example.cpp:1:6: warning: no previous prototype for function 'func'<br>
> >>> [-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<br>
> >>> 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?<br>
> >>> I think the warning<br>
> >>> is wrong.<br>
> >>><br>
> >>> 2) Does it make sense to warn about an unused parameter on a deleted<br>
> >>> 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<br>
> >>> force it.<br>
> >>><br>
> >>> Note that these warnings pop up only on free functions. Deleted member<br>
> >>> 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<br>
> >>> warning-less include<br>
> >>> (with -Weverything, more or less) the LLVM headers that I use in my<br>
> >>> 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">cfe-dev@cs.uiuc.edu</a><br>
> >>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
> >><br>
> >><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">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
> >><br>
> ><br>
</p>