patch for gcc 3.3 compile warnings, pricedb

Derek Atkins warlord at MIT.EDU
Sat Apr 12 13:12:23 CDT 2003


Herbert,

I've been looking over this patch.  One problem is that is
appears to also include your price-db patch, so I expect it
wont apply cleanly.  But I can work around that.

I also find it odd that gcc-3.3 now requires you to set a temp
variable in order to pass a pointer:

   gchar * keyptr=NULL;
   gchar * valptr=NULL;
+  gchar ** p_keyptr = &keyptr;
+  gchar ** p_valptr = &valptr;
 
   g_return_if_fail (actionid != NULL);
 
   if (!g_hash_table_lookup_extended(gnc_html_action_handlers,
                                     actionid, 
-                                    (gpointer *)&keyptr, 
-                                    (gpointer *)&valptr))
+                                    (gpointer *)p_keyptr, 
+                                    (gpointer *)p_valptr))

Are you sure this is really necessary?  What's the actual compiler
warning here?  Did you test to see what happens if you just remove the
(gpointer *) cast with the original &keyptr?

I'm not adverse to applying this patch (indeed, I'm applying it now).
I'm just wondering if this particular coding style is actually
necessary.

-derek

Herbert Thoma <tma at iis.fhg.de> writes:

> Hi,
> 
> I spreaded some "unsigned" and some casts at various places
> to get rid of new compiler warnings from gcc 3.3.
> 
>  Herbert.
> 
>         * src/backend/file/sixtp-dom-parsers.c
>         * src/backend/file/sixtp-utils.c
>         * src/backend/file/test/test-dom-converters1.c
>         * src/backend/file/test/test-string-converters.c
>         * src/business/business-ledger/gncEntryLedgerLayout.c
>         * src/business/business-ledger/gncEntryLedgerModel.c
>         * src/calculation/fin.c
>         * src/engine/GNCId.c
>         * src/engine/QueryCore.c
>         * src/engine/gnc-engine-util.c
>         * src/engine/guid.c
>         * src/engine/test/test-commodities.c
>         * src/gnome-utils/dialog-options.c
>         * src/gnome-utils/dialog-utils.c
>         * src/gnome-utils/gnc-dense-cal.c
>         * src/gnome-utils/gnc-frequency.c
>         * src/gnome-utils/gnc-html.c
>         * src/gnome/dialog-fincalc.c
>         * src/gnome/dialog-scheduledxaction.c
>         * src/gnome/dialog-sx-from-trans.c
>         * src/gnome/gnc-split-reg.h
>         * src/gnome/reconcile-list.h
>         * src/import-export/import-account-matcher.c
>         * src/network-utils/gnc-gpg.c
>         * src/register/register-core/formulacell.c
>         * src/register/register-core/pricecell.c
>         * src/register/register-gnome/combocell-gnome.c
>         * src/register/register-gnome/datecell-gnome.c
>         * src/register/register-gnome/gnucash-sheet.h:
> 	  fixes for GCC 3.3 warnings
> 	  comparison between signed and unsigned and
> 	  dereferencing type-punned pointer will break strict-aliasing rules
> 	  fixes #110320
> 	
>         * src/engine/gnc-pricedb-p.h
>         * src/engine/gnc-pricedb.c
>         * src/engine/gnc-pricedb.h:
> 	  gnc_pricedb_lookup_at_time_any_currency,
> 	  gnc_pricedb_lookup_day_any_currency and
> 	  gnc_pricedb_lookup_nearest_in_time_any_currency functions
> 
> -- 
> Herbert Thoma
> FhG-IIS A, Studio Department
> Am Weichselgarten3, 91058 Erlangen, Germany
> Phone: +49-9131-776-323
> Fax:   +49-9131-776-399
> email: tma at iis.fhg.de
> www: http://www.iis.fhg.de/
> 
> _______________________________________________
> gnucash-patches mailing list
> gnucash-patches at lists.gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-patches

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-patches mailing list