public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Fix self-move warning check for GCC 13+
@ 2022-10-03 14:57 Jan-Benedict Glaw
  0 siblings, 0 replies; only message in thread
From: Jan-Benedict Glaw @ 2022-10-03 14:57 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aef1974a66ba9644b239f761c4b8b586f4763e4b

commit aef1974a66ba9644b239f761c4b8b586f4763e4b
Author: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Date:   Mon Oct 3 16:56:24 2022 +0200

    Fix self-move warning check for GCC 13+
    
    GCC 13 got the self-move warning (0abb78dda084a14b3d955757c6431fff71c263f3),
    but that warning is only checked for clang, resulting in:
    
    /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

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  <jbglaw@lug-owl.de>
+
+	* diagnostics.h (DIAGNOSTIC_IGNORE_SELF_MOVE): Define for GCC 13+.
+
 2022-07-08  Nick Clifton  <nickc@redhat.com>
 
 	* 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
 
+# 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.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-03 14:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03 14:57 [binutils-gdb] Fix self-move warning check for GCC 13+ Jan-Benedict Glaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).