GNOME Bugzilla – Bug 347262
Warnings when compiling gnome-games
Last modified: 2006-09-29 17:23:45 UTC
The following warnings are shown when compiling gnome-games 2.15.4: games-files.c: In function 'games_file_list_find': games-files.c:347: warning: assignment from incompatible pointer type games-preimage.c: In function 'games_preimage_new_from_file': games-preimage.c:189: warning: dereferencing type-punned pointer will break strict-aliasing rules sol.c: In function ‘game_file_to_name’: sol.c:102: warning: value computed is not used
Created attachment 70845 [details] Freecell maximized 2.14
Created attachment 70846 [details] Freecell maximized 2.15
Comment on attachment 70845 [details] Freecell maximized 2.14 sorry, this image is for bug 341253
Comment on attachment 70846 [details] Freecell maximized 2.15 sorry, this image is for bug 341253
Created attachment 73390 [details] [review] Patch to fix warnings in Bug 347262
Comment on attachment 73390 [details] [review] Patch to fix warnings in Bug 347262 Hi all, I downloaded last version from CVS and found this warnings: games-files.c: In function 'games_file_list_find': games-files.c:347: warning: assignment from incompatible pointer type games-preimage.c: In function 'games_preimage_new_from_file': games-preimage.c:189: warning: dereferencing type-punned pointer will break strict-aliasing rules games-scores-backend.c: In function 'games_scores_backend_set_scores': games-scores-backend.c:271: warning: format '%lld' expects type 'long long int', but argument 3 has type 'guint64' So here comes the patch to fix this warnings.
Created attachment 73404 [details] [review] patch to fix the warnings This patch fixes all the warnings reported. ChangeLog entries included. I think the other patch here is incorrect. It says: (gchar **)(preimage->srcbuffer) but my understanding of the API is that a gchar** is needed since this is a result argument. The GCC warning here occurs because it is not valid to cast from guchar** to gchar**; that is an aliasing violation (AIUI). The fix, which IMO is fairly ugly, is to add an intermediate cast to char*.
I have tested and applied the patch from Tom Tromey to CVS and the 2.16 branch. Thanks!