GNOME Bugzilla – Bug 760178
Fix -Werror build for clang
Last modified: 2016-02-15 20:25:34 UTC
I know --disable-Werror, but I think these warnings are easy to fix. The attached patch fixes warnings showed by clang: gweather-timezone.c:61:27: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] parse_tzdata (const char *tzname, time_t start, time_t end, ^ /usr/include/time.h:140:14: note: previous declaration is here extern char *tzname[]; ^ gweather-timezone.c:87:33: error: cast from 'char *' to 'guint32 *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align] timecnt = GUINT32_FROM_BE (*(guint32 *)(contents + TZ_TIMECNT_OFFSET)); ^ /home/lantw44/gnome/devinstall/include/glib-2.0/glib/gtypes.h:352:46: note: expanded from macro 'GUINT32_FROM_BE' #define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val)) ^ /home/lantw44/gnome/devinstall/lib/glib-2.0/include/glibconfig.h:156:49: note: expanded from macro 'GUINT32_TO_BE' #define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val)) ^ /home/lantw44/gnome/devinstall/include/glib-2.0/glib/gtypes.h:313:67: note: expanded from macro 'GUINT32_SWAP_LE_BE' # define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val)) ^ /home/lantw44/gnome/devinstall/include/glib-2.0/glib/gtypes.h:292:37: note: expanded from macro 'GUINT32_SWAP_LE_BE_X86_64' ({ guint32 __v, __x = ((guint32) (val)); \ ^ gweather-timezone.c:115:23: error: cast from 'char *' to 'gint32 *' (aka 'int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align] initial_offset = *(gint32 *)(ttinfos + ^~~~~~~~~~~~~~~~~~~~ gweather-timezone.c:124:19: error: cast from 'char *' to 'gint32 *' (aka 'int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align] second_offset = *(gint32 *)(ttinfos + ^~~~~~~~~~~~~~~~~~~~ 4 errors generated.
Created attachment 318286 [details] [review] build: Fix -Werror build for clang The argument tzname is renamed to tz_name to prevent confusion with the global variable.
Thanks for the patch, I applied it and it will be in the next release.