All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V3 1/2] libs: sigwait: Fix compilation warning around sigprocmask()
Date: Wed, 29 Jul 2020 18:25:36 +0530	[thread overview]
Message-ID: <82754cb787a5af12d61fb71364d40909d5503204.1596027282.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <53c9ed8dc17ea6fa0b46502cd1c724a3a8539c8c.1595842740.git.viresh.kumar@linaro.org>

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 replacing the third argument with sigs or removing it if
not required.

Also improve a comment while at it.

Reported-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
V3:
- Fix function arguments.
- Fix print message.

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

diff --git a/libs/libltpsigwait/sigwait.c b/libs/libltpsigwait/sigwait.c
index dbd33a61f2b1..fd32efd8aa9f 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, &oldmask, &sigs));
 	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, &oldmask, &sigs));
 	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, &oldmask, &sigs));
 	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,9 +289,9 @@ 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, &oldmask, NULL));
 	if (TST_RET == -1)
-		tst_brk(TBROK | TTERRNO, "sigprocmask() failed");
+		tst_brk(TBROK | TTERRNO, "restoring original signal mask failed");
 
 	SAFE_KILL(child, SIGTERM);
 	SAFE_WAIT(NULL);
-- 
2.14.1


  parent reply	other threads:[~2020-07-29 12:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Viresh Kumar [this message]
2020-07-29 14:39   ` [LTP] [PATCH V3 " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82754cb787a5af12d61fb71364d40909d5503204.1596027282.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.