[Bug build/34537] gdb doesn't build with --enable-targets=all on Solaris

"cvs-commit at gcc dot gnu.org via Gdb-prs" <[email protected]>
Newsgroups gmane.comp.gdb.bugs.discuss
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34537

--- Comment #1 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Marchi <[email protected]>:

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

commit 501ef1e111a0f9a5365d3906acaca946d7ba22a8
Author: Simon Marchi <[email protected]>
Date:   Tue Aug 18 16:27:29 2026 -0400

    include, opcodes: prefix REG_* macros in cris.h, nds32.h and
microblaze-opcm.h

    Bug 34537 reports:

        When building gdb with the default configure options of gdb buildbots
(which
        include --enable-targets=all), gdb fails to build:

          CXX    microblaze-tdep.o
        In file included from ../../binutils-gdb/gdb/microblaze-tdep.c:37:
        ../../binutils-gdb/gdb/../opcodes/microblaze-opcm.h:101:9: error:
âREG_PCâ redefined [-Werror]
          101 | #define REG_PC  32 /* PC.  */
              |         ^~~~~~
        In file included from /usr/include/sys/ucontext.h:14,
                         from /usr/include/sys/signal.h:197,
                         from /usr/include/sys/procset.h:17,
                         from /usr/include/sys/wait.h:22,
                         from ../gnulib/import/sys/wait.h:28,
                         from /usr/include/stdlib.h:16,
                         from /usr/gcc/16/include/c++/16.1.0/cstdlib:83,
                         from
../../binutils-gdb/gdb/../gdbsupport/common-defs.h:107,
                         from ./../../binutils-gdb/gdb/defs.h:26,
                         from <command-line>:
        /usr/include/sys/regset.h:158:9: note: this is the location of the
previous definition
          158 | #define REG_PC  REG_RIP
              |         ^~~~~~
        ../../binutils-gdb/gdb/../opcodes/microblaze-opcm.h:120:9: error:
âREG_SPâ redefined [-Werror]
          120 | #define REG_SP  1 /* stack pointer.  */
              |         ^~~~~~
        /usr/include/sys/regset.h:160:9: note: this is the location of the
previous definition
          160 | #define REG_SP  REG_RSP
              |         ^~~~~~

        There are more instances of this issue:

        gdb/../include/opcode/cris.h:34:9: error: âREG_SPâ redefined
[-Werror]
        gdb/../include/opcode/cris.h:35:9: error: âREG_PCâ redefined
[-Werror]

        gdb/../include/opcode/nds32.h:24:9: error: âREG_R0â redefined
[-Werror]
        gdb/../include/opcode/nds32.h:26:9: error: âREG_R8â redefined
[-Werror]
        gdb/../include/opcode/nds32.h:27:9: error: âREG_R10â redefined
[-Werror]
        gdb/../include/opcode/nds32.h:28:9: error: âREG_R12â redefined
[-Werror]
        gdb/../include/opcode/nds32.h:29:9: error: âREG_R15â redefined
[-Werror]
        gdb/../include/opcode/nds32.h:34:9: error: âREG_FPâ redefined
[-Werror]
        gdb/../include/opcode/nds32.h:37:9: error: âREG_SPâ redefined
[-Werror]

    Attempt to fix it by prefixing the macros with the arch name.

    I only modified the macros starting with "REG_", but there are other
    macros with very generic names (e.g. "MAX_REG") that could be renamed
    too (for consistency, IMO, all the macros in those files should be
    prefixed the same way).

    I couldn't build-test this patch on Solaris, but it build with
    --enable-targets=all on Linux.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34537
    Change-Id: I33ff448fe26be76c14a89ac698fa9f9dc17208b0

-- 
You are receiving this mail because:
You are on the CC list for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.