From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1474) id 5AFD3385415F; Mon, 3 Oct 2022 14:57:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5AFD3385415F Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jan-Benedict Glaw To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Fix self-move warning check for GCC 13+ X-Act-Checkin: binutils-gdb X-Git-Author: Jan-Benedict Glaw X-Git-Refname: refs/heads/master X-Git-Oldrev: d1d3123c7bb7149595ec718e6f188565fa5a2a26 X-Git-Newrev: aef1974a66ba9644b239f761c4b8b586f4763e4b Message-Id: <20221003145757.5AFD3385415F@sourceware.org> Date: Mon, 3 Oct 2022 14:57:57 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2022 14:57:57 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Daef1974a66ba= 9644b239f761c4b8b586f4763e4b commit aef1974a66ba9644b239f761c4b8b586f4763e4b Author: Jan-Benedict Glaw Date: Mon Oct 3 16:56:24 2022 +0200 Fix self-move warning check for GCC 13+ =20 GCC 13 got the self-move warning (0abb78dda084a14b3d955757c6431fff71c26= 3f3), but that warning is only checked for clang, resulting in: =20 /usr/lib/gcc-snapshot/bin/g++ -x c++ -I. -I. -I./config -DLOCALEDIR= =3D"\"/tmp/gdb-m68k-linux/share/locale\"" -DHAVE_CONFIG_H -I./../include/op= code -I./../readline/readline/.. -I./../zlib -I../bfd -I./../bfd -I./../in= clude -I../libdecnumber -I./../libdecnumber -I./../gnulib/import -I../gnul= ib/import -I./.. -I.. -I./../libbacktrace/ -I../libbacktrace/ -DTUI=3D1 = -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=3Dmaybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimpli= cit-fallthrough=3D3 -Wduplicated-cond -Wshadow=3Dlocal -Wdeprecated-copy -W= deprecated-copy-dtor -Wredundant-move -Wmissing-declarations -Wstrict-null-= sentinel -Wformat -Wformat-nonliteral -Werror -g -O2 -c -o unittests/envi= ron-selftests.o -MT unittests/environ-selftests.o -MMD -MP -MF unittests/.d= eps/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_e= nviron' to itself [-Werror=3Dself-move] 228 | env =3D 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/binut= ils-gdb/gdb' make: *** [Makefile:13193: all-gdb] Error 2 Diff: --- include/ChangeLog | 4 ++++ include/diagnostics.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/ChangeLog b/include/ChangeLog index f8f7747640e..ce56e95b549 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2022-10-03 Jan-Benedict Glaw + + * diagnostics.h (DIAGNOSTIC_IGNORE_SELF_MOVE): Define for GCC 13+. + 2022-07-08 Nick Clifton =20 * 2.39 branch created. 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 =20 +# if __GNUC__ >=3D 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. */