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. > 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. -- Keith M Wesolowski "Sir, we're surrounded!" FishWorks "Excellent; we can attack in any direction!" _______________________________________________ tools-discuss mailing list tools-discuss@opensolaris.org