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

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

> On Tue, 18 Aug 2026, Simon Marchi wrote:
>
>> 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:
>
>>       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.  */
>> 	  |         ^~~~~~
>
>> Attempt to fix it by prefixing the macros with the arch name.
>
> An alternative, less intrusive method, would be to #undef those 
> macros in a suitable gdb toplevel file, maybe defs.h, after 
> including cstdlib but before including binutils/gdb files.  The 
> error is clearly on the Solaris side, for namespace intrusion 
> and pollution.

what namespace would that be?  It's clearly ok for systems to define
REG_* macros in their system headers.  It's quite common in
<sys/ucontext.h> or similar headers.  The clashes only occur if the same
definitions are present on different systems (which can only occur in
multi-target code like this --enable-targets=all configuration).  Why
would cris (or microblaze or nds32 or solaris) have more right to them
than others?

	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.