This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Detect more cases of Long_Float inconsistencies at compile time


This patch causes more cases of inconsistent use of pragma Long_Float to
be caught at compile time. This gives better messages earlier, and also
avoids some blowups due to inconsistent usage.

The following is pkg1.adb compiled with -gnatdm -gnatld7 -gnatj60

Compiling: pkg1.adb

     1. package body Pkg1 is
     2.    procedure Sep is separate;
     3. end Pkg1;

Compiling: pkg1.ads

     1. package Pkg1 is
     2.    F1 : Float := 12.5;
     3.
     4.    procedure Sep;
     5. end Pkg1;

Compiling: pkg1-sep.adb

     1. with Ada.Text_IO; use Ada.Text_IO;
     2. with T1;
     3.
     4. separate (Pkg1)
     5. procedure Sep is
     6. begin
     7.    Put_Line (Float'Image (T1.F2));
     8. end Sep;
     9.

==============Error messages for source file: t1.ads
     1. pragma Long_Float(G_Float);
                          |
        >>> main unit not compiled with pragma Long_Float
            (G_Float), pragma "Long_Float" must be used
            consistently for whole partition

The source file t1.ads is:

     1. pragma Long_Float(G_Float);
     2.
     3. package T1 is
     4.    subtype F is Float;
     5.
     6.    F2 : F := 4.5;
     7. end T1;

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-11-04  Robert Dewar  <dewar@adacore.com>

	* sem_prag.adb: Detect more cases of Long_Float inconsistencies at
	compile time.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]