This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
SH: reorganize target specs
- To: gcc-patches at gcc dot gnu dot org
- Subject: SH: reorganize target specs
- From: Andrew Haley <aph at cambridge dot redhat dot com>
- Date: Fri, 27 Jul 2001 14:56:03 +0100
This reorganizes the SH specs so that they should be easier to
maintain in the future. It also fixes a bug building SH-Linx that
caused __SIZE_TYPE__ and __PTRDIFF_TYPE__ to be undefined.
Joern approved this.
Andrew.
2001-07-26 Andrew Haley <aph@redhat.com>
Joern Rennecke <amylaar@redhat.com>
* config/sh/linux.h (CPP_DEFAULT_CPU_SPEC): New.
(SUBTARGET_CPP_ENDIAN_SPEC): New.
(SUBTARGET_CPP_SPEC): New.
(CPP_SPEC): Remove.
* config/sh/sh.h (SUBTARGET_CPP_ENDIAN_SPEC): New.
(SUBTARGET_CPP_PTR_SPEC): New.
(CPP_DEFAULT_CPU_SPEC): New.
(EXTRA_SPECS): Add SUBTARGET_CPP_ENDIAN_SPEC,
SUBTARGET_CPP_PTR_SPEC, and CPP_DEFAULT_CPU_SPEC.
(CPP_SPEC): Break out parts into SUBTARGET_CPP_ENDIAN_SPEC,
SUBTARGET_CPP_PTR_SPEC, and CPP_DEFAULT_CPU_SPEC.
(SUBTARGET_CPP_SPEC): Define as an empty string.
Index: linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/linux.h,v
retrieving revision 1.2
diff -u -r1.2 linux.h
--- linux.h 2000/11/02 23:29:13 1.2
+++ linux.h 2001/07/27 13:50:18
@@ -39,17 +39,22 @@
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE BITS_PER_WORD
-#undef CPP_SPEC
-#define CPP_SPEC \
- "%{mb:-D__BIG_ENDIAN__} \
- %{!mb:-D__LITTLE_ENDIAN__} \
- %{m3e:-D__SH3E__} \
- %{m4:-D__SH4__} \
- %{!m3e:%{!m4:-D__SH3__ -D__sh3__}} \
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC "\
%{fPIC:-D__PIC__ -D__pic__} \
%{fpic:-D__PIC__ -D__pic__} \
%{posix:-D_POSIX_SOURCE} \
- %{pthread:-D_REENTRANT -D_PTHREADS}"
+ %{pthread:-D_REENTRANT -D_PTHREADS} \
+"
+
+#undef SUBTARGET_CPP_ENDIAN_SPEC
+#define SUBTARGET_CPP_ENDIAN_SPEC \
+ "%{mb:-D__BIG_ENDIAN__} \
+ %{!mb:-D__LITTLE_ENDIAN__}"
+
+#undef CPP_DEFAULT_CPU_SPEC
+#define CPP_DEFAULT_CPU_SPEC "-D__SH3__ -D__sh3__"
+
#undef CPP_PREDEFINES
#define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sh__ -Dlinux -Asystem=posix"
Index: sh.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.h,v
retrieving revision 1.112
diff -u -r1.112 sh.h
--- sh.h 2001/07/24 15:06:14 1.112
+++ sh.h 2001/07/27 13:50:18
@@ -42,7 +42,7 @@
#define SDB_DELIM ";"
-#define CPP_SPEC "%{ml:-D__LITTLE_ENDIAN__} \
+#define CPP_SPEC " \
%{m1:-D__sh1__} \
%{m2:-D__sh2__} \
%{m3:-D__sh3__} \
@@ -51,9 +51,34 @@
%{m4-single:-D__SH4_SINGLE__} \
%{m4-nofpu:-D__sh3__ -D__SH4_NOFPU__} \
%{m4:-D__SH4__} \
-%{!m1:%{!m2:%{!m3:%{!m3e:%{!m4:%{!m4-single:%{!m4-single-only:%{!m4-nofpu:-D__sh1__}}}}}}}} \
+%{!m1:%{!m2:%{!m3*:%{!m4*:%(cpp_default_cpu_spec)}}}} \
%{mnomacsave:-D__NOMACSAVE__} \
-%{mhitachi:-D__HITACHI__}"
+%{mhitachi:-D__HITACHI__} \
+%(subtarget_cpp_spec) \
+%(subtarget_cpp_ptr_spec) \
+%(subtarget_cpp_endian_spec) "
+
+#ifndef SUBTARGET_CPP_ENDIAN_SPEC
+#define SUBTARGET_CPP_ENDIAN_SPEC "%{ml:-D__LITTLE_ENDIAN__}"
+#endif
+
+#ifndef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC ""
+#endif
+
+#ifndef CPP_DEFAULT_CPU_SPEC
+#define CPP_DEFAULT_CPU_SPEC "-D__sh1__"
+#endif
+
+#ifndef SUBTARGET_CPP_PTR_SPEC
+#define SUBTARGET_CPP_PTR_SPEC "-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int"
+#endif
+
+#define EXTRA_SPECS \
+ { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
+ { "subtarget_cpp_endian_spec", SUBTARGET_CPP_ENDIAN_SPEC }, \
+ { "subtarget_cpp_ptr_spec", SUBTARGET_CPP_PTR_SPEC }, \
+ { "cpp_default_cpu_spec", CPP_DEFAULT_CPU_SPEC },
#define CPP_PREDEFINES "-D__sh__ -Acpu=sh -Amachine=sh"