Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Tristan Gingold

On Mar 13, 2012, at 2:57 PM, Andreas Schwab wrote:

> Tristan Gingold  writes:
> 
>> For which target ?
> 
> ia64-*-* or alpha-*-*
> 
>> On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:
>> 
>> /* Let code know whether we are targetting VMS without need of
>>   intrusive preprocessor directives.  */
>> #ifndef TARGET_ABI_OPEN_VMS
> 
> TARGET_ABI_OPEN_VMS is always defined.

I am committing this patch to fix the build failure.

Tested by (cross) building ia64-linux and ia64-hp-openvms.

Tristan.

gcc/ada/
2012-03-13  Tristan Gingold  

* gcc-interface/gigi.h (flag_vms_malloc64): Refine condition.

Index: gcc-interface/gigi.h
===
--- gcc-interface/gigi.h(revision 185334)
+++ gcc-interface/gigi.h(working copy)
@@ -995,10 +995,12 @@
intrusive preprocessor directives.  */
 #ifndef TARGET_ABI_OPEN_VMS
 #define TARGET_ABI_OPEN_VMS 0
+#endif
 
 /* VMS option set by default, when clear forces 32bit mallocs and 32bit
-   Descriptors. Always used in combination with TARGET_ABI_OPEN_VMS
+   Descriptors.  Always used in combination with TARGET_ABI_OPEN_VMS
so no effect on non-VMS systems.  */
+#if TARGET_ABI_OPEN_VMS == 0
 #define flag_vms_malloc64 0
 #endif
 



Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Tristan Gingold

On Mar 13, 2012, at 2:57 PM, Andreas Schwab wrote:

> Tristan Gingold  writes:
> 
>> For which target ?
> 
> ia64-*-* or alpha-*-*
> 
>> On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:
>> 
>> /* Let code know whether we are targetting VMS without need of
>>   intrusive preprocessor directives.  */
>> #ifndef TARGET_ABI_OPEN_VMS
> 
> TARGET_ABI_OPEN_VMS is always defined.

Ok, I see the issue.  Will fix.

Tristan.



Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Andreas Schwab
Tristan Gingold  writes:

> For which target ?

ia64-*-* or alpha-*-*

> On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:
>
> /* Let code know whether we are targetting VMS without need of
>intrusive preprocessor directives.  */
> #ifndef TARGET_ABI_OPEN_VMS

TARGET_ABI_OPEN_VMS is always defined.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Tristan Gingold

On Mar 13, 2012, at 12:48 PM, Richard Guenther wrote:

> On Tue, Mar 13, 2012 at 12:20 PM, Tristan Gingold  wrote:
>> 
>> On Mar 13, 2012, at 12:13 PM, Andreas Schwab wrote:
>> 
>>> Tristan Gingold  writes:
>>> 
 diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
 index 34183ba..120628e 100644
 --- a/gcc/ada/gcc-interface/decl.c
 +++ b/gcc/ada/gcc-interface/decl.c
 @@ -5488,7 +5488,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, 
 Mechanism_Type mech,
 
   /* VMS descriptors are themselves passed by reference.  */
   if (mech == By_Short_Descriptor ||
 -  (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !TARGET_MALLOC64))
 +  (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && 
 !flag_vms_malloc64))
> 
> That looks ugly and should have left a target macro instead of ...
> 
>>> ../../gcc/ada/gcc-interface/decl.c: In function 'gnat_to_gnu_param':
>>> ../../gcc/ada/gcc-interface/decl.c:5492: error: 'flag_vms_malloc64' 
>>> undeclared (first use in this function)
>>> ../../gcc/ada/gcc-interface/decl.c:5492: error: (Each undeclared identifier 
>>> is reported only once
>>> ../../gcc/ada/gcc-interface/decl.c:5492: error: for each function it 
>>> appears in.)
>>> make[3]: *** [ada/decl.o] Error 1
>> 
>> For which target ?
>> 
>> On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:
>> 
>> /* Let code know whether we are targetting VMS without need of
>>   intrusive preprocessor directives.  */
>> #ifndef TARGET_ABI_OPEN_VMS
>> #define TARGET_ABI_OPEN_VMS 0
>> 
>> /* VMS option set by default, when clear forces 32bit mallocs and 32bit
>>   Descriptors. Always used in combination with TARGET_ABI_OPEN_VMS
>>   so no effect on non-VMS systems.  */
>> #define flag_vms_malloc64 0
>> #endif
> 
> ... this.

But even with a target macro, we should define it for targets other than VMS.

Tristan.


Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Richard Guenther
On Tue, Mar 13, 2012 at 12:20 PM, Tristan Gingold  wrote:
>
> On Mar 13, 2012, at 12:13 PM, Andreas Schwab wrote:
>
>> Tristan Gingold  writes:
>>
>>> diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
>>> index 34183ba..120628e 100644
>>> --- a/gcc/ada/gcc-interface/decl.c
>>> +++ b/gcc/ada/gcc-interface/decl.c
>>> @@ -5488,7 +5488,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, 
>>> Mechanism_Type mech,
>>>
>>>   /* VMS descriptors are themselves passed by reference.  */
>>>   if (mech == By_Short_Descriptor ||
>>> -      (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !TARGET_MALLOC64))
>>> +      (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !flag_vms_malloc64))

That looks ugly and should have left a target macro instead of ...

>> ../../gcc/ada/gcc-interface/decl.c: In function 'gnat_to_gnu_param':
>> ../../gcc/ada/gcc-interface/decl.c:5492: error: 'flag_vms_malloc64' 
>> undeclared (first use in this function)
>> ../../gcc/ada/gcc-interface/decl.c:5492: error: (Each undeclared identifier 
>> is reported only once
>> ../../gcc/ada/gcc-interface/decl.c:5492: error: for each function it appears 
>> in.)
>> make[3]: *** [ada/decl.o] Error 1
>
> For which target ?
>
> On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:
>
> /* Let code know whether we are targetting VMS without need of
>   intrusive preprocessor directives.  */
> #ifndef TARGET_ABI_OPEN_VMS
> #define TARGET_ABI_OPEN_VMS 0
>
> /* VMS option set by default, when clear forces 32bit mallocs and 32bit
>   Descriptors. Always used in combination with TARGET_ABI_OPEN_VMS
>   so no effect on non-VMS systems.  */
> #define flag_vms_malloc64 0
> #endif

... this.

Richard.

> Tristan.
>


Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Tristan Gingold

On Mar 13, 2012, at 12:13 PM, Andreas Schwab wrote:

> Tristan Gingold  writes:
> 
>> diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
>> index 34183ba..120628e 100644
>> --- a/gcc/ada/gcc-interface/decl.c
>> +++ b/gcc/ada/gcc-interface/decl.c
>> @@ -5488,7 +5488,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, 
>> Mechanism_Type mech,
>> 
>>   /* VMS descriptors are themselves passed by reference.  */
>>   if (mech == By_Short_Descriptor ||
>> -  (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !TARGET_MALLOC64))
>> +  (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !flag_vms_malloc64))
> 
> ../../gcc/ada/gcc-interface/decl.c: In function 'gnat_to_gnu_param':
> ../../gcc/ada/gcc-interface/decl.c:5492: error: 'flag_vms_malloc64' 
> undeclared (first use in this function)
> ../../gcc/ada/gcc-interface/decl.c:5492: error: (Each undeclared identifier 
> is reported only once
> ../../gcc/ada/gcc-interface/decl.c:5492: error: for each function it appears 
> in.)
> make[3]: *** [ada/decl.o] Error 1

For which target ?

On non-VMS targets, flag_vms_malloc64 is declared in gigi.h as:

/* Let code know whether we are targetting VMS without need of
   intrusive preprocessor directives.  */
#ifndef TARGET_ABI_OPEN_VMS
#define TARGET_ABI_OPEN_VMS 0

/* VMS option set by default, when clear forces 32bit mallocs and 32bit
   Descriptors. Always used in combination with TARGET_ABI_OPEN_VMS
   so no effect on non-VMS systems.  */
#define flag_vms_malloc64 0
#endif

Tristan.



Re: [VMS/committed]: Add -mpointer-size switch

2012-03-13 Thread Andreas Schwab
Tristan Gingold  writes:

> diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
> index 34183ba..120628e 100644
> --- a/gcc/ada/gcc-interface/decl.c
> +++ b/gcc/ada/gcc-interface/decl.c
> @@ -5488,7 +5488,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type 
> mech,
>  
>/* VMS descriptors are themselves passed by reference.  */
>if (mech == By_Short_Descriptor ||
> -  (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !TARGET_MALLOC64))
> +  (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !flag_vms_malloc64))

../../gcc/ada/gcc-interface/decl.c: In function 'gnat_to_gnu_param':
../../gcc/ada/gcc-interface/decl.c:5492: error: 'flag_vms_malloc64' undeclared 
(first use in this function)
../../gcc/ada/gcc-interface/decl.c:5492: error: (Each undeclared identifier is 
reported only once
../../gcc/ada/gcc-interface/decl.c:5492: error: for each function it appears 
in.)
make[3]: *** [ada/decl.o] Error 1

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [VMS/committed]: Add -mpointer-size switch

2012-03-12 Thread Tristan Gingold

On Mar 12, 2012, at 3:14 PM, Douglas Rupp wrote:

> On 3/12/2012 4:48 AM, Tristan Gingold wrote:
>> Hi,
>> 
>> Now that '#pragma pointer_size' is supported by GCC for VMS, we can add the 
>> '-mpointer-size' switch (modeled on /POINTER_SIZE=xx DEC-C qualifier) to set 
>> the default pointer size.  This also makes alpha64-dec-*vms* target obsolete 
>> (but still supported by alpha*-dec-*vms*).
>> 
> 
> What about the size of Ada system.address which is also controlled by alpha64 
> triplet?

You should need to configure as alpha64-dec-openvms.  But indeed, I think we 
should always default to 64 for Ada.

Tristan.




Re: [VMS/committed]: Add -mpointer-size switch

2012-03-12 Thread Douglas Rupp

On 3/12/2012 4:48 AM, Tristan Gingold wrote:

Hi,

Now that '#pragma pointer_size' is supported by GCC for VMS, we can add the 
'-mpointer-size' switch (modeled on /POINTER_SIZE=xx DEC-C qualifier) to set 
the default pointer size.  This also makes alpha64-dec-*vms* target obsolete 
(but still supported by alpha*-dec-*vms*).



What about the size of Ada system.address which is also controlled by 
alpha64 triplet?


[VMS/committed]: Add -mpointer-size switch

2012-03-12 Thread Tristan Gingold
Hi,

Now that '#pragma pointer_size' is supported by GCC for VMS, we can add the 
'-mpointer-size' switch (modeled on /POINTER_SIZE=xx DEC-C qualifier) to set 
the default pointer size.  This also makes alpha64-dec-*vms* target obsolete 
(but still supported by alpha*-dec-*vms*).
The patch has many chunks to adjust ™ declarations.  Documentation will follow.

Tested by build gcc, committed on trunk.

Tristan.

2012-03-12  Tristan Gingold  

   * config/vms/vms.opt: Add vms-opts.h header.
   (mmalloc64): Use flag_vms_malloc64 flag instead of MALLOC64
   target mask.
   (-mvms-return-codes): Document.
   (-mpointer-size): New option.
   (vms_pointer_size): Add enumeration.
   * config/vms/vms-opts.h: New file.
   * config/vms/vms.h (TARGET_OS_CPP_BUILTINS): Define
   __INITIAL_POINTER_SIZE.
   (POINTER_SIZE, SIZE_TYPE, PTRDIFF_TYPE): Adjust definition.
   (C_COMMON_OVERRIDE_OPTIONS): Define.
   (DWARF2_ADDR_SIZE): Define.
   * config/vms/vms.c (vms_patch_builtins): Adjust condition.
   * config/vms/vms-protos.h (vms_c_common_override_options):
   New prototype.
   * config/vms/vms-c.c (vms_pragma_pointer_size): Ignore pragma
   if -mno-pointer-size.
   (vms_c_common_override_options): New function.
   * config/ia64/vms.h (TARGET_DEFAULT): Remove MASK_MALLOC64.
   * config/alpha/vms.h (TARGET_DEFAULT): Remove MASK_MALLOC64.
   (MALLOC_ABI_ALIGNMENT): Use flag_vms_malloc64
   and flag_vms_pointer_size.
   (MASK_RETURN_ADDR): Set according to flag_vms_pointer_size.
   * config.gcc (*-*-*vms*): Define xm_file.
   (alpha*-dec-*vms*): Do not define xm_file.
   (alpha64-dec-*vms*): Remove.
   (ia64-hp-*vms*): Do not define xm_file.  Simplify tm_file
   and tmake_file.

ada/
2012-03-12  Tristan Gingold  

   * gcc-interface/decl.c (gnat_to_gnu_param): Use flag_vms_malloc64
   instead of TARGET_MALLOC64.
   * gcc-interface/gigi.h (flag_vms_malloc64): Define instead
   of TARGET_MALLOC64.

libgcc/
2012-03-12  Tristan Gingold  

   * config/alpha/t-vms: Define HOST_LIBGCC2_CFLAGS.
   * config/ia64/t-vms: Likewise.

diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 34183ba..120628e 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -5488,7 +5488,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type 
mech,
 
   /* VMS descriptors are themselves passed by reference.  */
   if (mech == By_Short_Descriptor ||
-  (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !TARGET_MALLOC64))
+  (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !flag_vms_malloc64))
 gnu_param_type
   = build_pointer_type (build_vms_descriptor32 (gnu_param_type,
Mechanism (gnat_param),
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
index 5e6495a..f7d787b 100644
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -999,13 +999,11 @@ extern void enumerate_modes (void (*f) (const char *, 
int, int, int, int, int,
intrusive preprocessor directives.  */
 #ifndef TARGET_ABI_OPEN_VMS
 #define TARGET_ABI_OPEN_VMS 0
-#endif
 
-/* VMS macro set by default, when clear forces 32bit mallocs and 32bit
+/* VMS option set by default, when clear forces 32bit mallocs and 32bit
Descriptors. Always used in combination with TARGET_ABI_OPEN_VMS
so no effect on non-VMS systems.  */
-#ifndef TARGET_MALLOC64
-#define TARGET_MALLOC64 0
+#define flag_vms_malloc64 0
 #endif
 
 /* Convenient shortcuts.  */
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 99f0b47..053f6ec 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -735,6 +735,7 @@ case ${target} in
   extra_objs="vms.o"
   target_gtfiles="$target_gtfiles \$(srcdir)/config/vms/vms.c"
   tm_p_file="${tm_p_file} vms/vms-protos.h"
+  xm_file="vms/xm-vms.h"
   c_target_objs="vms-c.o"
   cxx_target_objs="vms-c.o"
   if test x$gnu_ld != xyes; then
@@ -809,14 +810,8 @@ alpha*-dec-osf5.1*)
;;
esac
;;
-alpha64-dec-*vms*)
-   tm_file="${tm_file} vms/vms.h vms/vms64.h alpha/vms.h"
-   xm_file="alpha/xm-vms.h vms/xm-vms64.h"
-   tmake_file="${tmake_file} vms/t-vms64 alpha/t-vms"
-   ;;
 alpha*-dec-*vms*)
tm_file="${tm_file} vms/vms.h alpha/vms.h"
-   xm_file="alpha/xm-vms.h"
tmake_file="${tmake_file} alpha/t-vms"
;;
 arm-wrs-vxworks)
@@ -1554,9 +1549,8 @@ ia64*-*-hpux*)
esac
;;
 ia64-hp-*vms*)
-   tm_file="${tm_file} elfos.h ia64/sysv4.h ia64/elf.h vms/vms.h 
vms/vms64.h ia64/vms.h"
-   xm_file="vms/xm-vms.h vms/xm-vms64.h"
-   tmake_file="${tmake_file} vms/t-vms64 ia64/t-ia64"
+   tm_file="${tm_file} elfos.h ia64/sysv4.h vms/vms.h ia64/vms.h"
+   tmake_file="${tmake_file} ia64/t-ia64"
target_cpu_default="0"
if test x$gas = xyes
then
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha