From patchwork Sun Oct 2 18:54:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan-Benedict Glaw X-Patchwork-Id: 1635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp669474wrs; Sun, 2 Oct 2022 11:54:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lul4q3Ei465PCIwxxCckBZoTF5LkkYFPoF5hni4su+NaCniFzEK2qZRsN4Z8dKEkE0ffi X-Received: by 2002:a17:907:7b95:b0:731:113a:d7a2 with SMTP id ne21-20020a1709077b9500b00731113ad7a2mr12570051ejc.377.1664736887006; Sun, 02 Oct 2022 11:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664736887; cv=none; d=google.com; s=arc-20160816; b=VPtrGSi9YsxUa1/j1N6fhE3BZl5fLhDLqNJvTx/6c91frDR+djotcXTjiizJ9Fry1s Ipv/1zaftY/Hjq1171w3W4ZujArlRAUjp54/QCWz0sMTAKv5AXUWI8xIH/GHkz+SXAR7 a9cy+vt2kkM8Vd6Dv5yRMA57TIUfqnqw0mGpBlMQFVIBVyf9jfbXGf5NBq64ruH6FcMQ maXpFG9iQF49MBhTjhmHMUlPzUHotwOkrJpPUo2D00B1sY33dT3PXW3ESlSwLkVbJWoR MEF280rOA1H3T2p2AMRgJOhyGj46bsxlM/rL+VMwIzcBD3Abdzln96/t7RyUwpeT57XH oDbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:user-agent:content-disposition :mime-version:message-id:subject:to:from:date:dmarc-filter :delivered-to; bh=ti1qOSDuCbxRpxVboq6a9S4ZjHdgLELsIYSWoSTRntM=; b=RGVTy0ZAfBJq7TxtVT/jPoPOZRyW+61FqyYTqDR9+ioueduavtBireBEHITi7lVguc q3rnYAY7aPnvaAKnM3LSOds9eH9EqJXlIux956q8kYgrUSzbLkJvb3Vd2snjwEKBQl7t L8oz+4FOBD2hNvwY+ddKfKlD6zK+KP5bfnk3fISnV9x/LOxygUwHeN0GHeEmkbYXRV6U Q0C2fXsindSB69YVASYuc5r0XFXJG2ACsCtcBuegeQMFWE0Lwcs0QP7l4cGl57U6RelY Gf3l8jzvVyGHNffdlA0NXOYUFmtaMhyPCqcEbXelkctNgaeT5ywRXQ+wu5uNYAyGTrKG uFTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id p13-20020a170906b20d00b0073dd3b9b271si5346892ejz.316.2022.10.02.11.54.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Oct 2022 11:54:46 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B10BD3854144 for ; Sun, 2 Oct 2022 18:54:41 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from lug-owl.de (lug-owl.de [IPv6:2a03:4000:10:469::]) by sourceware.org (Postfix) with ESMTPS id 2CFA13858D32; Sun, 2 Oct 2022 18:54:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2CFA13858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lug-owl.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lug-owl.de Received: by lug-owl.de (Postfix, from userid 1001) id 6800A42039; Sun, 2 Oct 2022 20:54:33 +0200 (CEST) Date: Sun, 2 Oct 2022 20:54:33 +0200 From: Jan-Benedict Glaw To: binutils@sourceware.org, gdb-patches@sourceware.org Subject: [PATCH] diagnostics.h: GCC 13 got -Wself-move, breaks GDB build Message-ID: <20221002185433.gl7dvytfh5wthifx@lug-owl.de> MIME-Version: 1.0 Content-Disposition: inline X-Operating-System: Linux chamaeleon 5.14.0-0.bpo.2-amd64 X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-message-flag: Please send plain text messages only. Do not send HTML emails. Thank you. User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745603146052359039?= X-GMAIL-MSGID: =?utf-8?q?1745603146052359039?= Hi! With GCC commit 0abb78dda084a14b3d955757c6431fff71c263f3 (PR81159), gcc gained -Wself-move. GDB tests various warnings (and suppressing them) in its unittests. -Wself-move is dealt for in case of clang, but not (yet) for GCC, which breaks building GDB with recent GCC versions: /usr/lib/gcc-snapshot/bin/g++ -x c++ -I. -I. -I./config -DLOCALEDIR="\"/tmp/gdb-m68k-linux/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../readline/readline/.. -I./../zlib -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber -I./../gnulib/import -I../gnulib/import -I./.. -I.. -I./../libbacktrace/ -I../libbacktrace/ -DTUI=1 -I./.. -pthread -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wmissing-declarations -Wstrict-null-sentinel -Wformat -Wformat-nonliteral -Werror -g -O2 -c -o unittests/environ-selftests.o -MT unittests/environ-selftests.o -MMD -MP -MF unittests/.deps/environ-selftests.Tpo unittests/environ-selftests.c unittests/environ-selftests.c: In function 'void selftests::gdb_environ_tests::test_self_move()': unittests/environ-selftests.c:228:7: error: moving 'env' of type 'gdb_environ' to itself [-Werror=self-move] 228 | env = std::move (env); | ~~~~^~~~~~~~~~~~~~~~~ unittests/environ-selftests.c:228:7: note: remove 'std::move' call cc1plus: all warnings being treated as errors make[1]: *** [Makefile:1896: unittests/environ-selftests.o] Error 1 make[1]: Leaving directory '/var/lib/laminar/run/gdb-m68k-linux/3/binutils-gdb/gdb' make: *** [Makefile:13193: all-gdb] Error 2 I suggest the following patch. Okay for HEAD? Thanks, Jan-Benedict include: * diagnostics.h (DIAGNOSTIC_IGNORE_SELF_MOVE): Define for GCC 13+. diff --git a/include/diagnostics.h b/include/diagnostics.h index 4161dff6abc..c1a2e8f520c 100644 --- a/include/diagnostics.h +++ b/include/diagnostics.h @@ -99,6 +99,10 @@ DIAGNOSTIC_IGNORE ("-Wunused-but-set-variable") # endif +# if __GNUC__ >= 13 +# define DIAGNOSTIC_IGNORE_SELF_MOVE DIAGNOSTIC_IGNORE ("-Wself-move") +# endif + /* GCC 4.8's "diagnostic push/pop" seems broken when using this, -Wswitch remains enabled at the error level even after a pop. Therefore, don't use it for GCC < 5. */