After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753435 - Fix -Werror build for clang
Fix -Werror build for clang
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
git master
Other FreeBSD
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-10 07:26 UTC by Ting-Wei Lan
Modified: 2015-08-10 07:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Fix cast align warning for clang (805 bytes, patch)
2015-08-10 07:28 UTC, Ting-Wei Lan
none Details | Review
build: Fix cast align warning for clang (796 bytes, patch)
2015-08-10 07:48 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2015-08-10 07:26:58 UTC
This error showed when compiling gtksourceview with clang:

gtksourceview.c:4461:10: error: cast from 'const guchar *' (aka 'const unsigned char *') to 'guint16 *' (aka 'unsigned short *') increases required alignment
      from 1 to 2 [-Werror,-Wcast-align]
                vals = (guint16 *) gtk_selection_data_get_data (selection_data);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Comment 1 Ting-Wei Lan 2015-08-10 07:28:45 UTC
Created attachment 308998 [details] [review]
build: Fix cast align warning for clang
Comment 2 Ignacio Casal Quinteiro (nacho) 2015-08-10 07:35:30 UTC
Review of attachment 308998 [details] [review]:

See the comment.

::: gtksourceview/gtksourceview.c
@@ +4459,3 @@
 		}
 
+		vals = (guint16 *)(void *) gtk_selection_data_get_data (selection_data);

you could just do (gpointer) gtk_selection_data_get_data (selection_data);?
Comment 3 Ting-Wei Lan 2015-08-10 07:48:39 UTC
Created attachment 309000 [details] [review]
build: Fix cast align warning for clang
Comment 4 Ignacio Casal Quinteiro (nacho) 2015-08-10 07:50:02 UTC
Review of attachment 309000 [details] [review]:

Looks good.
Comment 5 Ting-Wei Lan 2015-08-10 07:54:17 UTC
Attachment 309000 [details] pushed as 4343423 - build: Fix cast align warning for clang