for these edge warnings gcc should do a little more work to determine
if the warnings come from macro/inline paradigms
all of the "thousand" warnings come from
SFSETLOCALE(&decimal,&thousand);
the SFSETLOCALE() function allows for
SFSETLOCALE(&decimal,0);
and it complains about the macro body test for &thousand vs 0
in this case it turns out that SFSETLOCALE() is ast private and all usage
provides &thousand and not 0, so the warning can be eliminated
On Mon, 9 Apr 2012 18:24:09 +0200 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= wrote:
> David, Glenn, could you look at the following warnings gcc4.6 gave me
> when I compiled ast-open.2012-02-29 with -Waddress?
> The gcc man page defines -Waddress as
> -Waddress
> Warn about suspicious uses of memory addresses. These
> include using the address of a function in a conditional expression,
> such as "void func(void); if
> (func)", and comparisons against the memory address of a
> string literal, such as "if (x == "abc")". Such uses typically
> indicate a programmer error:
> the address of a function always evaluates to true, so
> their use in a conditional usually indicate that the programmer forgot
> the parentheses in a
> function call; and comparisons against string literals
> result in unspecified behavior and are not portable in C, so they
> usually indicate that the
> programmer intended to use "strcmp".
> As the gcc people pointed out the warnings are in the worst case
> programming errors and in the best case consume extra code space.
> ====================================
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfstrtof.h:224:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfstrtof.h:224:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfstrtof.h:224:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfstrtof.h:224:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/string/strtoi.h:335:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/comp/strptime.c:69:13:
> warning: the address of 't' will always evaluate as 'true' [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfstrtod.c:82:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sftable.c:169:4:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfvprintf.c:328:4:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfvprintf.c:333:4:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfvprintf.c:1252:4:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfvprintf.c:1294:4:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfstrtof.h:224:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> /home/fleyta/build_waddress/src/lib/libast/sfio/sfvscanf.c:373:2:
> warning: the address of 'thousand' will always evaluate as 'true'
> [-Waddress]
> ====================================
> Olga
> --
> , _ _ ,
> { \/`o;====- Olga Kryzhanovska -====;o`\/ }
> .----'-/`-/ [email protected] \-`\-'----.
> `'-..-| / http://twitter.com/fleyta \ |-..-'`
> /\/\ Solaris/BSD//C/C++ programmer /\/\
> `--` `--`
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers