public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH V2 1/2] libs: sigwait: Fix compilation warning around sigprocmask()
@ 2020-07-27  9:40 Viresh Kumar
  2020-07-27  9:40 ` [LTP] [PATCH V2 2/2] libs: sigwait: Get rid of REPORT_SUCCESS() macro Viresh Kumar
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Viresh Kumar @ 2020-07-27  9:40 UTC (permalink / raw)
  To: ltp

Newer gcc generates following warnings currently:

sigwait.c: In function ?test_masked_matching?:
sigwait.c:157:42: warning: passing argument 3 to restrict-qualified parameter aliases with argument 2 [-Wrestrict]
  157 |  TEST(sigprocmask(SIG_SETMASK, &oldmask, &oldmask));

Fix these by using different pointers for new and old masks.

Reported-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
V2: New patch

 libs/libltpsigwait/sigwait.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libs/libltpsigwait/sigwait.c b/libs/libltpsigwait/sigwait.c
index dbd33a61f2b1..0a34e6cc3deb 100644
--- a/libs/libltpsigwait/sigwait.c
+++ b/libs/libltpsigwait/sigwait.c
@@ -156,11 +156,11 @@ void test_masked_matching(swi_func sigwaitinfo, int signo,
 			    && si.si_code == SI_USER
 			    && si.si_signo == signo, "Struct siginfo mismatch");
 
-	TEST(sigprocmask(SIG_SETMASK, &oldmask, &oldmask));
+	TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask));
 	if (TST_RET == -1)
 		tst_brk(TBROK | TTERRNO, "restoring original signal mask failed");
 
-	if (sigismember(&oldmask, signo))
+	if (sigismember(&sigs, signo))
 		tst_res(TPASS, "sigwaitinfo restored the original mask");
 	else
 		tst_res(TFAIL,
@@ -214,11 +214,11 @@ void test_masked_matching_rt(swi_func sigwaitinfo, int signo,
 			    && si.si_signo == signo + 1,
 			    "Struct siginfo mismatch");
 
-	TEST(sigprocmask(SIG_SETMASK, &oldmask, &oldmask));
+	TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask));
 	if (TST_RET == -1)
 		tst_brk(TBROK | TTERRNO, "restoring original signal mask failed");
 
-	if (sigismember(&oldmask, signo))
+	if (sigismember(&sigs, signo))
 		tst_res(TPASS, "sigwaitinfo restored the original mask");
 	else
 		tst_res(TFAIL,
@@ -250,11 +250,11 @@ void test_masked_matching_noinfo(swi_func sigwaitinfo, int signo,
 	TEST(sigwaitinfo(&sigs, NULL, NULL));
 	REPORT_SUCCESS(signo, 0);
 
-	TEST(sigprocmask(SIG_SETMASK, &oldmask, &oldmask));
+	TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask));
 	if (TST_RET == -1)
 		tst_brk(TBROK | TTERRNO, "restoring original signal mask failed");
 
-	if (sigismember(&oldmask, signo))
+	if (sigismember(&sigs, signo))
 		tst_res(TPASS, "sigwaitinfo restored the original mask");
 	else
 		tst_res(TFAIL,
@@ -289,7 +289,7 @@ void test_bad_address(swi_func sigwaitinfo, int signo,
 	TEST(sigwaitinfo(&sigs, (void *)1, NULL));
 	REPORT_SUCCESS(-1, EFAULT);
 
-	TEST(sigprocmask(SIG_SETMASK, &oldmask, &oldmask));
+	TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask));
 	if (TST_RET == -1)
 		tst_brk(TBROK | TTERRNO, "sigprocmask() failed");
 
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-08-06 12:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-27  9:40 [LTP] [PATCH V2 1/2] libs: sigwait: Fix compilation warning around sigprocmask() Viresh Kumar
2020-07-27  9:40 ` [LTP] [PATCH V2 2/2] libs: sigwait: Get rid of REPORT_SUCCESS() macro Viresh Kumar
2020-07-29 14:40   ` Cyril Hrubis
2020-07-29 15:13     ` Viresh Kumar
2020-07-30 15:25       ` Cyril Hrubis
2020-07-28 13:02 ` [LTP] [PATCH V2 1/2] libs: sigwait: Fix compilation warning around sigprocmask() Cyril Hrubis
2020-07-29 12:55 ` [LTP] [PATCH V3 " Viresh Kumar
2020-07-29 14:39   ` Cyril Hrubis
2020-07-29 15:13 ` [LTP] [PATCH V2 resend 2/2] libs: sigwait: Get rid of REPORT_SUCCESS() macro Viresh Kumar
2020-07-30 15:34   ` Cyril Hrubis
2020-08-04  7:57 ` [LTP] [PATCH V3 " Viresh Kumar
2020-08-06 12:26   ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox