This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH to suppress bogus -Wunused warning for parameter packs (PR c++/68965)


On 01/13/2016 05:52 PM, Marek Polacek wrote:
On Wed, Jan 13, 2016 at 03:33:27PM -0500, Jason Merrill wrote:
On 01/13/2016 11:50 AM, Marek Polacek wrote:
So to quash that -Wunused-parameter warning, I decided to set TREE_USED at the
place where we create those #xs parameters.

Won't that cause false negatives when the parameter pack is never mentioned
in the function?

You mean that e.g. for

auto fn = [](auto&&... xs)
{
};

int
main ()
{
   fn (1, 2, 3);
}

we won't print
z.cc:1:24: warning: unused parameter 'xs' [-Wunused-parameter]
anymore?  Unfortunately, we don't print that even without the patch :(.

But we do currently print

wa.C:1:24: warning: unused parameter ‘xs#0’ [-Wunused-parameter]
wa.C:1:24: warning: unused parameter ‘xs#1’ [-Wunused-parameter]
wa.C:1:24: warning: unused parameter ‘xs#2’ [-Wunused-parameter]

for that testcase, and I think your patch would remove this warning as well.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]