diff mbox series

[v2] selftests: pidfd: Fix compling warnings

Message ID 1662002254-7-1-git-send-email-lizhijian@fujitsu.com (mailing list archive)
State Accepted
Headers show
Series [v2] selftests: pidfd: Fix compling warnings | expand

Commit Message

Zhijian Li (Fujitsu) Sept. 1, 2022, 3:17 a.m. UTC
Fix warnings and enable Wall.

pidfd_wait.c: In function ‘wait_nonblock’:
pidfd_wait.c:150:13: warning: unused variable ‘status’ [-Wunused-variable]
  150 |  int pidfd, status = 0;
      |             ^~~~~~
...
pidfd_test.c: In function ‘child_poll_exec_test’:
pidfd_test.c:438:1: warning: no return statement in function returning non-void [-Wreturn-type]
  438 | }
      | ^

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
v2: fix mistake assignment to pidfd
---
 tools/testing/selftests/pidfd/Makefile     | 2 +-
 tools/testing/selftests/pidfd/pidfd_test.c | 2 ++
 tools/testing/selftests/pidfd/pidfd_wait.c | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

Comments

Zhijian Li (Fujitsu) Sept. 29, 2022, 12:55 a.m. UTC | #1
ping

On 01/09/2022 11:17, Li Zhijian wrote:
> Fix warnings and enable Wall.
>
> pidfd_wait.c: In function ‘wait_nonblock’:
> pidfd_wait.c:150:13: warning: unused variable ‘status’ [-Wunused-variable]
>    150 |  int pidfd, status = 0;
>        |             ^~~~~~
> ...
> pidfd_test.c: In function ‘child_poll_exec_test’:
> pidfd_test.c:438:1: warning: no return statement in function returning non-void [-Wreturn-type]
>    438 | }
>        | ^
>
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
> v2: fix mistake assignment to pidfd
> ---
>   tools/testing/selftests/pidfd/Makefile     | 2 +-
>   tools/testing/selftests/pidfd/pidfd_test.c | 2 ++
>   tools/testing/selftests/pidfd/pidfd_wait.c | 2 +-
>   3 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/pidfd/Makefile b/tools/testing/selftests/pidfd/Makefile
> index f4a2f28f926b..778b6cdc8aed 100644
> --- a/tools/testing/selftests/pidfd/Makefile
> +++ b/tools/testing/selftests/pidfd/Makefile
> @@ -1,5 +1,5 @@
>   # SPDX-License-Identifier: GPL-2.0-only
> -CFLAGS += -g -I../../../../usr/include/ -pthread
> +CFLAGS += -g -I../../../../usr/include/ -pthread -Wall
>   
>   TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \
>   	pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test
> diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c
> index 9a2d64901d59..d36654265b7a 100644
> --- a/tools/testing/selftests/pidfd/pidfd_test.c
> +++ b/tools/testing/selftests/pidfd/pidfd_test.c
> @@ -435,6 +435,8 @@ static int child_poll_exec_test(void *args)
>   	 */
>   	while (1)
>   		sleep(1);
> +
> +	return 0;
>   }
>   
>   static void test_pidfd_poll_exec(int use_waitpid)
> diff --git a/tools/testing/selftests/pidfd/pidfd_wait.c b/tools/testing/selftests/pidfd/pidfd_wait.c
> index c3e2a3041f55..0dcb8365ddc3 100644
> --- a/tools/testing/selftests/pidfd/pidfd_wait.c
> +++ b/tools/testing/selftests/pidfd/pidfd_wait.c
> @@ -148,7 +148,7 @@ static int sys_waitid(int which, pid_t pid, siginfo_t *info, int options,
>   
>   TEST(wait_nonblock)
>   {
> -	int pidfd, status = 0;
> +	int pidfd;
>   	unsigned int flags = 0;
>   	pid_t parent_tid = -1;
>   	struct clone_args args = {
Zhijian Li (Fujitsu) Oct. 30, 2022, 8:08 a.m. UTC | #2
ping again



On 29/09/2022 08:55, Li Zhijian wrote:
> ping
>
> On 01/09/2022 11:17, Li Zhijian wrote:
>> Fix warnings and enable Wall.
>>
>> pidfd_wait.c: In function ‘wait_nonblock’:
>> pidfd_wait.c:150:13: warning: unused variable ‘status’ [-Wunused-variable]
>>    150 |  int pidfd, status = 0;
>>        |             ^~~~~~
>> ...
>> pidfd_test.c: In function ‘child_poll_exec_test’:
>> pidfd_test.c:438:1: warning: no return statement in function returning non-void [-Wreturn-type]
>>    438 | }
>>        | ^
>>
>> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
>> v2: fix mistake assignment to pidfd
>> ---
>>   tools/testing/selftests/pidfd/Makefile     | 2 +-
>>   tools/testing/selftests/pidfd/pidfd_test.c | 2 ++
>>   tools/testing/selftests/pidfd/pidfd_wait.c | 2 +-
>>   3 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/testing/selftests/pidfd/Makefile b/tools/testing/selftests/pidfd/Makefile
>> index f4a2f28f926b..778b6cdc8aed 100644
>> --- a/tools/testing/selftests/pidfd/Makefile
>> +++ b/tools/testing/selftests/pidfd/Makefile
>> @@ -1,5 +1,5 @@
>>   # SPDX-License-Identifier: GPL-2.0-only
>> -CFLAGS += -g -I../../../../usr/include/ -pthread
>> +CFLAGS += -g -I../../../../usr/include/ -pthread -Wall
>>     TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \
>>       pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test
>> diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c
>> index 9a2d64901d59..d36654265b7a 100644
>> --- a/tools/testing/selftests/pidfd/pidfd_test.c
>> +++ b/tools/testing/selftests/pidfd/pidfd_test.c
>> @@ -435,6 +435,8 @@ static int child_poll_exec_test(void *args)
>>        */
>>       while (1)
>>           sleep(1);
>> +
>> +    return 0;
>>   }
>>     static void test_pidfd_poll_exec(int use_waitpid)
>> diff --git a/tools/testing/selftests/pidfd/pidfd_wait.c b/tools/testing/selftests/pidfd/pidfd_wait.c
>> index c3e2a3041f55..0dcb8365ddc3 100644
>> --- a/tools/testing/selftests/pidfd/pidfd_wait.c
>> +++ b/tools/testing/selftests/pidfd/pidfd_wait.c
>> @@ -148,7 +148,7 @@ static int sys_waitid(int which, pid_t pid, siginfo_t *info, int options,
>>     TEST(wait_nonblock)
>>   {
>> -    int pidfd, status = 0;
>> +    int pidfd;
>>       unsigned int flags = 0;
>>       pid_t parent_tid = -1;
>>       struct clone_args args = {
>
Shuah Khan Oct. 30, 2022, 8:29 a.m. UTC | #3
On 8/31/22 21:17, Li Zhijian wrote:
> Fix warnings and enable Wall.
> 
> pidfd_wait.c: In function ‘wait_nonblock’:
> pidfd_wait.c:150:13: warning: unused variable ‘status’ [-Wunused-variable]
>    150 |  int pidfd, status = 0;
>        |             ^~~~~~
> ...
> pidfd_test.c: In function ‘child_poll_exec_test’:
> pidfd_test.c:438:1: warning: no return statement in function returning non-void [-Wreturn-type]
>    438 | }
>        | ^
> 
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
> v2: fix mistake assignment to pidfd
> ---

Sorry for the delay. Now applied to linux-kselftest fixes for rc4

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/pidfd/Makefile b/tools/testing/selftests/pidfd/Makefile
index f4a2f28f926b..778b6cdc8aed 100644
--- a/tools/testing/selftests/pidfd/Makefile
+++ b/tools/testing/selftests/pidfd/Makefile
@@ -1,5 +1,5 @@ 
 # SPDX-License-Identifier: GPL-2.0-only
-CFLAGS += -g -I../../../../usr/include/ -pthread
+CFLAGS += -g -I../../../../usr/include/ -pthread -Wall
 
 TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \
 	pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test
diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c
index 9a2d64901d59..d36654265b7a 100644
--- a/tools/testing/selftests/pidfd/pidfd_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_test.c
@@ -435,6 +435,8 @@  static int child_poll_exec_test(void *args)
 	 */
 	while (1)
 		sleep(1);
+
+	return 0;
 }
 
 static void test_pidfd_poll_exec(int use_waitpid)
diff --git a/tools/testing/selftests/pidfd/pidfd_wait.c b/tools/testing/selftests/pidfd/pidfd_wait.c
index c3e2a3041f55..0dcb8365ddc3 100644
--- a/tools/testing/selftests/pidfd/pidfd_wait.c
+++ b/tools/testing/selftests/pidfd/pidfd_wait.c
@@ -148,7 +148,7 @@  static int sys_waitid(int which, pid_t pid, siginfo_t *info, int options,
 
 TEST(wait_nonblock)
 {
-	int pidfd, status = 0;
+	int pidfd;
 	unsigned int flags = 0;
 	pid_t parent_tid = -1;
 	struct clone_args args = {