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

Cyril Hrubis chrubis@suse.cz
Thu Apr 14 16:36:23 CEST 2016


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


Otherwise it looks good.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list