public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Fwd: [committed][gdb/build] Fix build for gcc < 11
Date: Wed, 15 Jun 2022 09:30:46 +0200	[thread overview]
Message-ID: <58d4750a-bd09-d80f-fd19-d3cfbf026e78@suse.de> (raw)
In-Reply-To: <20220615070331.GA4485@delia.home>

[ Oops, fix mailing list ]

-------- Forwarded Message --------
Subject: [committed][gdb/build] Fix build for gcc < 11
Date: Wed, 15 Jun 2022 09:03:32 +0200
From: Tom de Vries <tdevries@suse.de>
To: gcc-patches@gcc.gnu.org

Hi,

When building trunk on openSUSE Leap 15.3 with system gcc 7.5.0, I run into:
...
In file included from ../bfd/bfd.h:46:0,
                  from gdb/defs.h:37,
                  from gdb/debuginfod-support.c:19:
gdb/debuginfod-support.c: In function ‘bool debuginfod_is_enabled()’:
gdb/../include/diagnostics.h:42:3: error: unknown option after \
   ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]
    _Pragma (DIAGNOSTIC_STRINGIFY (GCC diagnostic ignored option))
    ^
gdb/../include/diagnostics.h:80:3: note: in expansion of macro \
   ‘DIAGNOSTIC_IGNORE’
    DIAGNOSTIC_IGNORE ("-Wstringop-overread")
    ^~~~~~~~~~~~~~~~~
gdb/debuginfod-support.c:201:4: note: in expansion of macro \
   ‘DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD’
     DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD
     ^
...

The problem is that the warning -Wstringop-overread has been introduced for
gcc 11, and we can only tell gcc to ignore if it knows about it.

Fix this by guarding the DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD definition in
diagnostics.c with '#if __GNUC__ >= 11'.

Tested on x86_64-linux, by completing a build.

Committed to trunk.

Thanks,
- Tom

[gdb/build] Fix build for gcc < 11

---
  include/diagnostics.h | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/include/diagnostics.h b/include/diagnostics.h
index 8bf5a3c3d9b..3da88282261 100644
--- a/include/diagnostics.h
+++ b/include/diagnostics.h
@@ -76,8 +76,10 @@
  # define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \
    DIAGNOSTIC_IGNORE ("-Wstringop-truncation")
  +# if __GNUC__ >= 11
  # define DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD \
    DIAGNOSTIC_IGNORE ("-Wstringop-overread")
+#endif
   # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
    DIAGNOSTIC_IGNORE ("-Wformat-nonliteral")

           reply	other threads:[~2022-06-15  7:30 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20220615070331.GA4485@delia.home>]

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=58d4750a-bd09-d80f-fd19-d3cfbf026e78@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /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).