[Fwd: Re: [patch] More gcc 4.2.3 compilation fixes]

Jerry Quinn jlquinn at optonline.net
Sun Dec 30 20:21:11 EST 2007


Sorry, didn't cc the list before

-------- Original Message --------
From: - Sun Dec 30 20:01:42 2007
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00800000
X-Mozilla-Keys:
Message-ID: <47783F76.5000804 at optonline.net>
Date: Sun, 30 Dec 2007 20:01:42 -0500
From: Jerry Quinn <jlquinn at optonline.net>
User-Agent: Mozilla-Thunderbird 2.0.0.9 (X11/20071228)
MIME-Version: 1.0
To: Andreas Köhler <andi5.py at gmx.net>
Subject: Re: [patch] More gcc 4.2.3 compilation fixes
References: <4777E528.4050708 at optonline.net> 
<1199042673.5193.7.camel at ubuntu> <4777F70D.8040104 at optonline.net> 
<1199046088.5193.12.camel at ubuntu>
In-Reply-To: <1199046088.5193.12.camel at ubuntu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Andreas Köhler wrote:
> 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.

OK, here's another spin.  I also looked at changing
QOF_LOOKUP_BOOK_ENTRY to be an inline function, but that would be
GCC-specific.  I gather there's no such requirement now, right?

This uses GCC pragmas to turn off the flag in the affected files.  It's
a little less intrusive than the original I posted, and keeps the flag
on for all other files.

Jerry



Index: src/business/business-core/business-core.i
===================================================================
--- src/business/business-core/business-core.i	(revision 16769)
+++ src/business/business-core/business-core.i	(working copy)
@@ -17,6 +17,15 @@
  #include "engine-helpers.h"
  #include "gncBusGuile.h"

+/* Disable -Waddress.  GCC 4.2 warns (and fails to compile with
-Werror) when
+   passing the address of a guid on the stack to QOF_BOOK_LOOKUP_ENTITY via
+   gncInvoiceLookup and friends.  When the macro gets inlined, the compiler
+   emits a warning that the guid null pointer test is always true.
+ */
+#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 2)
+#pragma GCC diagnostic ignored "-Waddress"
+#endif
+
  SCM scm_init_sw_business_core_module (void);
  %}

Index: src/business/business-gnome/business-urls.c
===================================================================
--- src/business/business-gnome/business-urls.c	(revision 16769)
+++ src/business/business-gnome/business-urls.c	(working copy)
@@ -43,6 +43,15 @@
  #include "dialog-vendor.h"
  #include "dialog-invoice.h"

+/* Disable -Waddress because it warns (and fails to compile with
-Werror) when
+   passing the address of a stack guid to QOF_BOOK_LOOKUP_ENTITY.  When the
+   code gets inlined, the compiler sees that the null pointer test of guid
+   always succeeds and -Waddress emits a warning that the test is
always true.
+ */
+#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 2)
+#pragma GCC diagnostic ignored "-Waddress"
+#endif
+
  #define HANDLE_TYPE(URL_TYPE_STR,OBJ_TYPE) {
        \
    QofBook *book;
        \
    GUID guid;
        \
Index: src/business/business-gnome/dialog-invoice.c
===================================================================
--- src/business/business-gnome/dialog-invoice.c	(revision 16769)
+++ src/business/business-gnome/dialog-invoice.c	(working copy)
@@ -71,6 +71,15 @@
  #include "gnc-plugin-page-invoice.h"
  #include "gnc-main-window.h"

+/* Disable -Waddress.  GCC 4.2 warns (and fails to compile with
-Werror) when
+   passing the address of a guid on the stack to QOF_BOOK_LOOKUP_ENTITY via
+   gncInvoiceLookup and friends.  When the macro gets inlined, the compiler
+   emits a warning that the guid null pointer test is always true.
+ */
+#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 2)
+#pragma GCC diagnostic ignored "-Waddress"
+#endif
+
  #define DIALOG_NEW_INVOICE_CM_CLASS "dialog-new-invoice"
  #define DIALOG_VIEW_INVOICE_CM_CLASS "dialog-view-invoice"




More information about the gnucash-devel mailing list