From c62a1b1ec756cc3ac66631b12b230d6472929a7b Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 20 Mar 2013 10:24:59 +0100 Subject: [PATCH] i-fortra.ads: Update comment... 2013-03-20 Tobias Burnus * i-fortra.ads: Update comment, add Ada 2012's optional Star and Kind data types for enhanced interoperability. From-SVN: r196814 --- gcc/ada/ChangeLog | 5 ++++ gcc/ada/i-fortra.ads | 64 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index fb2ca01de45..3ec3e291cae 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2013-03-20 Tobias Burnus + + * i-fortra.ads: Update comment, add Ada 2012's optional + Star and Kind data types for enhanced interoperability. + 2013-03-16 Eric Botcazou * gnatvsn.ads (Library_Version): Bump to 4.9. diff --git a/gcc/ada/i-fortra.ads b/gcc/ada/i-fortra.ads index 992eb28634c..0946e49a7e3 100644 --- a/gcc/ada/i-fortra.ads +++ b/gcc/ada/i-fortra.ads @@ -26,11 +26,11 @@ package Interfaces.Fortran is type Logical is new Boolean; for Logical'Size use Integer'Size; pragma Convention (Fortran, Logical); - -- As required by Fortran standard, stand alone logical allocates same - -- space as integer (but what about the array case???). The convention - -- is important, since in Fortran, Booleans have zero/non-zero semantics - -- for False/True, and the pragma Convention (Fortran) activates the - -- special handling required in this case. + -- As required by Fortran standard, logical allocates same space as + -- an integer. The convention is important, since in Fortran, Booleans + -- are implemented with zero/non-zero semantics for False/True, and the + -- pragma Convention (Fortran) activates the special handling required + -- in this case. package Single_Precision_Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real); @@ -50,6 +50,60 @@ package Interfaces.Fortran is type Fortran_Character is array (Positive range <>) of Character_Set; + -- Additional declarations as permitted by Ada 2012, p.608, paragraph 21. + -- Interoperability with Fortran 77's vendor extension using star + -- notation and Fortran 90's intrinsic types with kind=n parameter. + -- The following assumes that `n' matches the byte size, which + -- most Fortran compiler, including GCC's follow. + + type Integer_Star_1 is new Integer_8; + type Integer_Kind_1 is new Integer_8; + type Integer_Star_2 is new Integer_16; + type Integer_Kind_2 is new Integer_16; + type Integer_Star_4 is new Integer_32; + type Integer_Kind_4 is new Integer_32; + type Integer_Star_8 is new Integer_64; + type Integer_Kind_8 is new Integer_64; + + type Logical_Star_1 is new Boolean; + type Logical_Star_2 is new Boolean; + type Logical_Star_4 is new Boolean; + type Logical_Star_8 is new Boolean; + type Logical_Kind_1 is new Boolean; + type Logical_Kind_2 is new Boolean; + type Logical_Kind_4 is new Boolean; + type Logical_Kind_8 is new Boolean; + for Logical_Star_1'Size use Integer_8'Size; + for Logical_Star_2'Size use Integer_16'Size; + for Logical_Star_4'Size use Integer_32'Size; + for Logical_Star_8'Size use Integer_64'Size; + for Logical_Kind_1'Size use Integer_8'Size; + for Logical_Kind_2'Size use Integer_16'Size; + for Logical_Kind_4'Size use Integer_32'Size; + for Logical_Kind_8'Size use Integer_64'Size; + pragma Convention (Fortran, Logical_Star_1); + pragma Convention (Fortran, Logical_Star_2); + pragma Convention (Fortran, Logical_Star_4); + pragma Convention (Fortran, Logical_Star_8); + pragma Convention (Fortran, Logical_Kind_1); + pragma Convention (Fortran, Logical_Kind_2); + pragma Convention (Fortran, Logical_Kind_4); + pragma Convention (Fortran, Logical_Kind_8); + + type Real_Star_4 is new Float; + type Real_Kind_4 is new Float; + type Real_Star_8 is new Long_Float; + type Real_Kind_8 is new Long_Float; + + -- In the kind syntax, n is the same as the associated real kind. + -- In the star syntax, n is twice as large (real+imaginary size) + type Complex_Star_8 is new Complex; + type Complex_Kind_4 is new Complex; + type Complex_Star_16 is new Double_Complex; + type Complex_Kind_8 is new Double_Complex; + + type Character_Kind_n is new Fortran_Character; + function To_Fortran (Item : Character) return Character_Set; function To_Ada (Item : Character_Set) return Character;