[LTP] [PATCH v2 3/4] tst_atomic: add atomic_add_return for x86/64, ppc/64 and s390/x

Jan Stancek jstancek@redhat.com
Fri Apr 15 14:08:44 CEST 2016





----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Thursday, 14 April, 2016 4:36:23 PM
> Subject: Re: [LTP] [PATCH v2 3/4] tst_atomic: add atomic_add_return for x86/64, ppc/64 and s390/x
> 
> Hi!
> >  #if HAVE_SYNC_ADD_AND_FETCH == 1
> > +#define HAVE_ATOMIC_ADD_RETURN 1
> >  static inline __attribute__((always_inline)) int atomic_add_return(int i,
> >  int *v)
> >  {
> >  	return __sync_add_and_fetch(v, i);
> >  }
> > -#else
> > +
> > +#else /* HAVE_SYNC_ADD_AND_FETCH == 1 */
> > +
> > +#if defined(__i386__) || defined(__x86_64__)
> > +#define HAVE_ATOMIC_ADD_RETURN 1
> > +static inline __attribute__((always_inline)) int atomic_add_return(int i,
> > int *v)
> > +{
> 
> Maybe we can make the ifdefs a bit more readable by indenting them with
> spaces after the hash.
> 
> #else
> # if defined(__i386__) || defined(__x86_64__)
> #  define HAVE_ATOMIC_ADD_RETURN 1
> 
> ...
> 
> # endif

I have re-arranged this in v3, so that there is less nesting,
and also dropped HAVE_ATOMIC_ADD_RETURN.

I also made some other small tweaks, changes are described
in each patch.



More information about the ltp mailing list