[VxWorks] Commonise general OS-specific macros

Richard Sandiford richard@codesourcery.com
Tue Mar 20 16:57:00 GMT 2007


This patch defines a new VXWORKS_OS_CPP_BUILTINS macro that can be
used by all VxWorks targets.  It also moves some defines from CPP_SPEC
to this new macro.

The patch only changes the x86 port to use VXWORKS_OS_CPP_BUILTINS;
we'll convert other targets later.

Tested on i586-wrs-vxworks.  OK to install?

Richard


gcc/
	* config/vxworks.h (VXWORKS_ADDITIONAL_CPP_SPEC): Remove -D options.
	(VXWORKS_OS_CPP_BUILTINS): Define.
	* config/i386/vxworks.h (VXWORKS_CPU_DEFINE): Fold into...
	(TARGET_OS_CPP_BUILTINS): ...here.  Use VXWORKS_OS_CPP_BUILTINS.

Index: gcc/config/vxworks.h
===================================================================
--- gcc/config/vxworks.h	(revision 123084)
+++ gcc/config/vxworks.h	(working copy)
@@ -35,12 +35,11 @@ Software Foundation; either version 2, o
 /* Since we provide a default -isystem, expand -isystem on the command
    line early.  */
 #undef VXWORKS_ADDITIONAL_CPP_SPEC
-#define VXWORKS_ADDITIONAL_CPP_SPEC " 					\
- %{!nostdinc:%{isystem*}}						\
- %{mrtp: -D__RTP__=1							\
-	 %{!nostdinc:-idirafter %:getenv(WIND_USR /h)}}			\
- %{!mrtp:-D_WRS_KERNEL=1						\
- 	 %{!nostdinc:-idirafter %:getenv(WIND_BASE /target/h)}}"
+#define VXWORKS_ADDITIONAL_CPP_SPEC		\
+ "%{!nostdinc:					\
+    %{isystem*} -idirafter			\
+    %{mrtp: %:getenv(WIND_USR /h)		\
+      ;:    %:getenv(WIND_BASE /target/h)}}"
 
 /* The references to __init and __fini will be satisfied by
    libc_internal.a.  */
@@ -105,4 +104,18 @@ #define VXWORKS_GOTT_BASE "__GOTT_BASE__
 #undef VXWORKS_GOTT_INDEX
 #define VXWORKS_GOTT_INDEX "__GOTT_INDEX__"
 
+/* A VxWorks implementation of TARGET_OS_CPP_BUILTINS.  */
+#define VXWORKS_OS_CPP_BUILTINS()					\
+  do									\
+    {									\
+      builtin_define ("__vxworks");					\
+      builtin_define ("__VXWORKS__");					\
+      builtin_assert ("system=unix");					\
+      if (TARGET_VXWORKS_RTP)						\
+	builtin_define ("__RTP__");					\
+      else								\
+	builtin_define ("_WRS_KERNEL");					\
+    }									\
+  while (0)
+
 #define VXWORKS_KIND VXWORKS_KIND_NORMAL
Index: gcc/config/i386/vxworks.h
===================================================================
--- gcc/config/i386/vxworks.h	(revision 123084)
+++ gcc/config/i386/vxworks.h	(working copy)
@@ -27,9 +27,10 @@ #define TARGET_VERSION fprintf (stderr, 
 #undef  ASM_SPEC
 #define ASM_SPEC "%{v:-v} %{Qy:} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
 
-#define VXWORKS_CPU_DEFINE()				\
+#define TARGET_OS_CPP_BUILTINS()			\
   do							\
     {							\
+      VXWORKS_OS_CPP_BUILTINS ();			\
       if (TARGET_386)					\
         builtin_define ("CPU=I80386");			\
       else if (TARGET_486)				\
@@ -49,18 +50,7 @@ #define VXWORKS_CPU_DEFINE()				\
           builtin_define ("CPU=PENTIUM4");		\
           builtin_define ("CPU_VARIANT=PENTIUM4");	\
         }						\
-    }  							\
-  while (0)
-
-#define TARGET_OS_CPP_BUILTINS()		\
-  do						\
-    {						\
-      builtin_define ("__vxworks");		\
-      builtin_define ("__VXWORKS__");		\
-      builtin_assert ("system=unix");		\
-						\
-      VXWORKS_CPU_DEFINE();			\
-    }						\
+    }							\
   while (0)
 
 #undef  CPP_SPEC



More information about the Gcc-patches mailing list