Hi,

Am Sonntag, den 30.12.2007, 14:52 -0500 schrieb Jerry Quinn:
> Andreas Köhler wrote:
> > Hi Jerry,
> > 
> >> This patch squelches the warnings but I can't help feeling like there 
> >> should be a cleaner way of solving the problem.
> > 
> > An alternative would be to disable this type of warning completely, like
> > in the attached patch.  Does it work for you?
> 
> That would work, but my thought was that in general it's better to keep 
> as many warnings enabled as possible.  I was reluctant to turn the 
> warning off, since it could catch important problems.
> 
> I suppose one option would be to disable the warning only for the 
> affected files.  I'm not sure how much makefile gymnastics are required 
> to achieve that, though.  I'm not automake-savvy.

The attached patch disables the warning for all source files in
src/business/business-core.  For even finer granularity one would have
to do one of

http://www.gnu.org/software/automake/manual/automake.html#Per_002dObject-Flags

I am not sure that is necessary.  But maybe there is a better answer out
there.

-- andi5

Index: src/business/business-core/Makefile.am
===================================================================
--- src/business/business-core/Makefile.am	(Revision 16771)
+++ src/business/business-core/Makefile.am	(Arbeitskopie)
@@ -67,6 +67,14 @@
 
 # business-core-helpers.c
 
+if HAVE_GCC_4_2
+  # For gcc >= 4.2.x, specifically disable warnings about suspicious uses of
+  # memory addresses.  Otherwise &g must not be passed to
+  # QOF_BOOK_LOOKUP_ENTITY which tests it against NULL.
+  # Use CFLAGS to make it appear after -Wall
+  CFLAGS += -Wno-address
+endif
+
 if BUILDING_FROM_SVN
 swig-business-core.c: business-core.i ${noinst_HEADERS} \
                       ${top_srcdir}/src/base-typemaps.i
Index: configure.in
===================================================================
--- configure.in	(Revision 16771)
+++ configure.in	(Arbeitskopie)
@@ -1388,11 +1388,18 @@
      fi
   fi
 
+  if test "`echo ${GCC_VERSION} | cut -d. -f1`" -ge 4; then
+    if test "`echo ${GCC_VERSION} | cut -d. -f2`" -ge 2; then
+      HAVE_GCC_4_2=yes
+    fi
+  fi
+
   CFLAGS="${warnFLAGS} ${CFLAGS}"
 
 else
   warnFLAGS=none
 fi
+AM_CONDITIONAL(HAVE_GCC_4_2, test "x$HAVE_GCC_4_2" = "xyes")
 AC_MSG_RESULT($warnFLAGS)
 
 # Adjust CFLAGS and LDFLAGS on Windows
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to