From 3527f6fb0e5041936c40c749940e2fe0d97a4e15 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 19 Feb 2018 09:45:50 +0300 Subject: [PATCH] Remove gcc/nios2.h and gcc/riscv.h files, include gcc/generic.h directly (code refactoring) * src/Makefile.am (nobase_private_HEADERS): Remove nios2.h, riscv.h entries. * src/atomic_ops.h [__GNUC__ && !AO_USE_PTHREAD_DEFS && !__INTEL_COMPILER]: Use #elif instead of #endif - #if pairs. * src/atomic_ops.h [__GNUC__ && !AO_USE_PTHREAD_DEFS && !__INTEL_COMPILER && (__nios2__ || __riscv)]: Do not include gcc/nios2.h and gcc/riscv.h files; gcc/generic.h is included instead. * src/atomic_ops/sysdeps/gcc/nios2.h: Delete file. * src/atomic_ops/sysdeps/gcc/riscv.h: Likewise. --- src/Makefile.am | 2 - src/atomic_ops.h | 59 ++++++++++-------------------- src/atomic_ops/sysdeps/gcc/nios2.h | 14 ------- src/atomic_ops/sysdeps/gcc/riscv.h | 12 ------ 4 files changed, 19 insertions(+), 68 deletions(-) delete mode 100644 src/atomic_ops/sysdeps/gcc/nios2.h delete mode 100644 src/atomic_ops/sysdeps/gcc/riscv.h diff --git a/src/Makefile.am b/src/Makefile.am index 084dd3c..df70081 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -90,9 +90,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \ atomic_ops/sysdeps/gcc/ia64.h \ atomic_ops/sysdeps/gcc/m68k.h \ atomic_ops/sysdeps/gcc/mips.h \ - atomic_ops/sysdeps/gcc/nios2.h \ atomic_ops/sysdeps/gcc/powerpc.h \ - atomic_ops/sysdeps/gcc/riscv.h \ atomic_ops/sysdeps/gcc/s390.h \ atomic_ops/sysdeps/gcc/sh.h \ atomic_ops/sysdeps/gcc/sparc.h \ diff --git a/src/atomic_ops.h b/src/atomic_ops.h index 22e516f..cc7cb49 100644 --- a/src/atomic_ops.h +++ b/src/atomic_ops.h @@ -285,75 +285,54 @@ /* it might require specifying additional options (like -march) */ /* or additional link libraries (if -march is not specified). */ # include "atomic_ops/sysdeps/gcc/x86.h" -# endif /* __i386__ */ -# if defined(__x86_64__) +# elif defined(__x86_64__) # if AO_GNUC_PREREQ(4, 2) && !defined(AO_USE_SYNC_CAS_BUILTIN) /* It is safe to use __sync CAS built-in on this architecture. */ # define AO_USE_SYNC_CAS_BUILTIN # endif # include "atomic_ops/sysdeps/gcc/x86.h" -# endif /* __x86_64__ */ -# if defined(__ia64__) +# elif defined(__ia64__) # include "atomic_ops/sysdeps/gcc/ia64.h" # define AO_GENERALIZE_TWICE -# endif /* __ia64__ */ -# if defined(__hppa__) +# elif defined(__hppa__) # include "atomic_ops/sysdeps/gcc/hppa.h" # define AO_CAN_EMUL_CAS -# endif /* __hppa__ */ -# if defined(__alpha__) +# elif defined(__alpha__) # include "atomic_ops/sysdeps/gcc/alpha.h" # define AO_GENERALIZE_TWICE -# endif /* __alpha__ */ -# if defined(__s390__) +# elif defined(__s390__) # include "atomic_ops/sysdeps/gcc/s390.h" -# endif /* __s390__ */ -# if defined(__sparc__) +# elif defined(__sparc__) # include "atomic_ops/sysdeps/gcc/sparc.h" # define AO_CAN_EMUL_CAS -# endif /* __sparc__ */ -# if defined(__m68k__) +# elif defined(__m68k__) # include "atomic_ops/sysdeps/gcc/m68k.h" -# endif /* __m68k__ */ -# if defined(__nios2__) -# include "atomic_ops/sysdeps/gcc/nios2.h" -# endif /* __nios2__ */ -# if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) \ - || defined(__powerpc64__) || defined(__ppc64__) \ - || defined(_ARCH_PPC) +# elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) \ + || defined(__powerpc64__) || defined(__ppc64__) || defined(_ARCH_PPC) # include "atomic_ops/sysdeps/gcc/powerpc.h" -# endif /* __powerpc__ */ -# if defined(__aarch64__) +# elif defined(__aarch64__) # include "atomic_ops/sysdeps/gcc/aarch64.h" # define AO_CAN_EMUL_CAS -# endif /* __aarch64__ */ -# if defined(__arm__) +# elif defined(__arm__) # include "atomic_ops/sysdeps/gcc/arm.h" # define AO_CAN_EMUL_CAS -# endif /* __arm__ */ -# if defined(__cris__) || defined(CRIS) +# elif defined(__cris__) || defined(CRIS) # include "atomic_ops/sysdeps/gcc/cris.h" # define AO_CAN_EMUL_CAS # define AO_GENERALIZE_TWICE -# endif -# if defined(__mips__) +# elif defined(__mips__) # include "atomic_ops/sysdeps/gcc/mips.h" -# endif /* __mips__ */ -# if defined(__sh__) || defined(SH4) +# elif defined(__sh__) || defined(SH4) # include "atomic_ops/sysdeps/gcc/sh.h" # define AO_CAN_EMUL_CAS -# endif /* __sh__ */ -# if defined(__avr32__) +# elif defined(__avr32__) # include "atomic_ops/sysdeps/gcc/avr32.h" -# endif -# if defined(__hexagon__) +# elif defined(__hexagon__) # include "atomic_ops/sysdeps/gcc/hexagon.h" -# endif -# if defined(__tile__) +# elif defined(__tile__) # include "atomic_ops/sysdeps/gcc/tile.h" -# endif -# if defined(__riscv) -# include "atomic_ops/sysdeps/gcc/riscv.h" +# else /* __nios2__, __riscv, etc. */ +# include "atomic_ops/sysdeps/gcc/generic.h" # endif #endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */ diff --git a/src/atomic_ops/sysdeps/gcc/nios2.h b/src/atomic_ops/sysdeps/gcc/nios2.h deleted file mode 100644 index a1581bd..0000000 --- a/src/atomic_ops/sysdeps/gcc/nios2.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (C) 2016 Marek Vasut - * - * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED - * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. - * - * Permission is hereby granted to use or copy this program - * for any purpose, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -#include "generic.h" diff --git a/src/atomic_ops/sysdeps/gcc/riscv.h b/src/atomic_ops/sysdeps/gcc/riscv.h deleted file mode 100644 index 412c395..0000000 --- a/src/atomic_ops/sysdeps/gcc/riscv.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED - * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. - * - * Permission is hereby granted to use or copy this program - * for any purpose, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -#include "generic.h" -- 2.40.0