GCC4 warning fixes part4

Zoltan Boszormenyi <[email protected]> Sun, 03 Jul 2005 23:49:15 +0200
Newsgroups gmane.text.rlib.user
Message-ID <[email protected]>
Hi,

here's the next part. Changelog:

***********************************************************
Silence warnings in datasource.c. The original code gave these
kinds of warnings on GCC4:
warning: ISO C forbids conversion of function pointer to object pointer type
warning: ISO C forbids initialization between function pointer and 'void *'
warning: ISO C forbids assignment between function pointer and 'void *'
The above warnings sound serious but on the other hand, explicitly
casting the address of a function pointer to a (gpointer *) gave this
warning on older GCCs:
warning: dereferencing type-punned pointer will break strict-aliasing rules
Aliasing function pointers to gpointer using unions solves this, using
   union {
     gpointer ptr;
     void (*function)(void);
   }
allows the assignment to the gpointer and calling function() without
warnings.
***********************************************************

Best regards,
Zoltán Böszörményi
01-rlib-1.3.4-datasource.patch.bz2 (application/x-bzip2, 1.1 KB) - not displayed