From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id C83BD3948A4E; Mon, 14 Nov 2022 13:59:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C83BD3948A4E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668434351; bh=av0jYeTPeMJyfYn6jStb00mzJK4/Zp7Zxsi5W7/Z3QM=; h=From:To:Subject:Date:From; b=WwtecDMZSEnhf/HbJLPFUC9dkSoi47cLI4aKB0KEd1xxP4XZ0ZvkgjNaZtDFjQ7uQ 2dwX5tJrBPunOqtNjwtLEAXNXqqEg+EBLOceTGxdck+GbbxVB1aUUe/gz0R/MltEVh 0KhToDyVmolhbewWeYGV2nF7/r7ctRFCZhWYtNcg= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/unittests: PR28413, suppress warnings generated by Gnulib X-Act-Checkin: binutils-gdb X-Git-Author: Tsukasa OI X-Git-Refname: refs/heads/master X-Git-Oldrev: cafdb713d837ce45cf6180966070fe77386f1d7d X-Git-Newrev: a5b6e43669b78729d2ef78d668e19bac2b11197d Message-Id: <20221114135911.C83BD3948A4E@sourceware.org> Date: Mon, 14 Nov 2022 13:59:11 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Da5b6e43669b7= 8729d2ef78d668e19bac2b11197d commit a5b6e43669b78729d2ef78d668e19bac2b11197d Author: Tsukasa OI Date: Thu Oct 20 09:32:06 2022 +0000 gdb/unittests: PR28413, suppress warnings generated by Gnulib =20 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... =20 - 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. =20 This issue is raised as PR28413. =20 However, previous proposal to fix this issue (a "fix" to Gnulib): was rejected because it ruins the intent of Gnulib warnings. =20 So, we need a Binutils/GDB-side solution. =20 This commit tries to address this issue on the GDB side. We have "include/diagnostics.h" to disable certain warnings only when necessary. =20 This commit suppresses the Gnulib warnings by surrounding entire #inclu= de block with DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS to disable Gnulib- generated warnings on all standard C++ header files. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D28413 Approved-By: Simon Marchi Change-Id: Ieeb5a31a6902808d4c7263a2868ae19a35e0ccaa Diff: --- gdb/unittests/string_view-selftests.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gdb/unittests/string_view-selftests.c b/gdb/unittests/string_v= iew-selftests.c index 2d7261d18d3..86c8f6dc024 100644 --- a/gdb/unittests/string_view-selftests.c +++ b/gdb/unittests/string_view-selftests.c @@ -23,6 +23,15 @@ =20 #define GNULIB_NAMESPACE gnulib =20 +#include "diagnostics.h" + +/* Since this file uses GNULIB_NAMESPACE, some code defined in headers end= s up + using system functions rather than gnulib replacements. This is not re= ally + a problem for this test, but it generates some warnings with Clang, sil= ence + them. */ +DIAGNOSTIC_PUSH +DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS + #include "defs.h" #include "gdbsupport/selftest.h" #include "gdbsupport/gdb_string_view.h" @@ -34,6 +43,8 @@ #include #include =20 +DIAGNOSTIC_POP + /* libstdc++'s testsuite uses VERIFY. */ #define VERIFY SELF_CHECK