Patchwork [VMS/committed] : Define __VMS_VER and __CRTL_VER

login
register
mail settings
Submitter Tristan Gingold
Date March 16, 2012, 9:54 a.m.
Message ID <ADB3E6B5-1CF9-4FB6-823C-D55C55D9AA25@adacore.com>
Download mbox | patch
Permalink /patch/147178/
State New
Headers show

Comments

Tristan Gingold - March 16, 2012, 9:54 a.m.
Hi,

these two macros are used by system headers to enable some features.
If they aren't defined, the headers assume the system is the most recent one,
and may use some functions that aren't present in the libraries.

Let's be conservative for cross compiler (and even for native one).

Committed on trunk.

Tristan.

2012-03-16  Tristan Gingold  <gingold@adacore.com>

	* config/vms/vms.h (TARGET_OS_CPP_BUILTINS): Define
	__CRTL_VER and __VMS_VER.
	* config/vms/vms-protos.h: Declare vms_c_get_crtl_ver
	and vms_c_get_vms_ver.
	* config/vms/vms-c.c (vms_c_get_crtl_ver, vms_c_get_vms_ver): New
	functions.
	* config/alpha/vms.h (VMS_DEFAULT_CRTL_VER)
	(VMS_DEFAULT_VMS_VER): Define.
	* config/ia64/vms.h (VMS_DEFAULT_CRTL_VER)
	(VMS_DEFAULT_VMS_VER): Define.

Patch

Index: gcc/config/alpha/vms.h
===================================================================
--- gcc/config/alpha/vms.h	(revision 185454)
+++ gcc/config/alpha/vms.h	(working copy)
@@ -289,3 +289,7 @@ 
 
 #undef TARGET_VALID_POINTER_MODE
 #define TARGET_VALID_POINTER_MODE vms_valid_pointer_mode
+
+/* Default values for _CRTL_VER and _VMS_VER.  */
+#define VMS_DEFAULT_CRTL_VER 70320000
+#define VMS_DEFAULT_VMS_VER 70320000
Index: gcc/config/vms/vms-protos.h
===================================================================
--- gcc/config/vms/vms-protos.h	(revision 185454)
+++ gcc/config/vms/vms-protos.h	(working copy)
@@ -20,6 +20,8 @@ 
 /* vms-c.c  */
 extern void vms_c_register_pragma (void);
 extern void vms_c_common_override_options (void);
+extern int vms_c_get_crtl_ver (void);
+extern int vms_c_get_vms_ver (void);
 
 /* vms.c  */
 void vms_patch_builtins (void);
Index: gcc/config/vms/vms.h
===================================================================
--- gcc/config/vms/vms.h	(revision 185454)
+++ gcc/config/vms/vms.h	(working copy)
@@ -21,19 +21,21 @@ 
 #define TARGET_OBJECT_SUFFIX ".obj"
 #define TARGET_EXECUTABLE_SUFFIX ".exe"
 
-#define TARGET_OS_CPP_BUILTINS()                                \
-  do {                                                          \
-    builtin_define_std ("vms");                                 \
-    builtin_define_std ("VMS");                                 \
-    builtin_assert ("system=vms");                              \
-    SUBTARGET_OS_CPP_BUILTINS();                                \
-    builtin_define ("__int64=long long");                       \
-    if (flag_vms_pointer_size == VMS_POINTER_SIZE_32)           \
-      builtin_define ("__INITIAL_POINTER_SIZE=32");             \
-    else if (flag_vms_pointer_size == VMS_POINTER_SIZE_64)      \
-      builtin_define ("__INITIAL_POINTER_SIZE=64");             \
-    if (POINTER_SIZE == 64)                                     \
-      builtin_define ("__LONG_POINTERS=1");                     \
+#define TARGET_OS_CPP_BUILTINS()					 \
+  do {									 \
+    builtin_define_std ("vms");						 \
+    builtin_define_std ("VMS");						 \
+    builtin_assert ("system=vms");					 \
+    SUBTARGET_OS_CPP_BUILTINS();					 \
+    builtin_define ("__int64=long long");				 \
+    if (flag_vms_pointer_size == VMS_POINTER_SIZE_32)			 \
+      builtin_define ("__INITIAL_POINTER_SIZE=32");			 \
+    else if (flag_vms_pointer_size == VMS_POINTER_SIZE_64)		 \
+      builtin_define ("__INITIAL_POINTER_SIZE=64");			 \
+    if (POINTER_SIZE == 64)						 \
+      builtin_define ("__LONG_POINTERS=1");				 \
+    builtin_define_with_int_value ("__CRTL_VER", vms_c_get_crtl_ver ()); \
+    builtin_define_with_int_value ("__VMS_VER", vms_c_get_vms_ver ());   \
   } while (0)
 
 extern void vms_c_register_includes (const char *, const char *, int);
Index: gcc/config/vms/vms-c.c
===================================================================
--- gcc/config/vms/vms-c.c	(revision 185454)
+++ gcc/config/vms/vms-c.c	(working copy)
@@ -466,3 +466,19 @@ 
       break;
     }
 }
+
+/* The default value for _CRTL_VER macro.  */
+
+int
+vms_c_get_crtl_ver (void)
+{
+  return VMS_DEFAULT_CRTL_VER;
+}
+
+/* The default value for _VMS_VER macro.  */
+
+int
+vms_c_get_vms_ver (void)
+{
+  return VMS_DEFAULT_VMS_VER;
+}
Index: gcc/config/ia64/vms.h
===================================================================
--- gcc/config/ia64/vms.h	(revision 185454)
+++ gcc/config/ia64/vms.h	(working copy)
@@ -157,3 +157,7 @@ 
 /* IA64 VMS doesn't fully support COMDAT sections.  */
 
 #define SUPPORTS_ONE_ONLY 0
+
+/* Default values for _CRTL_VER and _VMS_VER.  */
+#define VMS_DEFAULT_CRTL_VER 80300000
+#define VMS_DEFAULT_VMS_VER 80300000