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

Reply via email to