From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 70C90381D4FD; Thu, 15 Sep 2022 03:11:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 70C90381D4FD Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id C1D3C300089; Thu, 15 Sep 2022 03:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1663211463; bh=uhI+j6CF7m0EHc/EauSt1STphYjgwk+jyFcRPlSsd9M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=QWxy3tDiVKHxYUSqS0BoSXmvwLuuW19ZrDIgydVR3YPMh4abHXy4/ukKwskNZGDkS FD89wDNMlIYfBpR7wWLJP1qxDfemR5YtTZFBPEuLLK9ZyBmrKtLt/o5iQsNgQZttfr XxFoAzWv3FO0rU+g56IxygO69Nq+pSu2Kmc96Rbw= From: Tsukasa OI To: Tsukasa OI , Pedro Alves , Joel Brobecker , Enze Li Cc: gdb-patches@sourceware.org, binutils@sourceware.org Subject: [PATCH 3/4] gdb/unittests: PR28413, suppress warnings generated by Gnulib Date: Thu, 15 Sep 2022 03:10:25 +0000 Message-Id: <7c4aab2d4b2bb36fef66a44e07b91d78af833305.1663211419.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: 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 deal with 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 adding DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS before including "defs.h". gdb/ChangeLog: pr 28413 * unittests/string_view-selftests.c: Suppress Gnulib-generated warnings when "defs.h" is included. --- gdb/unittests/string_view-selftests.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gdb/unittests/string_view-selftests.c b/gdb/unittests/string_view-selftests.c index 2d7261d18d3..c1f7799d94c 100644 --- a/gdb/unittests/string_view-selftests.c +++ b/gdb/unittests/string_view-selftests.c @@ -23,7 +23,12 @@ #define GNULIB_NAMESPACE gnulib +#include "diagnostics.h" + +DIAGNOSTIC_PUSH +DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS #include "defs.h" +DIAGNOSTIC_POP #include "gdbsupport/selftest.h" #include "gdbsupport/gdb_string_view.h" -- 2.34.1