[lxc-devel] [lxcfs/master] configure: add -Wvla and -std=gnu11
brauner on Github
lxc-bot at linuxcontainers.org
Wed Mar 11 02:16:58 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 536 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200310/92afc70a/attachment.bin>
-------------- next part --------------
From 28572e1057df67d08073d8dfdde8f18d526b7344 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 11 Mar 2020 03:10:09 +0100
Subject: [PATCH] configure: add -Wvla and -std=gnu11
Both are standard in LXC for a long time now. And gcc-4.8 which is the
minimal compiler version we require (same as the Linux kernel) deals
with this.
Closes #3287.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
configure.ac | 2 +-
src/proc_cpuview.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 21ae513..4092883 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,8 +248,8 @@ AX_CHECK_COMPILE_FLAG([-Wnested-externs], [CFLAGS="$CFLAGS -Wnested-externs"],,[
AX_CHECK_COMPILE_FLAG([-fasynchronous-unwind-tables], [CFLAGS="$CFLAGS -fasynchronous-unwind-tables"],,[-Werror])
AX_CHECK_COMPILE_FLAG([-pipe], [CFLAGS="$CFLAGS -pipe"],,[-Werror])
AX_CHECK_COMPILE_FLAG([-fexceptions], [CFLAGS="$CFLAGS -fexceptions"],,[-Werror])
-CFLAGS="$CFLAGS -fvisibility=hidden"
+CFLAGS="$CFLAGS -fvisibility=hidden -Wvla -std=gnu11"
AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"],,[])
AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"],,[])
diff --git a/src/proc_cpuview.c b/src/proc_cpuview.c
index 4d8ead5..15a7b5c 100644
--- a/src/proc_cpuview.c
+++ b/src/proc_cpuview.c
@@ -433,7 +433,7 @@ static bool read_cpu_cfs_param(const char *cg, const char *param, int64_t *value
if (!cgroup_ops->get(cgroup_ops, "cpu", cg, file, &str))
return false;
- if (sscanf(str, first ? "%"PRId64 : "%*"PRId64" %"PRId64, value) != 1)
+ if (sscanf(str, first ? "%" PRId64 : "%*" PRId64 " %" PRId64, value) != 1)
return false;
return true;
More information about the lxc-devel
mailing list