From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id B84D5385781F; Mon, 14 Nov 2022 14:02:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B84D5385781F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 2584A1E0D3; Mon, 14 Nov 2022 09:02:46 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1668434567; bh=+HFn2pM7sNRBga4l+CqGGZnaAg9GIoDkDZ/eTBVz22s=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ZB/bDwjKVKTGPThxxH8UxFpu8T3N0BKlUwBeZbCnAy3JRFcsHVmdBwDr5w/OEqw13 a+HIZ29usW7pp8/4P4WzPo1ImxYs26pDzIY2vNkCaw8YpS2sjrFVt2j+UGpts/jTpE a6cQ3+IwbA+ULdgF3CJ6P3XFf3HuZdGMGs6ceTtg= Message-ID: Date: Mon, 14 Nov 2022 09:02:46 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v3] gdb/unittests: PR28413, suppress warnings generated by Gnulib Content-Language: en-US To: Tsukasa OI , Pedro Alves , Joel Brobecker , Enze Li Cc: gdb-patches@sourceware.org References: <93b29e438526cd93b260339a0dd567a0ca04ed87.1666113056.git.research_trasio@irq.a4lg.com> From: Simon Marchi In-Reply-To: <93b29e438526cd93b260339a0dd567a0ca04ed87.1666113056.git.research_trasio@irq.a4lg.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 10/18/22 13:11, Tsukasa OI via Gdb-patches wrote: > Gnulib generates a warning if the system version of certain functions > are used (to redirect the developer to use Gnulib version). It caused a > compiler error when... > > - Compiled with Clang > - -Werror is specified (by default) > - C++ standard used by Clang is before C++17 (by default as of 15.0.0) > when this unit test is activated. > > This issue is raised as PR28413. > > However, previous proposal to fix this issue (a "fix" to Gnulib): > > was rejected because it ruins the intent of Gnulib warnings. > > So, we need a Binutils/GDB-side solution. > > This commit tries to address this issue on the GDB side. We have > "include/diagnostics.h" to disable certain warnings only when necessary. > > This commit suppresses the Gnulib warnings by surrounding entire #include > block with DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS to disable Gnulib- > generated warnings on all standard C++ header files. > --- > gdb/unittests/string_view-selftests.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/gdb/unittests/string_view-selftests.c b/gdb/unittests/string_view-selftests.c > index 2d7261d18d3..441d533b54e 100644 > --- a/gdb/unittests/string_view-selftests.c > +++ b/gdb/unittests/string_view-selftests.c > @@ -23,6 +23,11 @@ > > #define GNULIB_NAMESPACE gnulib > > +#include "diagnostics.h" > + > +DIAGNOSTIC_PUSH > +DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS > + > #include "defs.h" > #include "gdbsupport/selftest.h" > #include "gdbsupport/gdb_string_view.h" > @@ -34,6 +39,8 @@ > #include > #include > > +DIAGNOSTIC_POP > + > /* libstdc++'s testsuite uses VERIFY. */ > #define VERIFY SELF_CHECK > > > base-commit: 04ea6b63141c43d9e96999e16917358088556fdd Woops, I merged the v2 version of this patch. But I think it's the same code. Simon