public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Ville Voutilainen <ville.voutilainen@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: C++ PATCH for c++/88136, -Wdeprecated-copy too noisy
Date: Sat, 08 Dec 2018 17:53:00 -0000	[thread overview]
Message-ID: <CADzB+2kYU7S9y=CcgKr_7vuwRqsv11Q7HVhRrN_dMudT-1aEnA@mail.gmail.com> (raw)
In-Reply-To: <CAFk2RUYYLv-YguwazLTCxQMHwxDQRivVKqj_rxn4cr1eKLC1dw@mail.gmail.com>

On Sat, Dec 8, 2018 at 12:17 PM Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> On Sat, 8 Dec 2018 at 18:58, Jakub Jelinek <jakub@redhat.com> wrote:
> > > g++ -c -pipe -O2 -fPIC -std=c++1z -fvisibility=hidden
> > > -fvisibility-inlines-hidden -ffunction-sections -fdata-sections
> > > -fno-exceptions -Wall -W -Wvla -Wdate-time -Wshift-overflow=2
> >
> > -W is an alias to -Wextra.
>
> Yeah. Jason, I seem to have code that user-provides a copy constructor (seemingly for no particular reason),
> doesn't bother declaring a copy assignment operator, and still breaks magnificently. :) There is no bug
> in it; the assignment works as expected, so that's a false positive. I am going to suggest taking this warning
> out of -Wextra and making it completely separate for GCC 9.

The documented policy for -Wall is,

     This enables all the warnings about constructions that some users
     consider questionable, and that are easy to avoid (or modify to
     prevent the warning), even in conjunction with macros.
...
     Note that some warning flags are not implied by '-Wall'.  Some of
     them warn about constructions that users generally do not consider
     questionable, but which occasionally you might wish to check for;
     others warn about constructions that are necessary or hard to avoid
     in some cases, and there is no simple way to modify the code to
     suppress the warning.

It seems to me that this warning qualifies for -Wall under these
guidelines.  Providing a copy constructor without a matching
assignment operator is definitely suspect; the false positive only
comes in because, as you say, there was no good reason to provide the
copy constructor for Private.  And it's easy to avoid the warning by
declaring a defaulted assignment operator, if ABI concerns preclude
removing the constructor.

New compiler releases will usually include new warnings that require
some code modification to accommodate.  Why is this one particularly
problematic?

Jason

  reply	other threads:[~2018-12-08 17:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06 21:12 Jason Merrill
2018-12-08 16:46 ` Ville Voutilainen
2018-12-08 16:58   ` Jakub Jelinek
2018-12-08 17:17     ` Ville Voutilainen
2018-12-08 17:53       ` Jason Merrill [this message]
2018-12-08 18:05         ` Ville Voutilainen
2018-12-08 18:33           ` Ville Voutilainen
2018-12-12 14:52             ` Jason Merrill
2018-12-12 15:30               ` Ville Voutilainen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADzB+2kYU7S9y=CcgKr_7vuwRqsv11Q7HVhRrN_dMudT-1aEnA@mail.gmail.com' \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=ville.voutilainen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).