From: Ivan Maidanski <ivmai@mail.ru> Date: Tue, 29 Nov 2011 17:11:06 +0000 (+0400) Subject: Include ao_t_is_int.h from atomic_ops.h after first generalization if X-Git-Tag: libatomic_ops-7_3alpha2~55^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6684de80c0dc7ceefd6a6a6f4b6f18972d8b2a7;p=libatomic_ops Include ao_t_is_int.h from atomic_ops.h after first generalization if AO_T_IS_INT (new macro) is defined in 'sysdeps' file * src/atomic_ops.h (AO_T_IS_INT): Test macro after first generalization, if set then include ao_t_is_int.h file and force AO_GENERALIZE_TWICE. * src/atomic_ops/sysdeps/gcc/hexagon.h (AO_T_IS_INT): Define new macro instead of ao_t_is_int.h inclusion. * src/atomic_ops/sysdeps/gcc/ia64.h (AO_T_IS_INT): Likewise. * src/atomic_ops/sysdeps/gcc/m68k.h (AO_T_IS_INT): Likewise. * src/atomic_ops/sysdeps/gcc/mips.h (AO_T_IS_INT): Likewise. * src/atomic_ops/sysdeps/gcc/powerpc.h (AO_T_IS_INT): Likewise. * src/atomic_ops/sysdeps/gcc/x86.h (AO_T_IS_INT): Likewise. * src/atomic_ops/sysdeps/hpc/ia64.h (AO_T_IS_INT): Likewise. * src/atomic_ops/sysdeps/msftc/x86.h (AO_T_IS_INT): Likewise. * src/atomic_ops/sysdeps/sunc/x86.h (AO_T_IS_INT): Likewise. * src/atomic_ops/sysdeps/gcc/powerpc.h: Add place-holder comment (in case of ppc64). * src/atomic_ops/sysdeps/gcc/hexagon.h: Do not include generalize.h any longer (since ao_t_is_int.h is included from atomic_ops.h now). * src/atomic_ops/sysdeps/gcc/ia64.h: Likewise. * src/atomic_ops/sysdeps/hpc/ia64.h: Likewise. --- diff --git a/src/atomic_ops.h b/src/atomic_ops.h index 334dba0..de1506d 100644 --- a/src/atomic_ops.h +++ b/src/atomic_ops.h @@ -371,6 +371,16 @@ /* In fact, we observe that this converges after a small fixed number */ /* of iterations, usually one. */ #include "atomic_ops/generalize.h" + +#ifdef AO_T_IS_INT + /* Included after the first generalization pass. */ +# include "atomic_ops/sysdeps/ao_t_is_int.h" +# ifndef AO_GENERALIZE_TWICE + /* Always generalize again. */ +# define AO_GENERALIZE_TWICE +# endif +#endif /* AO_T_IS_INT */ + #ifdef AO_GENERALIZE_TWICE # include "atomic_ops/generalize.h" #endif diff --git a/src/atomic_ops/sysdeps/gcc/hexagon.h b/src/atomic_ops/sysdeps/gcc/hexagon.h index 62ad0da..b89905b 100644 --- a/src/atomic_ops/sysdeps/gcc/hexagon.h +++ b/src/atomic_ops/sysdeps/gcc/hexagon.h @@ -92,7 +92,4 @@ AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) } #define AO_HAVE_compare_and_swap -/* Generalize first to define more AO_int_... primitives. */ -#include "../../generalize.h" - -#include "../ao_t_is_int.h" +#define AO_T_IS_INT diff --git a/src/atomic_ops/sysdeps/gcc/ia64.h b/src/atomic_ops/sysdeps/gcc/ia64.h index 6c5e221..b2ec7d4 100644 --- a/src/atomic_ops/sysdeps/gcc/ia64.h +++ b/src/atomic_ops/sysdeps/gcc/ia64.h @@ -279,7 +279,5 @@ AO_int_compare_and_swap_release(volatile unsigned int *addr, /* FIXME: Add compare_double_and_swap_double for the _ILP32 case. */ #ifdef _ILP32 - /* Generalize first to define more AO_int_... primitives. */ -# include "../../generalize.h" -# include "../ao_t_is_int.h" +# define AO_T_IS_INT #endif diff --git a/src/atomic_ops/sysdeps/gcc/m68k.h b/src/atomic_ops/sysdeps/gcc/m68k.h index c898082..73838f6 100644 --- a/src/atomic_ops/sysdeps/gcc/m68k.h +++ b/src/atomic_ops/sysdeps/gcc/m68k.h @@ -63,4 +63,4 @@ AO_compare_and_swap_full(volatile AO_t *addr, } #define AO_HAVE_compare_and_swap_full -#include "../ao_t_is_int.h" +#define AO_T_IS_INT diff --git a/src/atomic_ops/sysdeps/gcc/mips.h b/src/atomic_ops/sysdeps/gcc/mips.h index 527a347..13923f7 100644 --- a/src/atomic_ops/sysdeps/gcc/mips.h +++ b/src/atomic_ops/sysdeps/gcc/mips.h @@ -99,4 +99,4 @@ AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { * directly. */ -#include "../ao_t_is_int.h" +#define AO_T_IS_INT diff --git a/src/atomic_ops/sysdeps/gcc/powerpc.h b/src/atomic_ops/sysdeps/gcc/powerpc.h index 69ec05b..331f7d3 100644 --- a/src/atomic_ops/sysdeps/gcc/powerpc.h +++ b/src/atomic_ops/sysdeps/gcc/powerpc.h @@ -279,6 +279,7 @@ AO_fetch_and_add_full(volatile AO_t *addr, AO_t incr) { #define AO_HAVE_fetch_and_add_full #if defined(__powerpc64__) || defined(__ppc64__) || defined(__64BIT__) + /* Empty */ #else -# include "../ao_t_is_int.h" +# define AO_T_IS_INT #endif diff --git a/src/atomic_ops/sysdeps/gcc/x86.h b/src/atomic_ops/sysdeps/gcc/x86.h index b304dd0..ac3933d 100644 --- a/src/atomic_ops/sysdeps/gcc/x86.h +++ b/src/atomic_ops/sysdeps/gcc/x86.h @@ -182,4 +182,4 @@ AO_compare_double_and_swap_double_full(volatile AO_double_t *addr, } #define AO_HAVE_compare_double_and_swap_double_full -#include "../ao_t_is_int.h" +#define AO_T_IS_INT diff --git a/src/atomic_ops/sysdeps/hpc/ia64.h b/src/atomic_ops/sysdeps/hpc/ia64.h index 3c538fd..a4d384e 100644 --- a/src/atomic_ops/sysdeps/hpc/ia64.h +++ b/src/atomic_ops/sysdeps/hpc/ia64.h @@ -160,7 +160,5 @@ AO_short_compare_and_swap_release(volatile unsigned short *addr, #define AO_HAVE_short_compare_and_swap_release #ifndef __LP64__ - /* Generalize first to define more AO_int_... primitives. */ -# include "../../generalize.h" -# include "../ao_t_is_int.h" +# define AO_T_IS_INT #endif diff --git a/src/atomic_ops/sysdeps/msftc/x86.h b/src/atomic_ops/sysdeps/msftc/x86.h index 3ab17a1..0265592 100644 --- a/src/atomic_ops/sysdeps/msftc/x86.h +++ b/src/atomic_ops/sysdeps/msftc/x86.h @@ -117,4 +117,4 @@ AO_double_compare_and_swap_full(volatile AO_double_t *addr, #endif /* AO_ASSUME_VISTA */ -#include "../ao_t_is_int.h" +#define AO_T_IS_INT diff --git a/src/atomic_ops/sysdeps/sunc/x86.h b/src/atomic_ops/sysdeps/sunc/x86.h index 9abd8a0..c77120a 100644 --- a/src/atomic_ops/sysdeps/sunc/x86.h +++ b/src/atomic_ops/sysdeps/sunc/x86.h @@ -179,4 +179,4 @@ AO_compare_double_and_swap_double_full(volatile AO_double_t *addr, #define AO_HAVE_compare_double_and_swap_double_full #endif -#include "../ao_t_is_int.h" +#define AO_T_IS_INT