From b443fb3970dd44932634aed3263c5728e9130ff9 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Fri, 20 Jan 2023 16:21:58 -0700 Subject: [PATCH] Fixes to get GDB to build again with GCC 13 and Python 3.12 - Backport fix for problems associated with GCC 13's self-move warning. - Tweak gdb-6.6-buildid-locate-rpm.patch so that running GDB's configure script will not error out due to GCC 13's warnings. - Backport replace deprecated distutils.sysconfig in python-config. --- _gdb.spec.Patch.include | 4 ++ _gdb.spec.patch.include | 1 + _patch_order | 1 + gdb-6.6-buildid-locate-rpm.patch | 6 +-- gdb-gcc-13-backport-self-move-diagnostic-fix | 43 ++++++++++++++++++++ gdb.spec | 10 ++++- 6 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 gdb-gcc-13-backport-self-move-diagnostic-fix diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index b11dae5..1306748 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -284,3 +284,7 @@ Patch067: gdb-rhbz2152431-label-symbol-value.patch #python-config (Lancelot SIX) Patch068: gdb-backport-python-config-replace-deprecated-distutils.patch +# gcc 13 fallout: Backport Jan-Benedict Glaw's fix for the self-move +# warning check +Patch069: gdb-gcc-13-backport-self-move-diagnostic-fix + diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index f004491..4ef8e6c 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -66,3 +66,4 @@ %patch066 -p1 %patch067 -p1 %patch068 -p1 +%patch069 -p1 diff --git a/_patch_order b/_patch_order index e00785a..285e149 100644 --- a/_patch_order +++ b/_patch_order @@ -66,3 +66,4 @@ gdb-sw22395-constify-target_desc.patch gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch gdb-rhbz2152431-label-symbol-value.patch gdb-backport-python-config-replace-deprecated-distutils.patch +gdb-gcc-13-backport-self-move-diagnostic-fix diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index 6c3b728..6481d30 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -486,7 +486,7 @@ diff --git a/gdb/configure b/gdb/configure +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); +extern rpmts rpmtsCreate(void); +extern rpmts rpmtsFree(rpmts ts); -+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + +int @@ -748,7 +748,7 @@ diff --git a/gdb/configure b/gdb/configure +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); +extern rpmts rpmtsCreate(void); +extern rpmts rpmtsFree(rpmts ts); -+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + +int @@ -949,7 +949,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); +extern rpmts rpmtsCreate(void); +extern rpmts rpmtsFree(rpmts ts); -+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + ]]), [ + LIBRPM_COMPAT=true diff --git a/gdb-gcc-13-backport-self-move-diagnostic-fix b/gdb-gcc-13-backport-self-move-diagnostic-fix new file mode 100644 index 0000000..d0172aa --- /dev/null +++ b/gdb-gcc-13-backport-self-move-diagnostic-fix @@ -0,0 +1,43 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Fri, 20 Jan 2023 15:15:59 -0700 +Subject: gdb-gcc-13-backport-self-move-diagnostic-fix + +;; gcc 13 fallout: Backport Jan-Benedict Glaw's fix for the self-move +;; warning check + +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 --git a/include/diagnostics.h b/include/diagnostics.h +--- a/include/diagnostics.h ++++ b/include/diagnostics.h +@@ -79,6 +79,15 @@ + # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \ + DIAGNOSTIC_IGNORE ("-Wformat-nonliteral") + ++# if __GNUC__ >= 5 ++# define DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE \ ++ 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. */ diff --git a/gdb.spec b/gdb.spec index 277d60a..50e1959 100644 --- a/gdb.spec +++ b/gdb.spec @@ -54,7 +54,7 @@ Version: 12.1 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 12%{?dist} +Release: 13%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL # Do not provide URL for snapshots as the file lasts there only for 2 days. @@ -1190,8 +1190,14 @@ fi %endif %changelog +* Fri Jan 20 2023 Kevin Buettner - 12.1-13 +- Backport fix for problems associated with GCC 13's self-move warning. + (Jan-Benedict Glaw) +- Tweak gdb-6.6-buildid-locate-rpm.patch so that running GDB's configure + script will not error out due to GCC 13's warnings. + * Thu Jan 19 2023 Alexandra Hájková - 12.1-12 -- Backport replace deprecated distutils.sysconfig in python-confiag. +- Backport replace deprecated distutils.sysconfig in python-config. (Lancelot SIX) * Thu Jan 19 2023 Fedora Release Engineering