diff options
author | Vincent Celier <celier@adacore.com> | 2010-06-14 09:22:35 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-06-14 11:22:35 +0200 |
commit | 5d993afdcbc8174b8edc27911da2d371838b4c07 (patch) | |
tree | 67bd26981d944dcf47ffdd97d64395c9921ade20 /gcc | |
parent | 49d140bba45474cb8153c4fdc56db0387261d3b1 (diff) | |
download | gcc-5d993afdcbc8174b8edc27911da2d371838b4c07.zip gcc-5d993afdcbc8174b8edc27911da2d371838b4c07.tar.gz gcc-5d993afdcbc8174b8edc27911da2d371838b4c07.tar.bz2 |
gnatbind.adb: Call Scan_ALI with Directly_Scanned set to True for all the ALI files on the...
2010-06-14 Vincent Celier <celier@adacore.com>
* gnatbind.adb: Call Scan_ALI with Directly_Scanned set to True for all
the ALI files on the command line.
* ali.adb (Scan_ALI): Set component Directly_Scanned of the unit(s) to
the same value as the parameter of the same name.
* ali.ads (Scan_ALI): New Boolean parameter Directly_Scanned, defaulted
to False.
* bindgen.adb (Gen_Versions_Ada): Never emit version symbols for
Stand-Alone Library interfaces. When binding Stand-Alone Libraries,
emit version symbols only for the units of the library.
(Gen_Versions_C): Ditto.
From-SVN: r160715
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/ada/ali.adb | 18 | ||||
-rw-r--r-- | gcc/ada/ali.ads | 26 | ||||
-rw-r--r-- | gcc/ada/bindgen.adb | 118 | ||||
-rw-r--r-- | gcc/ada/gnatbind.adb | 11 |
5 files changed, 96 insertions, 91 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 926c7af..5971f4f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2010-06-14 Vincent Celier <celier@adacore.com> + + * gnatbind.adb: Call Scan_ALI with Directly_Scanned set to True for all + the ALI files on the command line. + + * ali.adb (Scan_ALI): Set component Directly_Scanned of the unit(s) to + the same value as the parameter of the same name. + * ali.ads (Scan_ALI): New Boolean parameter Directly_Scanned, defaulted + to False. + * bindgen.adb (Gen_Versions_Ada): Never emit version symbols for + Stand-Alone Library interfaces. When binding Stand-Alone Libraries, + emit version symbols only for the units of the library. + (Gen_Versions_C): Ditto. + 2010-06-14 Gary Dismukes <dismukes@adacore.com> * sem_ch4.adb: Fix typo. diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb index 20438cf..7655dcc 100644 --- a/gcc/ada/ali.adb +++ b/gcc/ada/ali.adb @@ -119,14 +119,15 @@ package body ALI is -------------- function Scan_ALI - (F : File_Name_Type; - T : Text_Buffer_Ptr; - Ignore_ED : Boolean; - Err : Boolean; - Read_Xref : Boolean := False; - Read_Lines : String := ""; - Ignore_Lines : String := "X"; - Ignore_Errors : Boolean := False) return ALI_Id + (F : File_Name_Type; + T : Text_Buffer_Ptr; + Ignore_ED : Boolean; + Err : Boolean; + Read_Xref : Boolean := False; + Read_Lines : String := ""; + Ignore_Lines : String := "X"; + Ignore_Errors : Boolean := False; + Directly_Scanned : Boolean := False) return ALI_Id is P : Text_Ptr := T'First; Line : Logical_Line_Number := 1; @@ -1415,6 +1416,7 @@ package body ALI is UL.First_Arg := First_Arg; UL.Elab_Position := 0; UL.SAL_Interface := ALIs.Table (Id).SAL_Interface; + UL.Directly_Scanned := Directly_Scanned; UL.Body_Needed_For_SAL := False; UL.Elaborate_Body_Desirable := False; UL.Optimize_Alignment := 'O'; diff --git a/gcc/ada/ali.ads b/gcc/ada/ali.ads index 9e8da30..94f7647 100644 --- a/gcc/ada/ali.ads +++ b/gcc/ada/ali.ads @@ -342,6 +342,9 @@ package ALI is SAL_Interface : Boolean; -- Set True when this is an interface to a standalone library + Directly_Scanned : Boolean; + -- True iff it is a unit from an ALI file specified to gnatbind + Body_Needed_For_SAL : Boolean; -- Indicates that the source for the body of the unit (subprogram, -- package, or generic unit) must be included in a standalone library. @@ -933,14 +936,15 @@ package ALI is -- Initialize the ALI tables. Also resets all switch values to defaults function Scan_ALI - (F : File_Name_Type; - T : Text_Buffer_Ptr; - Ignore_ED : Boolean; - Err : Boolean; - Read_Xref : Boolean := False; - Read_Lines : String := ""; - Ignore_Lines : String := "X"; - Ignore_Errors : Boolean := False) return ALI_Id; + (F : File_Name_Type; + T : Text_Buffer_Ptr; + Ignore_ED : Boolean; + Err : Boolean; + Read_Xref : Boolean := False; + Read_Lines : String := ""; + Ignore_Lines : String := "X"; + Ignore_Errors : Boolean := False; + Directly_Scanned : Boolean := False) return ALI_Id; -- Given the text, T, of an ALI file, F, scan and store the information -- from the file, and return the Id of the resulting entry in the ALI -- table. Switch settings may be modified as described above in the @@ -986,5 +990,11 @@ package ALI is -- Scan_ALI was completely unable to process the file (e.g. it did not -- look like an ALI file at all). Ignore_Errors is intended to improve -- the downward compatibility of new compilers with old tools. + -- + -- Directly_Scanned is normally False. If it is set to True, then the + -- units (spec and/or body) corresponding to the ALI file are marked as + -- such. It is used to decide for what units gnatbind should generate + -- the symbols corresponding to 'Version or 'Body_Version in + -- Stand-Alone Libraries. end ALI; diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index 1825861..49179f1 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -2969,12 +2969,9 @@ package body Bindgen is -- Gen_Versions_Ada -- ---------------------- - -- This routine generates two sets of lines. The first set has the form: + -- This routine generates lines such as: -- unnnnn : constant Integer := 16#hhhhhhhh#; - - -- The second set has the form - -- pragma Export (C, unnnnn, unam); -- for each unit, where unam is the unit name suffixed by either B or @@ -2999,57 +2996,44 @@ package body Bindgen is -- Start of processing for Gen_Versions_Ada begin - if Bind_For_Library then - - -- When building libraries, the version number of each unit can - -- not be computed, since the binder does not know the full list - -- of units. Therefore, the 'Version and 'Body_Version - -- attributes cannot supported in this case. - - return; - end if; - WBI (""); WBI (" type Version_32 is mod 2 ** 32;"); for U in Units.First .. Units.Last loop - Increment_Ubuf; - WBI (" " & Ubuf & " : constant Version_32 := 16#" & - Units.Table (U).Version & "#;"); - end loop; - - WBI (""); - Ubuf := "u00000"; + if not Units.Table (U).SAL_Interface and then + ((not Bind_For_Library) or else Units.Table (U).Directly_Scanned) + then + Increment_Ubuf; + WBI (" " & Ubuf & " : constant Version_32 := 16#" & + Units.Table (U).Version & "#;"); + Set_String (" pragma Export (C, "); + Set_String (Ubuf); + Set_String (", """); - for U in Units.First .. Units.Last loop - Increment_Ubuf; - Set_String (" pragma Export (C, "); - Set_String (Ubuf); - Set_String (", """); + Get_Name_String (Units.Table (U).Uname); - Get_Name_String (Units.Table (U).Uname); + for K in 1 .. Name_Len loop + if Name_Buffer (K) = '.' then + Set_Char ('_'); + Set_Char ('_'); - for K in 1 .. Name_Len loop - if Name_Buffer (K) = '.' then - Set_Char ('_'); - Set_Char ('_'); + elsif Name_Buffer (K) = '%' then + exit; - elsif Name_Buffer (K) = '%' then - exit; + else + Set_Char (Name_Buffer (K)); + end if; + end loop; + if Name_Buffer (Name_Len) = 's' then + Set_Char ('S'); else - Set_Char (Name_Buffer (K)); + Set_Char ('B'); end if; - end loop; - if Name_Buffer (Name_Len) = 's' then - Set_Char ('S'); - else - Set_Char ('B'); + Set_String (""");"); + Write_Statement_Buffer; end if; - - Set_String (""");"); - Write_Statement_Buffer; end loop; end Gen_Versions_Ada; @@ -3067,43 +3051,37 @@ package body Bindgen is procedure Gen_Versions_C is begin - if Bind_For_Library then - - -- When building libraries, the version number of each unit can - -- not be computed, since the binder does not know the full list - -- of units. Therefore, the 'Version and 'Body_Version - -- attributes cannot supported. - - return; - end if; - for U in Units.First .. Units.Last loop - Set_String ("unsigned "); + if not Units.Table (U).SAL_Interface and then + ((not Bind_For_Library) or else Units.Table (U).Directly_Scanned) + then + Set_String ("unsigned "); - Get_Name_String (Units.Table (U).Uname); + Get_Name_String (Units.Table (U).Uname); - for K in 1 .. Name_Len loop - if Name_Buffer (K) = '.' then - Set_String ("__"); + for K in 1 .. Name_Len loop + if Name_Buffer (K) = '.' then + Set_String ("__"); - elsif Name_Buffer (K) = '%' then - exit; + elsif Name_Buffer (K) = '%' then + exit; + else + Set_Char (Name_Buffer (K)); + end if; + end loop; + + if Name_Buffer (Name_Len) = 's' then + Set_Char ('S'); else - Set_Char (Name_Buffer (K)); + Set_Char ('B'); end if; - end loop; - if Name_Buffer (Name_Len) = 's' then - Set_Char ('S'); - else - Set_Char ('B'); + Set_String (" = 0x"); + Set_String (Units.Table (U).Version); + Set_Char (';'); + Write_Statement_Buffer; end if; - - Set_String (" = 0x"); - Set_String (Units.Table (U).Version); - Set_Char (';'); - Write_Statement_Buffer; end loop; end Gen_Versions_C; diff --git a/gcc/ada/gnatbind.adb b/gcc/ada/gnatbind.adb index fb3dc3d..11dd9a8 100644 --- a/gcc/ada/gnatbind.adb +++ b/gcc/ada/gnatbind.adb @@ -671,11 +671,12 @@ begin begin Id := Scan_ALI - (F => Main_Lib_File, - T => Text, - Ignore_ED => False, - Err => False, - Ignore_Errors => Debug_Flag_I); + (F => Main_Lib_File, + T => Text, + Ignore_ED => False, + Err => False, + Ignore_Errors => Debug_Flag_I, + Directly_Scanned => True); end; Free (Text); |