From 1509a3faaeeb572fb4f1a1b2c4886eb2b4439864 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Mon, 23 Jun 2025 07:09:32 -0400 Subject: [PATCH] Update to latest pretty printers from GTS Resolves: RHEL-81976 --- gcc.spec | 12 ++- ...stdc++-prettyprinter-update-15-tests.patch | 72 +++++++++++++++++ gcc14-libstdc++-prettyprinter-update-15.patch | 79 +++++++++++++++++++ update-libstdcxx-prettyprinter.sh | 75 ++++++++++++++++++ 4 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 gcc14-libstdc++-prettyprinter-update-15-tests.patch create mode 100644 gcc14-libstdc++-prettyprinter-update-15.patch create mode 100755 update-libstdcxx-prettyprinter.sh diff --git a/gcc.spec b/gcc.spec index 7038a1e..20000d8 100644 --- a/gcc.spec +++ b/gcc.spec @@ -143,7 +143,7 @@ Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} -Release: %{gcc_release}%{?dist} +Release: %{gcc_release}.1%{?dist} # License notes for some of the less obvious ones: # gcc/doc/cppinternals.texi: Linux-man-pages-copyleft-2-para # isl: MIT, BSD-2-Clause @@ -310,6 +310,10 @@ Patch50: isl-rh2155127.patch Patch100: gcc14-fortran-fdec-duplicates.patch +# Pretty printer updates for GTS +Patch1000: gcc14-libstdc++-prettyprinter-update-15.patch +Patch1001: gcc14-libstdc++-prettyprinter-update-15-tests.patch + # On ARM EABI systems, we do want -gnueabi to be part of the # target triple. %ifnarch %{arm} @@ -914,6 +918,9 @@ touch -r isl-0.24/m4/ax_prog_cxx_for_build.m4 isl-0.24/m4/ax_prog_cc_for_build.m %patch -P100 -p1 -b .fortran-fdec-duplicates~ %endif +%patch -P1000 -p1 -b .libstdc++-prettyprinter-update-15 +%patch -P1001 -p1 -b .libstdc++-prettyprinter-update-15-tests + %ifarch %{arm} rm -f gcc/testsuite/go.test/test/fixedbugs/issue19182.go %endif @@ -3622,6 +3629,9 @@ end %endif %changelog +* Mon Jun 23 2025 Siddhesh Poyarekar - 14.3.1-2.1 +- Update to latest pretty printers from GTS (RHEL-81976) + * Thu Jun 19 2025 Joseph Myers - 14.3.1-2 - update from releases/gcc-14 branch (RHEL-83953) - GCC 14.3 release diff --git a/gcc14-libstdc++-prettyprinter-update-15-tests.patch b/gcc14-libstdc++-prettyprinter-update-15-tests.patch new file mode 100644 index 0000000..122e175 --- /dev/null +++ b/gcc14-libstdc++-prettyprinter-update-15-tests.patch @@ -0,0 +1,72 @@ + libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc | 2 +- + libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc | 2 +- + libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc | 2 +- + libstdc++-v3/testsuite/libstdc++-prettyprinters/filesystem-ts.cc | 2 +- + libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc +index 604a6f6415b..2ef5979834f 100644 +--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc ++++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc +@@ -1,7 +1,7 @@ + // { dg-options "-g -O0" } + // { dg-do run { target c++11 } } + +-// Copyright (C) 2014-2024 Free Software Foundation, Inc. ++// Copyright (C) 2014-2025 Free Software Foundation, Inc. + // + // This file is part of the GNU ISO C++ Library. This library is free + // software; you can redistribute it and/or modify it under the +diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc +index 2f75d12703c..23f6d97ddd4 100644 +--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc ++++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc +@@ -1,7 +1,7 @@ + // { dg-do run { target c++11 } } + // { dg-options "-g -O0" } + +-// Copyright (C) 2011-2024 Free Software Foundation, Inc. ++// Copyright (C) 2011-2025 Free Software Foundation, Inc. + // + // This file is part of the GNU ISO C++ Library. This library is free + // software; you can redistribute it and/or modify it under the +diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc +index c8b70622bef..6dd2b60c0a5 100644 +--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc ++++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc +@@ -1,7 +1,7 @@ + // { dg-options "-g -O0" } + // { dg-do run { target c++17 } } + +-// Copyright (C) 2014-2024 Free Software Foundation, Inc. ++// Copyright (C) 2014-2025 Free Software Foundation, Inc. + // + // This file is part of the GNU ISO C++ Library. This library is free + // software; you can redistribute it and/or modify it under the +diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/filesystem-ts.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/filesystem-ts.cc +index 9faeed02852..3221f2df90d 100644 +--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/filesystem-ts.cc ++++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/filesystem-ts.cc +@@ -2,7 +2,7 @@ + // { dg-do run { target c++11 } } + // { dg-require-filesystem-ts "" } + +-// Copyright (C) 2020-2024 Free Software Foundation, Inc. ++// Copyright (C) 2020-2025 Free Software Foundation, Inc. + // + // This file is part of the GNU ISO C++ Library. This library is free + // software; you can redistribute it and/or modify it under the +diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc +index 7a6ee8d281e..bfb86885457 100644 +--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc ++++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc +@@ -1,7 +1,7 @@ + // { dg-do run { target c++14 } } + // { dg-options "-g -O0" } + +-// Copyright (C) 2014-2024 Free Software Foundation, Inc. ++// Copyright (C) 2014-2025 Free Software Foundation, Inc. + // + // This file is part of the GNU ISO C++ Library. This library is free + // software; you can redistribute it and/or modify it under the diff --git a/gcc14-libstdc++-prettyprinter-update-15.patch b/gcc14-libstdc++-prettyprinter-update-15.patch new file mode 100644 index 0000000..c7f4ffc --- /dev/null +++ b/gcc14-libstdc++-prettyprinter-update-15.patch @@ -0,0 +1,79 @@ + libstdc++-v3/python/libstdcxx/v6/__init__.py | 2 +- + libstdc++-v3/python/libstdcxx/v6/printers.py | 14 +++++++++----- + libstdc++-v3/python/libstdcxx/v6/xmethods.py | 2 +- + 3 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/libstdc++-v3/python/libstdcxx/v6/__init__.py b/libstdc++-v3/python/libstdcxx/v6/__init__.py +index f40acd922af..5a8f2de195d 100644 +--- a/libstdc++-v3/python/libstdcxx/v6/__init__.py ++++ b/libstdc++-v3/python/libstdcxx/v6/__init__.py +@@ -1,4 +1,4 @@ +-# Copyright (C) 2014-2024 Free Software Foundation, Inc. ++# Copyright (C) 2014-2025 Free Software Foundation, Inc. + + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py +index 3026de35bbd..5f5963cb595 100644 +--- a/libstdc++-v3/python/libstdcxx/v6/printers.py ++++ b/libstdc++-v3/python/libstdcxx/v6/printers.py +@@ -1,6 +1,6 @@ + # Pretty-printers for libstdc++. + +-# Copyright (C) 2008-2024 Free Software Foundation, Inc. ++# Copyright (C) 2008-2025 Free Software Foundation, Inc. + + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +@@ -623,6 +623,9 @@ class StdBitReferencePrinter(printer_base): + + def to_string(self): + if not self._val['_M_p']: ++ # PR libstdc++/115098 removed the reference default constructor ++ # that this case relates to. New code should never need this, ++ # but we still handle it for compatibility with old binaries. + return 'invalid std::vector::reference' + return bool(self._val['_M_p'].dereference() & (self._val['_M_mask'])) + +@@ -2827,10 +2830,6 @@ def build_libstdcxx_dictionary(): + # vector + libstdcxx_printer.add_version('std::', 'locale', StdLocalePrinter) + +- libstdcxx_printer.add_version('std::', 'integral_constant', +- StdIntegralConstantPrinter) +- libstdcxx_printer.add_version('std::', 'text_encoding', +- StdTextEncodingPrinter) + + if hasattr(gdb.Value, 'dynamic_type'): + libstdcxx_printer.add_version('std::', 'error_code', +@@ -2893,6 +2892,8 @@ def build_libstdcxx_dictionary(): + StdChronoDurationPrinter) + libstdcxx_printer.add_version('std::chrono::', 'time_point', + StdChronoTimePointPrinter) ++ libstdcxx_printer.add_version('std::', 'integral_constant', ++ StdIntegralConstantPrinter) + + # std::regex components + libstdcxx_printer.add_version('std::__detail::', '_State', +@@ -2968,6 +2969,9 @@ def build_libstdcxx_dictionary(): + # libstdcxx_printer.add_version('std::chrono::(anonymous namespace)', 'Rule', + # StdChronoTimeZoneRulePrinter) + ++ # C++26 components ++ libstdcxx_printer.add_version('std::', 'text_encoding', ++ StdTextEncodingPrinter) + # Extensions. + libstdcxx_printer.add_version('__gnu_cxx::', 'slist', StdSlistPrinter) + +diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py +index 436c866e001..109ca10956a 100644 +--- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py ++++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py +@@ -1,6 +1,6 @@ + # Xmethods for libstdc++. + +-# Copyright (C) 2014-2024 Free Software Foundation, Inc. ++# Copyright (C) 2014-2025 Free Software Foundation, Inc. + + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by diff --git a/update-libstdcxx-prettyprinter.sh b/update-libstdcxx-prettyprinter.sh new file mode 100755 index 0000000..2e044a1 --- /dev/null +++ b/update-libstdcxx-prettyprinter.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +if [ "x$1" != "x" ] && ! [ -d "$1" ]; then + echo "Usage: $0 [git_reference_dir_to_speed_up]" + exit 1 +fi + +# Variables to set up for a new GTS update. +# The latest GTS supported on this branch. +gts_major=15 +# Tests that need to be synced in for this change. These are required to sync +# in adjustments to tests due to changes to pretty printer output. +# Occasionally, a test adjustment may be due to an ABI change, in which case +# the test may fail with the system gcc, since we do not backport ABI changes. +# This is expected, in which case we adjust back the expected output for the +# test to match the system libstdc++ ABI in a subsequent, hand-written patch to +# the tests. +tests=" +filesystem-ts.cc +compat.cc +cxx11.cc +cxx17.cc +libfundts.cc +" + +system_major=`sed -n 's/^%global gcc_major //p' gcc.spec` +systemrev=`sed -n 's/^%global gitrev //p' gcc.spec` + +if [ $gts_major -eq $system_major ]; then echo "GTS same version as system, nothing to do."; exit 1; fi +if ! [ -f gcc.spec ]; then echo Must be run in the directory with gcc.spec file.; exit 1; fi +branch=`git branch --show-current` + +if ! [[ $branch =~ ^c[0-9]+s$ ]]; then echo "Must be run on a valid centos stream branch, not '$branch'"; exit 1; fi + +gtsrev=`curl -s https://gitlab.com/redhat/centos-stream/rpms/gcc-toolset-$gts_major-gcc/-/raw/$(git branch --show-current)/gcc-toolset-15-gcc.spec?ref_type=heads | sed -n 's/^%global gitrev //p'` + +echo "system at $systemrev and GTS at $gtsrev on the vendor branch" + +cwd=$PWD +cleanup() { + rm -rf $cwd/gcc-dir.tmp +} + +trap cleanup EXIT + +# Get vendor branch contents from upstream. git-fetch doesn't have the +# --reference feature, so do a full clone referencing a local upstream repo if +# present. Otherwise fetch only those specific refs. +url=https://gcc.gnu.org/git/gcc.git +echo -n "Getting sources from $url" +if [ "$#" -eq 1 ]; then + echo " (using $1 as cache)" + git clone -q --dissociate --reference $1 $url gcc-dir.tmp + pushd gcc-dir.tmp +else + echo + mkdir gcc-dir.tmp + pushd gcc-dir.tmp + git init -q + git remote add origin $url +fi + +pp_patchfile=gcc$system_major-libstdc++-prettyprinter-update-$gts_major.patch +tests_patchfile=gcc$system_major-libstdc++-prettyprinter-update-$gts_major-tests.patch +git fetch -q origin $systemrev $gtsrev +# We limit the update to just the printer, retain the system gcc hook and +# make-foo. +git diff --stat --patch $systemrev..$gtsrev -- libstdc++-v3/python/libstdcxx > ../$pp_patchfile +echo "Updated $pp_patchfile" + +testfiles=$(echo "$tests" | awk '/.+/{printf "libstdc++-v3/testsuite/libstdc++-prettyprinters/%s ", $1}') +git diff --stat --patch $systemrev..$gtsrev -- $testfiles > ../$tests_patchfile +echo "Updated $tests_patchfile" + +popd