GNOME Bugzilla – Bug 759200
Fix -Werror build for clang
Last modified: 2015-12-15 14:10:25 UTC
Epiphany uses -Wwrite-strings, which changes the type of string literals to 'const char[]'. This means any attempt to use a string literal as 'char*' causes build failure. I will attach a patch that fixes the build. I think it needs some testing and review before it can be pushed.
Created attachment 316968 [details] [review] build: Fix build with clang -Werror and -Wwrite-strings String literals are 'const char[]' when -Wwrite-strings is used.
Review of attachment 316968 [details] [review]: Thanks for fixing this. Please, address the comments before pushing. ::: embed/ephy-download.c @@ -164,3 @@ action = EPHY_DOWNLOAD_ACTION_OPEN; - - g_free (content_type); Oh my, this looks like a potentially-serious bug. Please, commit this in a separate patch, and to gnome-3-18 as well. ::: embed/ephy-embed-prefs.c @@ +428,3 @@ /* Sync with Epiphany values */ webkit_pref_callback_font_size (ephy_settings, EPHY_PREFS_WEB_SERIF_FONT, + (void*)"default-font-size"); Use gpointer for these. Please fix everywhere. ::: embed/web-extension/ephy-uri-tester.c @@ +443,3 @@ ephy_uri_tester_compile_regexp (EphyUriTester *tester, GString *gpatt, + const char*opts, Add spaces, please; there should be at least one blank space. I only mention this once, but please fix everywhere. @@ +520,3 @@ g_free (patt); if (data[1]) + g_free ((char*)opts); (char *)opts. Please fix everywhere. ::: lib/ephy-profile-utils.c @@ +129,3 @@ argv[0] = ABS_TOP_BUILD_DIR"/lib/"EPHY_PROFILE_MIGRATOR; + ret = g_spawn_sync (NULL, (char**)argv, envp, G_SPAWN_SEARCH_PATH, (char **) ::: src/bookmarks/ephy-bookmark-properties.c @@ -40,3 @@ #include <string.h> -static const GtkTargetEntry dest_drag_types[] = { Go ahead and commit this separately too, please.
Fix for decide_action_from_mime was pushed to master as commit 1387537 and pushed to gnome-3-18 as commit 3d1a0d0. Removal of dest_drag_types was pushed to master as commit 4342778. Other modifications were pushed to master as commit 7c7d30f.
Aahhh, I see now, so get_content_type in 3.18 returns a string that needs to be freed, but in master it should not be freed. So I was wrong to suggest a backport, and have reverted your commit on the gnome-3-18 branch, but not on master. This seems good otherwise. Thanks!
Created attachment 317391 [details] [review] build: Fix build with clang -Werror and -Wwrite-strings Current master branch still doesn't build with -Werror because new commits cause a new error. This patch should fix it.
Review of attachment 317391 [details] [review]: Thanks. Wish GCC had this warning.... By the way, if you are using an automated build system, I recommend passing --disable-Werror to every configure script, like jhbuild does.
Attachment 317391 [details] pushed as 06152d5 - build: Fix build with clang -Werror and -Wwrite-strings