[2/2] epiphany: Fix build with clang

Message ID 20190510204954.33591-2-raj.khem@gmail.com
State New
Headers show
Series
  • [1/2] mmc-utils: Fix build with clang
Related show

Commit Message

Khem Raj May 10, 2019, 8:49 p.m.
This patch is upstreamable, issue is not caught by gcc

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 .../epiphany/epiphany_3.32.1.2.bb             |  1 +
 ...itialization-of-variable-with-__attr.patch | 54 +++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 meta/recipes-gnome/epiphany/files/0001-Do-not-bypass-initialization-of-variable-with-__attr.patch

-- 
2.21.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Adrian Bunk May 10, 2019, 10:17 p.m. | #1
On Fri, May 10, 2019 at 01:49:54PM -0700, Khem Raj wrote:
> This patch is upstreamable, issue is not caught by gcc

>...


Upstream already has a different fix for this:
https://gitlab.gnome.org/GNOME/epiphany/commit/a6a022c9c498ad5dcf7f2220644a7520df74ca31

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Khem Raj May 10, 2019, 10:20 p.m. | #2
On 5/10/19 3:17 PM, Adrian Bunk wrote:
> On Fri, May 10, 2019 at 01:49:54PM -0700, Khem Raj wrote:

>> This patch is upstreamable, issue is not caught by gcc

>> ...

> 

> Upstream already has a different fix for this:

> https://gitlab.gnome.org/GNOME/epiphany/commit/a6a022c9c498ad5dcf7f2220644a7520df74ca31


ah thanks, I did not find it when I checked last time. but I guess I 
will try a backport and send v2

> 

> cu

> Adrian

> 

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/recipes-gnome/epiphany/epiphany_3.32.1.2.bb b/meta/recipes-gnome/epiphany/epiphany_3.32.1.2.bb
index ba2e851bb6..fc26a878d6 100644
--- a/meta/recipes-gnome/epiphany/epiphany_3.32.1.2.bb
+++ b/meta/recipes-gnome/epiphany/epiphany_3.32.1.2.bb
@@ -12,6 +12,7 @@  REQUIRED_DISTRO_FEATURES = "x11 opengl"
 
 SRC_URI = "${GNOME_MIRROR}/${GNOMEBN}/${@gnome_verdir("${PV}")}/${GNOMEBN}-${PV}.tar.${GNOME_COMPRESS_TYPE};name=archive \
            file://0002-help-meson.build-disable-the-use-of-yelp.patch \
+           file://0001-Do-not-bypass-initialization-of-variable-with-__attr.patch \
            "
 SRC_URI[archive.md5sum] = "93faec353e9f62519859e6164350fd5d"
 SRC_URI[archive.sha256sum] = "a8284fb9bbc8b7914a154a8eac1598c8b59ae421e0d685146fb48198427926be"
diff --git a/meta/recipes-gnome/epiphany/files/0001-Do-not-bypass-initialization-of-variable-with-__attr.patch b/meta/recipes-gnome/epiphany/files/0001-Do-not-bypass-initialization-of-variable-with-__attr.patch
new file mode 100644
index 0000000000..35821e3c06
--- /dev/null
+++ b/meta/recipes-gnome/epiphany/files/0001-Do-not-bypass-initialization-of-variable-with-__attr.patch
@@ -0,0 +1,54 @@ 
+From 1c35833385f5a193513888ba40791ceaa64d575b Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 10 May 2019 13:41:52 -0700
+Subject: [PATCH] Do not bypass initialization of variable with
+ __attribute__((cleanup))
+
+This is reported with clang e.g.
+../../../../../../../workspace/sources/epiphany/lib/ephy-web-app-utils.c:391:5: error: cannot jump from this goto statement to its label
+    goto out;
+    ^
+../../../../../../../workspace/sources/epiphany/lib/ephy-web-app-utils.c:398:20: note: jump bypasses initialization of variable with __attribute__((cleanup))
+  g_autofree char *app_file = g_build_filename (profile_dir, ".app", NULL);
+                   ^
+../../../../../../../workspace/sources/epiphany/lib/ephy-web-app-utils.c:385:5: error: cannot jump from this goto statement to its label
+    goto out;
+    ^
+../../../../../../../workspace/sources/epiphany/lib/ephy-web-app-utils.c:398:20: note: jump bypasses initialization of variable with __attribute__((cleanup))                                                                                                                     g_autofree char *app_file = g_build_filename (profile_dir, ".app", NULL);
+                   ^
+
+Ensure that the initialization is deterministic for goto to work
+reliably
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/ephy-web-app-utils.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
+index 97f3f24..fb1f732 100644
+--- a/lib/ephy-web-app-utils.c
++++ b/lib/ephy-web-app-utils.c
+@@ -376,7 +376,8 @@ ephy_web_application_create (const char *id,
+ {
+   char *profile_dir;
+   char *desktop_file_path = NULL;
+-
++  g_autofree char *app_file = NULL;
++  int fd;
+   /* If there's already a WebApp profile for the contents of this
+    * view, do nothing. */
+   profile_dir = ephy_web_application_get_profile_directory (id);
+@@ -395,8 +396,8 @@ ephy_web_application_create (const char *id,
+   ephy_profile_utils_set_migration_version_for_profile_dir (EPHY_PROFILE_MIGRATION_VERSION, profile_dir);
+ 
+   /* Create an .app file. */
+-  g_autofree char *app_file = g_build_filename (profile_dir, ".app", NULL);
+-  int fd = g_open (app_file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
++  app_file = g_build_filename (profile_dir, ".app", NULL);
++  fd = g_open (app_file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+   if (fd < 0) {
+     LOG ("Failed to create .app file: %s", g_strerror (errno));
+     goto out;