* [PATCH 2/2] epiphany: Fix build with clang
2019-05-10 20:49 [PATCH 1/2] mmc-utils: Fix build with clang Khem Raj
@ 2019-05-10 20:49 ` Khem Raj
2019-05-10 22:17 ` Adrian Bunk
2019-05-14 3:23 ` [PATCH 1/2] mmc-utils: " Khem Raj
1 sibling, 1 reply; 5+ messages in thread
From: Khem Raj @ 2019-05-10 20:49 UTC (permalink / raw)
To: openembedded-core
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
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;
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] mmc-utils: Fix build with clang
2019-05-10 20:49 [PATCH 1/2] mmc-utils: Fix build with clang Khem Raj
2019-05-10 20:49 ` [PATCH 2/2] epiphany: " Khem Raj
@ 2019-05-14 3:23 ` Khem Raj
1 sibling, 0 replies; 5+ messages in thread
From: Khem Raj @ 2019-05-14 3:23 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
ping^1
On Fri, May 10, 2019 at 4:50 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> clang has more warnings to report, lets fix them
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> ...tra-braces-when-initializing-subobje.patch | 32 +++++++++++++++++++
> meta/recipes-devtools/mmc/mmc-utils_git.bb | 1 +
> 2 files changed, 33 insertions(+)
> create mode 100644 meta/recipes-devtools/mmc/mmc-utils/0001-mmc_cmd.c-Use-extra-braces-when-initializing-subobje.patch
>
> diff --git a/meta/recipes-devtools/mmc/mmc-utils/0001-mmc_cmd.c-Use-extra-braces-when-initializing-subobje.patch b/meta/recipes-devtools/mmc/mmc-utils/0001-mmc_cmd.c-Use-extra-braces-when-initializing-subobje.patch
> new file mode 100644
> index 0000000000..12707357b2
> --- /dev/null
> +++ b/meta/recipes-devtools/mmc/mmc-utils/0001-mmc_cmd.c-Use-extra-braces-when-initializing-subobje.patch
> @@ -0,0 +1,32 @@
> +From 04fbe6ddb5f1e02efbcae3cdf5beb16757a98948 Mon Sep 17 00:00:00 2001
> +From: Khem Raj <raj.khem@gmail.com>
> +Date: Fri, 10 May 2019 12:58:01 -0700
> +Subject: [PATCH] mmc_cmd.c: Use extra braces when initializing subobjects
> +
> +clang warns with -Werror,-Wmissing-braces, as following error
> +| mmc_cmds.c:1886:36: error: suggest braces around initialization of subobject [-Werror,-W
> +missing-braces]
> +| struct rpmb_frame frame_status = {0};
> +| ^
> +| {}
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +---
> + mmc_cmds.c | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/mmc_cmds.c b/mmc_cmds.c
> +index 19a9da1..838e8c3 100644
> +--- a/mmc_cmds.c
> ++++ b/mmc_cmds.c
> +@@ -1883,7 +1883,7 @@ static int do_rpmb_op(int fd,
> + u_int16_t rpmb_type;
> + struct mmc_ioc_multi_cmd *mioc;
> + struct mmc_ioc_cmd *ioc;
> +- struct rpmb_frame frame_status = {0};
> ++ struct rpmb_frame frame_status = {{0}};
> +
> + if (!frame_in || !frame_out || !out_cnt)
> + return -EINVAL;
> diff --git a/meta/recipes-devtools/mmc/mmc-utils_git.bb b/meta/recipes-devtools/mmc/mmc-utils_git.bb
> index f3a7234670..0c401c86fa 100644
> --- a/meta/recipes-devtools/mmc/mmc-utils_git.bb
> +++ b/meta/recipes-devtools/mmc/mmc-utils_git.bb
> @@ -9,6 +9,7 @@ SRCREV = "aef913e31b659462fe6b9320d241676cba97f67b"
> PV = "0.1+git${SRCPV}"
>
> SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git;branch=${SRCBRANCH} \
> + file://0001-mmc_cmd.c-Use-extra-braces-when-initializing-subobje.patch \
> "
> UPSTREAM_CHECK_COMMITS = "1"
>
> --
> 2.21.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread