public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: markus@faehling.com
Cc: gcc@gcc.gnu.org
Subject: Re: GCC/clang warning incompatibility with unused private member variables
Date: Fri, 11 Jun 2021 23:14:47 +0100	[thread overview]
Message-ID: <YMPgV7XbKnXGHgwk@redhat.com> (raw)
In-Reply-To: <5f5ddb1f-39f7-d858-e1c5-afff73043df3@faehling.com>

Here's another #pragma solution to your problem:

class Test {
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpragmas" // so GCC ignores next line
# pragma GCC diagnostic ignored "-Wunused-private-field"
     int a_;
# pragma GCC diagnostic pop
     void b() {};
};

First tell GCC not to warn about the warning option that it doesn't
recognize, then use that option to tell clang to not warn about the
unused member.



      parent reply	other threads:[~2021-06-11 22:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11 19:37 Markus Faehling
2021-06-11 19:59 ` Gabriel Ravier
2021-06-11 20:03 ` Jason Merrill
2021-06-11 20:35   ` Jakub Jelinek
2021-06-13 17:19   ` Jason Merrill
2021-06-11 22:14 ` Jonathan Wakely [this message]

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=YMPgV7XbKnXGHgwk@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=markus@faehling.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).