Re: [PATCH] unify -posix/-pthread cpp handling for gnu-user targets

2015-05-29 Thread Joseph Myers
On Thu, 28 May 2015, Mike Frysinger wrote:

 Some targets still define -posix/-pthread in SUBTARGET_CPP_SPEC and in
 CPP_SUBTARGET_SPEC, but I can't seem to find any reference to either of
 those defines.  Are they dead/confused code and I should just delete it ?

Any correct definitions of those macros will have a target-specific use 
e.g. in EXTRA_SPECS (with %(subtarget_cpp_spec) included in CPP_SPEC).  
It's entirely possible that there are some definitions that are in fact 
unused because those architectures lack such code to use them..

-- 
Joseph S. Myers
jos...@codesourcery.com


[PATCH] unify -posix/-pthread cpp handling for gnu-user targets

2015-05-28 Thread Mike Frysinger
Many Linux targets duplicate the cpp spec macros for turning -posix/-thread
into the right defines.  Some Linux targets forget to do this entirely and
can be hard to notice.  Add common definitions to the gnu headers (since
these are really in relation to the C library) and drop the duplications in
the target headers.

I've tested a few targets (aarch64, cris, x86_64) to make sure -dumpspecs
still includes the right content.

Some targets still define -posix/-pthread in SUBTARGET_CPP_SPEC and in
CPP_SUBTARGET_SPEC, but I can't seem to find any reference to either of
those defines.  Are they dead/confused code and I should just delete it ?

2015-05-28  Mike Frysinger  vap...@gentoo.org

* config/aarch64/aarch64-linux.h (CPP_SPEC): Delete.
* config/alpha/linux.h (CPP_SPEC): Delete.
* config/arm/linux-gas.h (SUBTARGET_CPP_SPEC): Change to
GNU_USER_CPP_SPEC.
* config/cris/linux.h (CRIS_CPP_SUBTARGET_SPEC): Remove -pthread.
* config/gnu-user.h (GNU_USER_CPP_SPEC, CPP_SPEC): Define.
* config/gnu.h (GNU_USER_CPP_SPEC): Define.
(CPP_SPEC): Change to GNU_USER_CPP_SPEC.
* config/i386/gnu-user-common.h (CPP_SPEC): Delete.
* config/ia64/linux.h (CPP_SPEC): Delete.
* config/m32r/linux.h (SUBTARGET_CPP_SPEC): Change to
GNU_USER_CPP_SPEC.
* config/m68k/linux.h (CPP_SPEC): Delete.
* config/microblaze/linux.h (CPP_SPEC): Delete.
* config/mips/gnu-user.h (SUBTARGET_CPP_SPEC): Change to
GNU_USER_CPP_SPEC.
* config/mn10300/linux.h (SUBTARGET_CPP_SPEC): Change to
GNU_USER_CPP_SPEC.
* config/nios2/linux.h (CPP_SPEC): Delete.
* config/pa/pa-linux.h (CPP_SPEC): Delete.
* config/s390/linux.h (CPP_SPEC): Delete.
* config/sh/linux.h (SUBTARGET_CPP_SPEC): Change to
GNU_USER_CPP_SPEC.
* config/sparc/linux.h (SUBTARGET_CPP_SPEC): Change to
GNU_USER_CPP_SPEC.
* config/sparc/linux64.h (SUBTARGET_CPP_SPEC): Change to
GNU_USER_CPP_SPEC.
* config/tilegx/linux.h (CPP_SPEC): Delete.
* config/tilepro/linux.h (CPP_SPEC): Delete.
* config/vax/linux.h (CPP_SPEC): Delete.
* config/xtensa/linux.h (SUBTARGET_CPP_SPEC): Change to
GNU_USER_CPP_SPEC.
---
 gcc/config/aarch64/aarch64-linux.h | 2 --
 gcc/config/alpha/linux.h   | 3 ---
 gcc/config/arm/linux-gas.h | 2 +-
 gcc/config/cris/linux.h| 6 ++
 gcc/config/gnu-user.h  | 5 +
 gcc/config/gnu.h   | 3 ++-
 gcc/config/i386/gnu-user-common.h  | 3 ---
 gcc/config/ia64/linux.h| 2 --
 gcc/config/m32r/linux.h| 5 ++---
 gcc/config/m68k/linux.h| 3 ---
 gcc/config/microblaze/linux.h  | 3 ---
 gcc/config/mips/gnu-user.h | 2 +-
 gcc/config/mn10300/linux.h | 6 +++---
 gcc/config/nios2/linux.h   | 3 ---
 gcc/config/pa/pa-linux.h   | 3 ---
 gcc/config/s390/linux.h| 2 --
 gcc/config/sh/linux.h  | 5 ++---
 gcc/config/sparc/linux.h   | 3 +--
 gcc/config/sparc/linux64.h | 5 +
 gcc/config/tilegx/linux.h  | 3 ---
 gcc/config/tilepro/linux.h | 3 ---
 gcc/config/vax/linux.h | 3 ---
 gcc/config/xtensa/linux.h  | 2 +-
 23 files changed, 21 insertions(+), 56 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-linux.h 
b/gcc/config/aarch64/aarch64-linux.h
index 1600a32..7d356dd 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -32,8 +32,6 @@
 #undef  CC1_SPEC
 #define CC1_SPEC GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC
 
-#define CPP_SPEC %{pthread:-D_REENTRANT}
-
 #define LINUX_TARGET_LINK_SPEC  %{h*} \
%{static:-Bstatic}  \
%{shared:-shared}   \
diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
index 475ea06..e609f38 100644
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -39,9 +39,6 @@ along with GCC; see the file COPYING3.  If not see
%{shared:-lc} \
%{!shared: %{profile:-lc_p}%{!profile:-lc}}
 
-#undef CPP_SPEC
-#define CPP_SPEC %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
-
 /* Show that we need a GP when profiling.  */
 #undef TARGET_PROFILING_NEEDS_GP
 #define TARGET_PROFILING_NEEDS_GP 1
diff --git a/gcc/config/arm/linux-gas.h b/gcc/config/arm/linux-gas.h
index d3a3196..6ce62c7 100644
--- a/gcc/config/arm/linux-gas.h
+++ b/gcc/config/arm/linux-gas.h
@@ -31,7 +31,7 @@
 #define DEFAULT_SIGNED_CHAR 0
 
 #undef  SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC  %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
+#define SUBTARGET_CPP_SPEC GNU_USER_CPP_SPEC
 
 #undef  SIZE_TYPE
 #define SIZE_TYPE unsigned int
diff --git a/gcc/config/cris/linux.h b/gcc/config/cris/linux.h
index 262aac5..043a1ac 100644
--- a/gcc/config/cris/linux.h
+++ b/gcc/config/cris/linux.h
@@ -54,12 +54,10 @@ along with GCC; see the file COPYING3.  If