]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2013-03-20 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Mar 2013 09:24:59 +0000 (09:24 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Mar 2013 09:24:59 +0000 (09:24 +0000)
        * i-fortra.ads: Update comment, add Ada 2012's optional
        Star and Kind data types for enhanced interoperability.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196814 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/i-fortra.ads

index fb2ca01de45c33c8aa2141601bf1869077b70f87..3ec3e291caec0bbee438fdd98f14269b708b3802 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-20  Tobias Burnus  <burnus@net-b.de>
+
+       * i-fortra.ads: Update comment, add Ada 2012's optional
+       Star and Kind data types for enhanced interoperability.
+
 2013-03-16  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnatvsn.ads (Library_Version): Bump to 4.9.
index 992eb28634ceda588e883521fa5c46f29f855fd8..0946e49a7e3cd3d6ced273062c1e03e5e527653e 100644 (file)
@@ -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;