All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] pthread_barrier_init: remove the restrict limit
Date: Tue, 18 Oct 2022 09:48:06 +0100	[thread overview]
Message-ID: <87bkq9mryj.fsf@suse.de> (raw)
In-Reply-To: <20221018032203.3429895-1-liwang@redhat.com>

Hello,

Li Wang <liwang@redhat.com> writes:

> The restrict keyword tells the compiler that a given pointer
> does not alias any other pointer in the same context. But this
> is only supported by C99.
>
> To make older platforms compilinng LTP successful, we have to cancel
> that limitation in function definition.
>
> Fix error: https://github.com/linux-test-project/ltp/actions/runs/3263823142/jobs/5363481739
>
> Signed-off-by: Li Wang <liwang@redhat.com>

Sure, we don't care about this optimization. If it were a safety feature
I would suggest adding macros with an empty fallback.

Acked-by: Richard Palethorpe <rpalethorpe@suse.com>

> ---
>
> Notes:
>       I also considering adding "-std=gun99" for compiling the whole library,
>       but not sure if this could bring a bigger potential impact on
> LTP.

It would be nice to at least use C99, but I guess we can wait a bit
longer until centos7 is EOL.

>
>  include/tst_safe_pthread.h | 4 ++--
>  lib/safe_pthread.c         | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/tst_safe_pthread.h b/include/tst_safe_pthread.h
> index cc6da2de8..8fb553929 100644
> --- a/include/tst_safe_pthread.h
> +++ b/include/tst_safe_pthread.h
> @@ -41,8 +41,8 @@ int safe_pthread_barrier_destroy(const char *file, const int lineno,
>  	safe_pthread_barrier_destroy(__FILE__, __LINE__, barrier);
>  
>  int safe_pthread_barrier_init(const char *file, const int lineno,
> -			      pthread_barrier_t *restrict barrier,
> -			      const pthread_barrierattr_t *restrict attr,
> +			      pthread_barrier_t *barrier,
> +			      const pthread_barrierattr_t *attr,
>  			      unsigned count);
>  #define SAFE_PTHREAD_BARRIER_INIT(barrier, attr, count) \
>  	safe_pthread_barrier_init(__FILE__, __LINE__, barrier, attr, count);
> diff --git a/lib/safe_pthread.c b/lib/safe_pthread.c
> index d7bfee4cc..d70bb8707 100644
> --- a/lib/safe_pthread.c
> +++ b/lib/safe_pthread.c
> @@ -90,8 +90,8 @@ int safe_pthread_cancel(const char *file, const int lineno,
>  }
>  
>  int safe_pthread_barrier_init(const char *file, const int lineno,
> -			      pthread_barrier_t *restrict barrier,
> -			      const pthread_barrierattr_t *restrict attr,
> +			      pthread_barrier_t *barrier,
> +			      const pthread_barrierattr_t *attr,
>  			      unsigned count)
>  {
>  	int rval;


-- 
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-10-18  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  3:22 [LTP] [PATCH] pthread_barrier_init: remove the restrict limit Li Wang
2022-10-18  8:48 ` Richard Palethorpe [this message]
2022-10-18 12:45   ` Petr Vorel

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=87bkq9mryj.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=liwang@redhat.com \
    --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.