On Thu, Feb 5, 2026 at 5:11 AM Torbjörn SVENSSON <[email protected]> wrote: > > Replace all usage of CONST_CAST* macros with const_cast<> C++ expression. > For the locations that may be used in both C and C++, especially header > files. Expand the macro to do the preprocessor selection in place (only > 3 locations in this patch series). > > This patch series also replaces the need for > https://gcc.gnu.org/pipermail/gcc-patches/2026-January/707241.html > on trunk. The patch above is still valid for releases/gcc-15 though > unless this entire series is to be backported to releases/gcc-15. > > This patch series have been regtested on top of r16-7257-g0ef6df1db19 > for x86_64-pc-linux-gnu. In addition, I've built the source tree with > target x86_64-w64-mingw and arm-none-eabi. > > > Ok for trunk?
Ok for 17, I will leave it up to Richard if he wants these patches in for GCC 16 or not. > > > > Torbjörn SVENSSON (8): > middle-end: replace CONST_CAST_RTX_INSN with const_cast<struct > rtx_insn *> [PR123892] > middle-end: replace CONST_CAST_RTX with const_cast<rtx> [PR123892] > middle-end: replace CONST_CAST_BB with const_cast<basic_block> > [PR123892] > middle-end: replace CONST_CAST_GIMPLE with const_cast<gimple *> > [PR123892] > middle-end: replace CONST_CAST_TREE with const_cast<tree> [PR123892] > gcc/tree.h: replace CONST_CAST2 with const_cast<> [PR123892] > middle-end: replace CONST_CAST with const_cast<> [PR123892] > libgcc: replace CONST_CAST2 macro > > gcc/alias.cc | 2 +- > gcc/attribs.cc | 14 ++++---- > gcc/builtins.cc | 10 +++--- > gcc/c-family/c-common.cc | 2 +- > gcc/c-family/c-gimplify.cc | 2 +- > gcc/c-family/c-lex.cc | 6 ++-- > gcc/c/c-decl.cc | 2 +- > gcc/c/c-parser.cc | 2 +- > gcc/collect2.cc | 2 +- > gcc/config/aarch64/aarch64.cc | 5 +-- > gcc/config/arm/arm.cc | 6 ++-- > gcc/config/bpf/core-builtins.cc | 4 +-- > gcc/config/darwin.cc | 6 ++-- > gcc/config/gcn/mkoffload.cc | 13 +++++--- > gcc/config/i386/x86-tune-sched-bd.cc | 2 +- > gcc/config/nvptx/mkoffload.cc | 6 ++-- > gcc/config/nvptx/nvptx.cc | 2 +- > gcc/config/rs6000/rs6000.cc | 6 ++-- > gcc/cp/call.cc | 4 +-- > gcc/cp/constraint.cc | 2 +- > gcc/cp/cp-lang.cc | 2 +- > gcc/cp/cp-objcp-common.cc | 2 +- > gcc/cp/cp-tree.h | 12 ++++--- > gcc/cp/decl.cc | 2 +- > gcc/cp/init.cc | 2 +- > gcc/cp/parser.cc | 2 +- > gcc/cp/pt.cc | 12 +++---- > gcc/cp/reflect.cc | 6 ++-- > gcc/cp/tree.cc | 32 +++++++++---------- > gcc/cp/typeck.cc | 10 +++--- > gcc/cp/typeck2.cc | 2 +- > gcc/ctfc.cc | 6 ++-- > gcc/d/d-builtins.cc | 2 +- > gcc/d/d-incpath.cc | 4 +-- > gcc/d/d-lang.cc | 4 +-- > gcc/d/d-spec.cc | 4 +-- > gcc/d/decl.cc | 4 +-- > gcc/dumpfile.cc | 8 ++--- > gcc/fold-const.cc | 15 +++++---- > gcc/fortran/gfortran.h | 7 +++- > gcc/fortran/module.cc | 14 ++++---- > gcc/fortran/openmp.cc | 2 +- > gcc/fortran/options.cc | 2 +- > gcc/fortran/parse.cc | 2 +- > gcc/fortran/scanner.cc | 4 +-- > gcc/fortran/st.cc | 2 +- > gcc/fortran/trans-intrinsic.cc | 2 +- > gcc/gcc.cc | 36 ++++++++++----------- > gcc/gcov.cc | 2 +- > gcc/gengtype-parse.cc | 4 +-- > gcc/gengtype-state.cc | 2 +- > gcc/gengtype.cc | 28 ++++++++-------- > gcc/genoutput.cc | 2 +- > gcc/ggc-page.cc | 2 +- > gcc/gimple-expr.cc | 2 +- > gcc/gimple.h | 2 +- > gcc/godump.cc | 12 +++---- > gcc/lto-section-in.cc | 6 ++-- > gcc/lto-wrapper.cc | 8 ++--- > gcc/lto/lto-common.cc | 10 +++--- > gcc/lto/lto.cc | 2 +- > gcc/omp-offload.cc | 2 +- > gcc/passes.cc | 4 +-- > gcc/plugin.cc | 2 +- > gcc/prefix.cc | 2 +- > gcc/pretty-print.cc | 2 +- > gcc/print-rtl.cc | 3 +- > gcc/recog.cc | 2 +- > gcc/rtlanal.cc | 3 +- > gcc/rust/backend/rust-tree.cc | 16 +++++----- > gcc/sched-deps.cc | 2 +- > gcc/sel-sched-ir.cc | 4 +-- > gcc/selftest.cc | 2 +- > gcc/statistics.cc | 2 +- > gcc/stringpool.cc | 4 +-- > gcc/system.h | 48 ---------------------------- > gcc/tracer.cc | 3 +- > gcc/tree-cfg.cc | 4 +-- > gcc/tree-object-size.cc | 4 +-- > gcc/tree-profile.cc | 12 +++---- > gcc/tree.cc | 4 +-- > gcc/tree.h | 26 +++++++-------- > gcc/tsystem.h | 3 -- > gcc/var-tracking.cc | 2 +- > gcc/varasm.cc | 6 ++-- > gcc/vec.h | 2 +- > libgcc/config/i386/gthr-win32.h | 17 ++++------ > libgcc/config/pa/gthr-dce.h | 18 ++++------- > 88 files changed, 266 insertions(+), 315 deletions(-) > > -- > 2.43.0 >
