Hi Jerry, Am Sonntag, den 30.12.2007, 13:36 -0500 schrieb Jerry Quinn: > After the last fix, I ran into another set of cases of gcc being too > smart for its own good. In this case, we're calling the macro > QOF_BOOK_LOOKUP_ENTITY, which checks its args for null pointers. > However, several indirect callers such as gncInvoiceLookupFlip() and its > siblings are passing the address of a stack variable, which can't be > null. GCC then helpfully warns that this check will always be true, > then killing the compile. > > To fix it, I created an alternate QOF_BOOK_LOOKUP_ENTITY_NC that leaves > arg checking to the caller and propagated that up to the places that > died because of the always true warnings. > > This patch squelches the warnings but I can't help feeling like there > should be a cleaner way of solving the problem. > > Opinions welcome, > Jerry Quinn
---8<--o-->8--- An alternative would be to disable this type of warning completely, like in the attached patch. Does it work for you? -- andi5
Index: configure.in =================================================================== --- configure.in (Revision 16770) +++ configure.in (Arbeitskopie) @@ -1388,6 +1388,15 @@ fi fi + # For gcc >= 4.2.x, specifically disable warnings about suspicious uses of + # memory addresses. Otherwise variable addresses must not be passed to macros + # that test them against NULL. + if test "`echo ${GCC_VERSION} | cut -d. -f1`" -ge 4; then + if test "`echo ${GCC_VERSION} | cut -d. -f2`" -ge 2; then + CFLAGS="${CFLAGS} -Wno-address" + fi + fi + CFLAGS="${warnFLAGS} ${CFLAGS}" else
_______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel