[PATCH/RFA] Clean up CPP built-ins for VAX

Jason R Thorpe thorpej@wasabisystems.com
Sun Jun 9 22:35:00 GMT 2002


I changed the shared VAX built-ins to only define namespace-clean
versions ... targets which require namespace-invasive defines have
been changed to provide them themselves.

Tested on vax-netbsd, and confirmed to build for all other VAX
configurations.

OK to commit?

	* config.gcc (vax-*-bsd*): Add vax/bsd.h to ${tm_file}.
	* config/vax/bsd.h: New file.
	* config/vax/netbsd.h: Add missing notice.
	(CPP_PREDEFINES): Remove.
	(TARGET_OS_CPP_BUILTINS): Define.
	(CPP_SPEC): Use NETBSD_CPP_SPEC.
	* config/vax/openbsd.h: Update copyright years.
	(CPP_PREDEFINES): Remove.
	(TARGET_OS_CPP_BUILTINS): Define.
	* config/vax/ultrix.h: Likewise.
	* config/vax/vaxv.h: Likewise.
	* config/vax/vms.h: Likewise.
	* config/vax/vax.h (TARGET_CPU_CPP_BUILTINS): Define.
	(CPP_PREDEFINES, CPP_SPEC): Remove.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>
-------------- next part --------------
Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.207
diff -u -r1.207 config.gcc
--- config.gcc	7 Jun 2002 23:31:04 -0000	1.207
+++ config.gcc	10 Jun 2002 05:33:22 -0000
@@ -2627,6 +2627,7 @@
 	cxx_target_objs="v850-c.o"
 	;;
 vax-*-bsd*)			# VAXen running BSD
+	tm_file="${tm_file} vax/bsd.h"
 	use_collect2=yes
 	float_format=vax
 	;;
Index: config/vax/bsd.h
===================================================================
RCS file: config/vax/bsd.h
diff -N config/vax/bsd.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ config/vax/bsd.h	10 Jun 2002 05:33:22 -0000
@@ -0,0 +1,32 @@
+/* Definitions of target machine for GNU compiler.  BSD version.
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+      builtin_define_std ("unix");		\
+      builtin_assert ("system=bsd");		\
+						\
+      builtin_define_std ("vax");		\
+      if (TARGET_G_FLOAT)			\
+	builtin_define_std ("GFLOAT");		\
+    }						\
+  while (0)
Index: config/vax/netbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/vax/netbsd.h,v
retrieving revision 1.7
diff -u -r1.7 netbsd.h
--- config/vax/netbsd.h	9 May 2002 03:53:58 -0000	1.7
+++ config/vax/netbsd.h	10 Jun 2002 05:33:22 -0000
@@ -1,8 +1,35 @@
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dvax -D__NetBSD__ -Asystem=unix -Asystem=NetBSD -Acpu=vax -Amachine=vax"
+/* Definitions of target machine for GNU compiler.
+   NetBSD/vax a.out version.
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+   Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+      NETBSD_OS_CPP_BUILTINS_AOUT();		\
+    }						\
+  while (0)
 
 #undef CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
+#define CPP_SPEC NETBSD_CPP_SPEC
 
 /* Make gcc agree with <machine/ansi.h> */
 
@@ -15,4 +42,3 @@
 /* Until they use ELF or something that handles dwarf2 unwinds
    and initialization stuff better.  */
 #undef DWARF2_UNWIND_INFO
-
Index: config/vax/openbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/vax/openbsd.h,v
retrieving revision 1.3
diff -u -r1.3 openbsd.h
--- config/vax/openbsd.h	3 Aug 2001 01:19:19 -0000	1.3
+++ config/vax/openbsd.h	10 Jun 2002 05:33:22 -0000
@@ -1,5 +1,5 @@
 /* Configuration fragment for a VAX OpenBSD target.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -20,8 +20,15 @@
 
 /* Amend common OpenBSD definitions for VAX target.  */
 
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D__unix__ -D__vax__ -D__OpenBSD__ -Asystem=unix -Asystem=OpenBSD -Acpu=vax -Amachine=vax"
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+      builtin_define ("__unix__");		\
+      builtin_define ("__OpenBSD__");		\
+      builtin_assert ("system=unix");		\
+      builtin_assert ("system=OpenBSD");	\
+    }						\
+  while (0)
 
 /* Layout of source language data types.  */
 
Index: config/vax/ultrix.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/vax/ultrix.h,v
retrieving revision 1.5
diff -u -r1.5 ultrix.h
--- config/vax/ultrix.h	3 Aug 2001 01:19:19 -0000	1.5
+++ config/vax/ultrix.h	10 Jun 2002 05:33:22 -0000
@@ -1,5 +1,5 @@
 /* Output variables, constants and external declarations, for GNU compiler.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -18,8 +18,21 @@
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES " -Dvax -Dunix -Dultrix -Dbsd4_2 -D__vax -D__unix -D__ultrix -D__bsd4_2 -Asystem=unix -Asystem=bsd -Acpu=vax -Amachine=vax"
+
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+      builtin_define_std ("unix");		\
+      builtin_define_std ("ultrix");		\
+      builtin_define_std ("bsd4_2");		\
+      builtin_assert ("system=unix");		\
+      builtin_assert ("system=bsd");		\
+						\
+      builtin_define_std ("vax");		\
+      if (TARGET_G_FLOAT)			\
+	builtin_define_std ("GFLOAT");		\
+    }						\
+  while (0)
 
 /* These are as defined in /usr/include/sys/stdtypes.h.
    These values are for ultrix 4.2 on the VAX.  */
Index: config/vax/vax.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/vax/vax.h,v
retrieving revision 1.38
diff -u -r1.38 vax.h
--- config/vax/vax.h	19 May 2002 08:31:52 -0000	1.38
+++ config/vax/vax.h	10 Jun 2002 05:33:23 -0000
@@ -19,19 +19,27 @@
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-#define VMS_TARGET 0
 
-/* Names to predefine in the preprocessor for this target machine.  */
+/* Target CPU builtins.  */
+#define TARGET_CPU_CPP_BUILTINS()		\
+  do						\
+    {						\
+      builtin_define ("__vax__");		\
+      builtin_assert ("cpu=vax");		\
+      builtin_assert ("machine=vax");		\
+      if (TARGET_G_FLOAT)			\
+	{					\
+	  builtin_define ("__GFLOAT");		\
+	  builtin_define ("__GFLOAT__");	\
+	}					\
+    }						\
+  while (0)
 
-#define CPP_PREDEFINES "-Dvax -D__vax__ -Dunix -Asystem=unix -Asystem=bsd -Acpu=vax -Amachine=vax"
+#define VMS_TARGET 0
 
 /* Use -J option for long branch support with Unix assembler.  */
 
 #define ASM_SPEC "-J"
-
-/* If using g-format floating point, alter math.h.  */
-
-#define	CPP_SPEC "%{mg:%{!ansi:-DGFLOAT} -D__GFLOAT}"
 
 /* Choose proper libraries depending on float format.
    Note that there are no profiling libraries for g-format.
Index: config/vax/vaxv.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/vax/vaxv.h,v
retrieving revision 1.7
diff -u -r1.7 vaxv.h
--- config/vax/vaxv.h	20 Dec 2001 17:36:38 -0000	1.7
+++ config/vax/vaxv.h	10 Jun 2002 05:33:23 -0000
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GNU compiler.  VAX sysV version.
-   Copyright (C) 1988, 1993, 1996, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1988, 1993, 1996, 2000, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -22,8 +22,17 @@
 
 #define SCCS_DIRECTIVE
 
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dvax -Dunix -Asystem=unix -Asystem=svr3 -Acpu=vax -Amachine=vax"
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+      builtin_define_std ("unix");		\
+      builtin_assert ("system=svr3");		\
+						\
+      builtin_define_std ("vax");		\
+      if (TARGET_G_FLOAT)			\
+	builtin_define_std ("GFLOAT");		\
+    }						\
+  while (0)
 
 /* Output #ident as a .ident.  */
 
Index: config/vax/vms.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/vax/vms.h,v
retrieving revision 1.15
diff -u -r1.15 vms.h
--- config/vax/vms.h	19 May 2002 05:23:26 -0000	1.15
+++ config/vax/vms.h	10 Jun 2002 05:33:23 -0000
@@ -35,17 +35,23 @@
 #define VMS_TARGET 1
 
 #undef LIB_SPEC
-#undef CPP_PREDEFINES
 #undef TARGET_NAME
 #undef TARGET_DEFAULT
 #undef CALL_USED_REGISTERS
 #undef STARTING_FRAME_OFFSET
 
-/* Predefine this in CPP because VMS limits the size of command options
-   and GNU CPP is not used on VMS except with GNU C.  */
-#define CPP_PREDEFINES \
-"-Dvax -Dvms -DVMS -D__vax__ -D__vms__ -D__VMS__\
- -D__GNUC__=2 -D__GNUC_MINOR__=7 -Asystem=vms -Acpu=vax -Amachine=vax"
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+      builtin_define_std ("vms");		\
+      builtin_define_std ("VMS");		\
+      builtin_assert ("system=vms");		\
+						\
+      builtin_define_std ("vax");		\
+      if (TARGET_G_FLOAT)			\
+	builtin_define_std ("GFLOAT");		\
+    }						\
+  while (0)
 
 /* These match the definitions used in VAXCRTL, the VMS C run-time library */
 


More information about the Gcc-patches mailing list