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

Rainer Orth <[email protected]>
Newsgroups gmane.comp.gdb.patches,gmane.comp.gnu.binutils
Message-ID <[email protected]>
Hi Simon,

> 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
> 	  |         ^~~~~~
[...]
> 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).

Thanks for doing this: I wasn't sure how best to address this.

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

I'll give it a whirl tomorrow.  Just in case, there are Solaris 11.4
systems in the cfarm for some time now (cfarm216 for sparc and cfarm215
for x86).

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
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.