Keith M Wesolowski wrote:
> On Thu, Aug 31, 2006 at 12:22:16AM +0200, Roland Mainz wrote:
> > 1. Does anyone know the gcc switch to turn off warnings for redefined
> > CPP symbols, e.g. things like:
> > -- snip --
> > src/lib/libmonster/monster_map.h:104:1: "strrcat" redefined
> > ../common/core/strrcat.c:27:1: this is the location of the previous
> > definition
> > -- snip --
> 
> You can't; this is not a warning but an error.  The code is
> syntactically incorrect as you are defining the same macro to two
> different values.  Fix the code.

Well, then
http://cvs.opensolaris.org/source/xref/on/usr/src/uts/intel/sys/regset.h#100
is broken. The two-letter defines there causes lots of breakage and IMO
a violation of things which I would call "namespace clean" and portable
code (e.g. the book "Schnupp, Peter; Von C zu C, Problemlos Portieren,  
Carl Hanser Verlag, München-Wien 1990" lists such examples as serious
problems for system headers).

> > 2. What is the gcc flag to turn warnings for "cast to pointer from
> > integer of different size" off ?
> > Example:
> > -- snip --
> > common/gridalloc/vmdebug.c
> > ../common/gridalloc/griddebug.c: In function `dbwarn':
> > ../common/gridalloc/griddebug.c:162: warning: cast to pointer from
> > integer of different size
> > -- snip --
> 
> We added -Wno-pointer-to-int-cast and -Wno-int-to-pointer-cast for
> this reason; they work only in C, not C++.  However, the code is
> technically incorrect and is likely to be miscompiled in this case
> (sign-extension may or may not be performed).  In general, if you want
> to cast an integer to a pointer, you need to case it to uintptr_t
> first.  Please don't use this flag unless you're absolutely sure you
> know what you're doing.  See the second item at
> http://www.opensolaris.org/os/community/tools/gcc/bug_fixing_notes/
> for some sample code and output that will convince you, if you're at
> all sane, to fix the code rather than using the flag.  An interesting
> piece of work would be to make gcc never perform sign extension with
> pointers, a change which would allow things to work as expected on the
> ISAs we care about without double casts.  If someone were to do that
> work, it would then be safe to squelch the warnings.

Thanks for the explanation... :-)

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [EMAIL PROTECTED]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
_______________________________________________
tools-discuss mailing list
tools-discuss@opensolaris.org

Reply via email to