[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201126100012.hy6fhores67tnekv@wittgenstein>
Date: Thu, 26 Nov 2020 11:00:12 +0100
From: Christian Brauner <christian.brauner@...ntu.com>
To: Xingxing Su <suxingxing@...ngson.cn>
Cc: Christian Brauner <christian@...uner.io>,
Shuah Khan <shuah@...nel.org>, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH] selftests/clone3: Add gun99 to compile in Makefile.
On Thu, Nov 26, 2020 at 03:12:14PM +0800, Xingxing Su wrote:
> CFLAGS add -std=gnu99.
>
> Fllowing build error:
>
> test_core.c: In function ‘test_cgcore_destroy’:
> test_core.c:87:2: error: ‘for’ loop initial declarations are only
> allowed in C99 mode
> for (int i = 0; i < 10; i++) {
> ^
> test_core.c:87:2: note: use option -std=c99 or -std=gnu99 to compile
> your code
>
> Signed-off-by: Xingxing Su <suxingxing@...ngson.cn>
> ---
Acked-by: Christian Brauner <christian.brauner@...ntu.com>
Seems alright to me and apparently some selftests already set. Though
another option would be to just move the declaration. But I don't think
it matters that much here.
I'd change the commit message slightly though:
[PATCH] selftests/clone3: Fix build error
When compiling the selftests with the -std=gnu99 option the build can
fail with
Fllowing build error:
test_core.c: In function ‘test_cgcore_destroy’:
test_core.c:87:2: error: ‘for’ loop initial declarations are only
allowed in C99 mode
for (int i = 0; i < 10; i++) {
^
test_core.c:87:2: note: use option -std=c99 or -std=gnu99 to compile
Add -std=gnu99 to the clone3 selftest Makefile to fix this.
> tools/testing/selftests/clone3/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/clone3/Makefile b/tools/testing/selftests/clone3/Makefile
> index ef7564c..88354a8 100644
> --- a/tools/testing/selftests/clone3/Makefile
> +++ b/tools/testing/selftests/clone3/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -CFLAGS += -g -I../../../../usr/include/
> +CFLAGS += -g -std=gnu99 -I../../../../usr/include/
> LDLIBS += -lcap
>
> TEST_GEN_PROGS := clone3 clone3_clear_sighand clone3_set_tid \
> --
> 1.8.3.1
>
Powered by blists - more mailing lists