Subject: Namespace issues and lint
To: None <tech-toolchain@NetBSD.org>
From: Martin Husemann <martin@duskware.de>
List: tech-toolchain
Date: 06/10/2004 20:30:17
Not sure if this is the best mailing list for this toppic, but I couldn't
find a better one - so here it goes:

on sparc64 the <machine/reg.h> header does play dirty, name space polluting
tricks to be usable for both 32bit and 64bit builds - and to be able
to build a gdb that supports both.

The namespace pollution lead to a hickup after Nathans recent changes
to libpthread_dbg; rev 1.23 of src/lib/libpthread_dbg/pthread_dbg.c
"fixed" them by reordering includes (so the define reg reg64 is in effect
earlier).

While the C compiler was happy to compile the code, lint complained about
"illegal member use: r_tstate (102)" (and various other members of struct
reg64) in the PTHREAD_REG_TO_UCONTEXT() macro - which is defined in
src/lib/libpthread/arch/sparc64/pthread_md.h by using the name "reg" for the
second arg.

I hear loud mumbling at this point in the audience - you see what's going
on probably...

Now.. - we have two problems here: the namespace pollution by the reg -> reg64
defines may be considered a latent problem - and lint seems to do macro
expansion wrong. Or am I misunderstanding something here?

Martin