From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 702A8385840B for ; Thu, 4 Nov 2021 12:59:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 702A8385840B Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 1A4Cx33C027155 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 4 Nov 2021 08:59:08 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 1A4Cx33C027155 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 277D31E813; Thu, 4 Nov 2021 08:59:03 -0400 (EDT) Message-ID: <32f7539b-55e6-80c4-0032-a41532eeb933@polymtl.ca> Date: Thu, 4 Nov 2021 08:59:02 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: gdb: disable -Wmissing-prototypes warning w/gcc Content-Language: en-US To: Andrew Burgess , Simon Marchi , gdb-patches@sourceware.org References: <20200303223442.330-1-simon.marchi@efficios.com> <20211104121716.GE918204@redhat.com> From: Simon Marchi In-Reply-To: <20211104121716.GE918204@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 4 Nov 2021 12:59:03 +0000 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2021 12:59:15 -0000 On 2021-11-04 08:17, Andrew Burgess via Gdb-patches wrote: > * Mike Frysinger via Gdb-patches [2021-11-04 08:00:53 -0400]: > >> 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 Just wondering, does anybody care about building GDB with a compiler other than GCC and Clang? Because another way that excludes the warning just for gcc (rather than include it for anything that isn't gcc) would be (in pseudo code): diff --git a/gdbsupport/warning.m4 b/gdbsupport/warning.m4 index 46036fa461e8..33a729a60d5d 100644 --- a/gdbsupport/warning.m4 +++ b/gdbsupport/warning.m4 @@ -150,7 +150,7 @@ then [WARN_CFLAGS="${WARN_CFLAGS} $w"], [] ) - else + elif (compiler is not gcc) or (warning is not -Wmissing-prototypes); then AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([], [])], [WARN_CFLAGS="${WARN_CFLAGS} $w"], If that works, I think it would be preferable, but otherwise I think your patch is OK. Please push whatever makes the most sense to you, so we can finally get rid of this warning :). Simon