public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Simon Marchi <simon.marchi@efficios.com>
Cc: gdb-patches@sourceware.org
Subject: gdb: disable -Wmissing-prototypes warning w/gcc
Date: Thu, 4 Nov 2021 08:00:53 -0400	[thread overview]
Message-ID: <YYPLdZCWUWIRBCFX@vapier> (raw)
In-Reply-To: <20200303223442.330-1-simon.marchi@efficios.com>

[-- Attachment #1: Type: text/plain, Size: 1979 bytes --]

On 03 Mar 2020 17:34, Simon Marchi wrote:
> While compiling with clang, I noticed it didn't catch cases where my
> function declaration didn't match my function definition.  This is
> normally caught by gcc with -Wmissing-declarations.
> 
> On clang, this is caught by -Wmissing-prototypes instead.
> 
> Note that on gcc, -Wmissing-prototypes also exists, but is only valid
> for C and Objective-C.  It gets correctly rejected by the configure
> script since gcc rejects it with:
> 
>     cc1plus: error: command line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++ -Werror
> 
> So this warning flag ends up not used for gcc (which is what we want).

so ccache has a long standing bug where it mishandles -Werror with other
-W options causing the configure test to pass when it shouldn't.
https://github.com/ccache/ccache/issues/738

that means ccache+gcc builds of gdb are full of annoying logs:
  CXX    cli/cli-decode.o
cc1plus: warning: command-line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++

i get that the configure script here isn't wrong, but there aren't any
knobs in here that i can tweak to workaround the issue either, and i'm
trying to avoid carrying patches in all my local branches, and configure
files are kind of meant to deal with all sorts of system warts.

so random terrible idea below.
-mike

--- a/gdbsupport/warning.m4
+++ b/gdbsupport/warning.m4
@@ -51,10 +51,15 @@ build_warnings="-Wall -Wpointer-arith \
 -Wdeprecated-copy-dtor \
 -Wredundant-move \
 -Wmissing-declarations \
--Wmissing-prototypes \
 -Wstrict-null-sentinel \
 "
 
+# GCC doesn't support this flag currently, and probing via ccache breaks.
+# https://github.com/ccache/ccache/issues/738
+if test "${GCC}" != yes ; then
+  build_warnings="$build_warnings -Wmissing-prototypes"
+fi
+
 case "${host}" in
   *-*-mingw32*)
     # Enable -Wno-format by default when using gcc on mingw since many

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2021-11-04 12:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03 22:34 [PATCH] gdb: enable -Wmissing-prototypes warning Simon Marchi
2020-03-11 19:16 ` Simon Marchi
2021-11-04 12:00 ` Mike Frysinger [this message]
2021-11-04 12:17   ` gdb: disable -Wmissing-prototypes warning w/gcc Andrew Burgess
2021-11-04 12:59     ` Simon Marchi
2021-11-04 18:43       ` Simon Marchi
2021-11-04 20:18         ` Mike Frysinger

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=YYPLdZCWUWIRBCFX@vapier \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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).