Fix compile with gcc 4.2.3

Jerry Quinn jlquinn at
Sun Dec 30 12:29:04 EST 2007

Hi, all.  I just tried to compile gnucash svn today on my debian testing 
amd64 box.  It fails with the following compiler warning:

  gcc -DHAVE_CONFIG_H -I. -I../.. -DG_LOG_DOMAIN=\"gnc.engine\" 
-I../../lib/libc -I../../src/core-utils -I../../src -I../../src 
-I../../src/gnc-module -I../../lib/libqof/qof -I../../lib/libqof/qof 
-pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Werror 
-Wdeclaration-after-statement -Wno-pointer-sign -D_FORTIFY_SOURCE=2 -g 
-O2 -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations 
-Wno-unused -MT engine-helpers.lo -MD -MP -MF .deps/engine-helpers.Tpo 
-c engine-helpers.c  -fPIC -DPIC -o .libs/engine-helpers.o
cc1: warnings being treated as errors
engine-helpers.c: In function 'gnc_generic_to_scm':
engine-helpers.c:2162: warning: passing argument 1 of 
'SWIG_Guile_NewPointerObj' discards qualifiers from pointer target type
make[5]: *** [engine-helpers.lo] Error 1

This fixes the build for me:

Index: engine-helpers.c
--- engine-helpers.c	(revision 16769)
+++ engine-helpers.c	(working copy)
@@ -2146,9 +2146,10 @@

  static SCM
-gnc_generic_to_scm(const void *x, const gchar *type_str)
+gnc_generic_to_scm(const void *cx, const gchar *type_str)
      swig_type_info * stype = NULL;
+    void *x = (void*)cx;

      if (!x) return SCM_BOOL_F;
      stype = SWIG_TypeQuery(type_str);
@@ -2158,7 +2159,7 @@
          return SCM_BOOL_F;

-    return SWIG_NewPointerObj(x, stype, 0);
+    return SWIG_NewPointerObj(cx, stype, 0);

  static void *

Jerry Quinn

More information about the gnucash-devel mailing list