| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT COMPILER COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- F R O N T E N D -- |
| 6 |
-- -- |
| 7 |
-- B o d y -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 1992-2025, Free Software Foundation, Inc. -- |
| 10 |
-- -- |
| 11 |
-- GNAT is free software; you can redistribute it and/or modify it under -- |
| 12 |
-- terms of the GNU General Public License as published by the Free Soft- -- |
| 13 |
-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 14 |
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
| 15 |
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
| 16 |
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- |
| 17 |
-- for more details. You should have received a copy of the GNU General -- |
| 18 |
-- Public License distributed with GNAT; see file COPYING3. If not, go to -- |
| 19 |
-- http://www.gnu.org/licenses for a complete copy of the license. -- |
| 20 |
-- -- |
| 21 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 22 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 23 |
-- -- |
| 24 |
------------------------------------------------------------------------------ |
| 25 |
|
| 26 |
with System.Strings; use System.Strings; |
| 27 |
|
| 28 |
with Atree; use Atree; |
| 29 |
with Checks; |
| 30 |
with CStand; |
| 31 |
with Debug; use Debug; |
| 32 |
with Elists; |
| 33 |
with Exp_Ch6; |
| 34 |
with Exp_Dbug; |
| 35 |
with Exp_Unst; |
| 36 |
with Fmap; |
| 37 |
with Fname.UF; |
| 38 |
with Ghost; use Ghost; |
| 39 |
with Inline; use Inline; |
| 40 |
with Lib; use Lib; |
| 41 |
with Lib.Load; use Lib.Load; |
| 42 |
with Live; use Live; |
| 43 |
with Namet; use Namet; |
| 44 |
with Nlists; use Nlists; |
| 45 |
with Opt; use Opt; |
| 46 |
with Osint; |
| 47 |
with Par; |
| 48 |
with Prep; |
| 49 |
with Prepcomp; |
| 50 |
with Restrict; use Restrict; |
| 51 |
with Rident; use Rident; |
| 52 |
with Rtsfind; |
| 53 |
with Snames; use Snames; |
| 54 |
with Sprint; |
| 55 |
with Scn; use Scn; |
| 56 |
with Sem; use Sem; |
| 57 |
with Sem_Aux; |
| 58 |
with Sem_Ch8; |
| 59 |
with Sem_SCIL; |
| 60 |
with Sem_Elab; use Sem_Elab; |
| 61 |
with Sem_Prag; use Sem_Prag; |
| 62 |
with Sem_Warn; |
| 63 |
with Sinfo; use Sinfo; |
| 64 |
with Sinfo.Nodes; use Sinfo.Nodes; |
| 65 |
with Sinfo.Utils; use Sinfo.Utils; |
| 66 |
with Sinput; use Sinput; |
| 67 |
with Sinput.L; use Sinput.L; |
| 68 |
with SCIL_LL; |
| 69 |
with Tbuild; use Tbuild; |
| 70 |
with Types; use Types; |
| 71 |
with VAST; |
| 72 |
with Warnsw; use Warnsw; |
| 73 |
|
| 74 |
procedure Frontend is |
| 75 |
begin |
| 76 |
-- Carry out package initializations. These are initializations which might |
| 77 |
-- logically be performed at elaboration time, were it not for the fact |
| 78 |
-- that we may be doing things more than once in the big loop over files. |
| 79 |
-- Like elaboration, the order in which these calls are made is in some |
| 80 |
-- cases important. For example, Lib cannot be initialized before Namet, |
| 81 |
-- since it uses names table entries. |
| 82 |
|
| 83 |
Rtsfind.Initialize; |
| 84 |
Nlists.Initialize; |
| 85 |
Elists.Initialize; |
| 86 |
Lib.Load.Initialize; |
| 87 |
Sem_Aux.Initialize; |
| 88 |
Sem_Ch8.Initialize; |
| 89 |
Sem_Prag.Initialize; |
| 90 |
Fname.UF.Initialize; |
| 91 |
Checks.Initialize; |
| 92 |
Sem_Warn.Initialize; |
| 93 |
Prep.Initialize; |
| 94 |
Sem_Elab.Initialize; |
| 95 |
|
| 96 |
if Generate_SCIL then |
| 97 |
SCIL_LL.Initialize; |
| 98 |
end if; |
| 99 |
|
| 100 |
-- Create package Standard |
| 101 |
|
| 102 |
CStand.Create_Standard; |
| 103 |
|
| 104 |
-- Check possible symbol definitions specified by -gnateD switches |
| 105 |
|
| 106 |
Prepcomp.Process_Command_Line_Symbol_Definitions; |
| 107 |
|
| 108 |
-- If -gnatep= was specified, parse the preprocessing data file |
| 109 |
|
| 110 |
if Preprocessing_Data_File /= null then |
| 111 |
Name_Len := Preprocessing_Data_File'Length; |
| 112 |
Name_Buffer (1 .. Name_Len) := Preprocessing_Data_File.all; |
| 113 |
Prepcomp.Parse_Preprocessing_Data_File (Name_Find); |
| 114 |
|
| 115 |
-- Otherwise, check if there were preprocessing symbols on the command |
| 116 |
-- line and set preprocessing if there are. |
| 117 |
|
| 118 |
else |
| 119 |
Prepcomp.Check_Symbols; |
| 120 |
end if; |
| 121 |
|
| 122 |
-- We set Parsing_Main_Extended_Source true here to cover processing of all |
| 123 |
-- the configuration pragma files, as well as the main source unit itself. |
| 124 |
|
| 125 |
Parsing_Main_Extended_Source := True; |
| 126 |
|
| 127 |
-- Now that the preprocessing situation is established, we are able to |
| 128 |
-- load the main source (this is no longer done by Lib.Load.Initialize). |
| 129 |
|
| 130 |
Lib.Load.Load_Main_Source; |
| 131 |
|
| 132 |
-- Return immediately if the main source could not be found |
| 133 |
|
| 134 |
if Sinput.Main_Source_File <= No_Source_File then |
| 135 |
return; |
| 136 |
end if; |
| 137 |
|
| 138 |
-- Read and process configuration pragma files if present |
| 139 |
|
| 140 |
declare |
| 141 |
Dot_Gnat_Adc : constant File_Name_Type := Name_Find ("./gnat.adc"); |
| 142 |
Gnat_Adc : constant File_Name_Type := Name_Find ("gnat.adc"); |
| 143 |
|
| 144 |
Save_Style_Check : constant Boolean := Opt.Style_Check; |
| 145 |
-- Save style check mode so it can be restored later |
| 146 |
|
| 147 |
Config_Pragmas : List_Id := Empty_List; |
| 148 |
-- Gather configuration pragmas |
| 149 |
|
| 150 |
Source_Config_File : Source_File_Index; |
| 151 |
-- Source reference for -gnatec configuration file |
| 152 |
|
| 153 |
Prag : Node_Id; |
| 154 |
|
| 155 |
begin |
| 156 |
-- We always analyze config files with style checks off, since we |
| 157 |
-- don't want a miscellaneous gnat.adc that is around to discombobulate |
| 158 |
-- intended -gnatg or -gnaty compilations. We also disconnect checking |
| 159 |
-- for maximum line length. |
| 160 |
|
| 161 |
Style_Check := False; |
| 162 |
|
| 163 |
-- Capture current suppress options, which may get modified |
| 164 |
|
| 165 |
Scope_Suppress := Opt.Suppress_Options; |
| 166 |
|
| 167 |
-- First deal with gnat.adc file |
| 168 |
|
| 169 |
if Opt.Config_File then |
| 170 |
Source_gnat_adc := Load_Config_File (Gnat_Adc); |
| 171 |
|
| 172 |
-- Case of gnat.adc file present |
| 173 |
|
| 174 |
if Source_gnat_adc > No_Source_File then |
| 175 |
|
| 176 |
-- Parse the gnat.adc file for configuration pragmas |
| 177 |
|
| 178 |
Initialize_Scanner (No_Unit, Source_gnat_adc); |
| 179 |
Config_Pragmas := Par (Configuration_Pragmas => True); |
| 180 |
|
| 181 |
-- We add a compilation dependency for gnat.adc so that if it |
| 182 |
-- changes, we force a recompilation. |
| 183 |
|
| 184 |
Prepcomp.Add_Dependency (Source_gnat_adc); |
| 185 |
end if; |
| 186 |
end if; |
| 187 |
|
| 188 |
-- Now deal with specified config pragmas files if there are any |
| 189 |
|
| 190 |
if Opt.Config_File_Names /= null then |
| 191 |
|
| 192 |
-- Loop through config pragmas files |
| 193 |
|
| 194 |
for Index in Opt.Config_File_Names'Range loop |
| 195 |
declare |
| 196 |
Len : constant Natural := Config_File_Names (Index)'Length; |
| 197 |
Str : constant String (1 .. Len) := |
| 198 |
Config_File_Names (Index).all; |
| 199 |
|
| 200 |
Config_Name : constant File_Name_Type := Name_Find (Str); |
| 201 |
Temp_File : constant Boolean := |
| 202 |
Len > 4 |
| 203 |
and then |
| 204 |
(Str (Len - 3 .. Len) = ".TMP" |
| 205 |
or else |
| 206 |
Str (Len - 3 .. Len) = ".tmp"); |
| 207 |
-- Extension indicating a temporary config file? |
| 208 |
|
| 209 |
begin |
| 210 |
-- Skip it if it's the default name, already loaded above. |
| 211 |
-- Otherwise, we get confusing warning messages about seeing |
| 212 |
-- the same thing twice. |
| 213 |
|
| 214 |
if Config_Name /= Gnat_Adc |
| 215 |
and then Config_Name /= Dot_Gnat_Adc |
| 216 |
then |
| 217 |
-- Load the file, error if we did not find it |
| 218 |
|
| 219 |
Source_Config_File := Load_Config_File (Config_Name); |
| 220 |
|
| 221 |
if Source_Config_File <= No_Source_File then |
| 222 |
Osint.Fail |
| 223 |
("cannot find configuration pragmas file " |
| 224 |
& Config_File_Names (Index).all); |
| 225 |
|
| 226 |
-- If we did find the file, and it is not a temporary file, |
| 227 |
-- then we add a compilation dependency for it so that if it |
| 228 |
-- changes, we force a recompilation. |
| 229 |
|
| 230 |
elsif not Temp_File then |
| 231 |
Prepcomp.Add_Dependency (Source_Config_File); |
| 232 |
end if; |
| 233 |
|
| 234 |
-- Parse the config pragmas file, and accumulate results |
| 235 |
|
| 236 |
Initialize_Scanner (No_Unit, Source_Config_File); |
| 237 |
Append_List_To |
| 238 |
(Config_Pragmas, Par (Configuration_Pragmas => True)); |
| 239 |
end if; |
| 240 |
end; |
| 241 |
end loop; |
| 242 |
end if; |
| 243 |
|
| 244 |
-- Now analyze all pragmas except those whose analysis must be |
| 245 |
-- deferred till after the main unit is analyzed. |
| 246 |
|
| 247 |
if Config_Pragmas /= Error_List |
| 248 |
and then Operating_Mode /= Check_Syntax |
| 249 |
then |
| 250 |
Prag := First (Config_Pragmas); |
| 251 |
while Present (Prag) loop |
| 252 |
if not Delay_Config_Pragma_Analyze (Prag) then |
| 253 |
Analyze_Pragma (Prag); |
| 254 |
end if; |
| 255 |
|
| 256 |
Next (Prag); |
| 257 |
end loop; |
| 258 |
end if; |
| 259 |
|
| 260 |
-- Restore style check, but if config file turned on checks, leave on |
| 261 |
|
| 262 |
Opt.Style_Check := Save_Style_Check or Style_Check; |
| 263 |
|
| 264 |
-- Capture any modifications to suppress options from config pragmas |
| 265 |
|
| 266 |
Opt.Suppress_Options := Scope_Suppress; |
| 267 |
|
| 268 |
-- If a target dependency info file has been read through switch |
| 269 |
-- -gnateT=, add it to the dependencies. |
| 270 |
|
| 271 |
if Target_Dependent_Info_Read_Name /= null then |
| 272 |
declare |
| 273 |
Index : Source_File_Index; |
| 274 |
begin |
| 275 |
Name_Len := 0; |
| 276 |
Add_Str_To_Name_Buffer (Target_Dependent_Info_Read_Name.all); |
| 277 |
Index := Load_Config_File (Name_Enter); |
| 278 |
Prepcomp.Add_Dependency (Index); |
| 279 |
end; |
| 280 |
end if; |
| 281 |
|
| 282 |
-- This is where we can capture the value of the compilation unit |
| 283 |
-- specific restrictions that have been set by the config pragma |
| 284 |
-- files (or from Targparm), for later restoration when processing |
| 285 |
-- e.g. subunits. |
| 286 |
|
| 287 |
Save_Config_Cunit_Boolean_Restrictions; |
| 288 |
|
| 289 |
-- Adjust Optimize_Alignment mode from debug switches if necessary |
| 290 |
|
| 291 |
if Debug_Flag_Dot_SS then |
| 292 |
Optimize_Alignment := 'S'; |
| 293 |
elsif Debug_Flag_Dot_TT then |
| 294 |
Optimize_Alignment := 'T'; |
| 295 |
end if; |
| 296 |
|
| 297 |
-- We have now processed the command line switches, and the |
| 298 |
-- configuration pragma files, so this is the point at which we want to |
| 299 |
-- capture the values of the configuration switches (see Opt for further |
| 300 |
-- details). |
| 301 |
|
| 302 |
Register_Config_Switches; |
| 303 |
|
| 304 |
-- Check for file which contains No_Body pragma |
| 305 |
|
| 306 |
if Source_File_Is_No_Body (Source_Index (Main_Unit)) then |
| 307 |
Change_Main_Unit_To_Spec; |
| 308 |
end if; |
| 309 |
|
| 310 |
-- Initialize the scanner. Note that we do this after the call to |
| 311 |
-- Create_Standard, which uses the scanner in its processing of |
| 312 |
-- floating-point bounds. |
| 313 |
|
| 314 |
Initialize_Scanner (Main_Unit, Source_Index (Main_Unit)); |
| 315 |
|
| 316 |
-- Here we call the parser to parse the compilation unit (or units in |
| 317 |
-- the check syntax mode, but in that case we won't go on to the |
| 318 |
-- semantics in any case). |
| 319 |
|
| 320 |
Discard_List (Par (Configuration_Pragmas => False)); |
| 321 |
Parsing_Main_Extended_Source := False; |
| 322 |
|
| 323 |
-- The main unit is now loaded, and subunits of it can be loaded, |
| 324 |
-- without reporting spurious loading circularities. |
| 325 |
|
| 326 |
Set_Loading (Main_Unit, False); |
| 327 |
|
| 328 |
-- Now that the main unit is installed, we can complete the analysis |
| 329 |
-- of the pragmas in gnat.adc and the configuration file, that require |
| 330 |
-- a context for their semantic processing. |
| 331 |
|
| 332 |
if Config_Pragmas /= Error_List |
| 333 |
and then Operating_Mode /= Check_Syntax |
| 334 |
|
| 335 |
-- Do not attempt to process deferred configuration pragmas if the |
| 336 |
-- main unit failed to load, to avoid cascaded inconsistencies that |
| 337 |
-- can lead to a compiler crash. |
| 338 |
|
| 339 |
and then Fatal_Error (Main_Unit) /= Error_Detected |
| 340 |
then |
| 341 |
-- Pragmas that require some semantic activity, such as |
| 342 |
-- Interrupt_State, cannot be processed until the main unit is |
| 343 |
-- installed, because they require a compilation unit on which to |
| 344 |
-- attach with_clauses, etc. So analyze them now. |
| 345 |
|
| 346 |
declare |
| 347 |
Prag : Node_Id; |
| 348 |
|
| 349 |
begin |
| 350 |
Prag := First (Config_Pragmas); |
| 351 |
while Present (Prag) loop |
| 352 |
|
| 353 |
-- Guard against the case where a configuration pragma may be |
| 354 |
-- split into multiple pragmas and the original rewritten as a |
| 355 |
-- null statement. |
| 356 |
|
| 357 |
if Nkind (Prag) = N_Pragma |
| 358 |
and then Delay_Config_Pragma_Analyze (Prag) |
| 359 |
then |
| 360 |
Analyze_Pragma (Prag); |
| 361 |
end if; |
| 362 |
|
| 363 |
Next (Prag); |
| 364 |
end loop; |
| 365 |
end; |
| 366 |
end if; |
| 367 |
|
| 368 |
-- If we have restriction No_Exception_Propagation, and we did not have |
| 369 |
-- an explicit switch turning off Warn_On_Non_Local_Exception, then turn |
| 370 |
-- on this warning by default if we have encountered an exception |
| 371 |
-- handler. |
| 372 |
|
| 373 |
if Restriction_Check_Required (No_Exception_Propagation) |
| 374 |
and then not No_Warn_On_Non_Local_Exception |
| 375 |
and then Exception_Handler_Encountered |
| 376 |
then |
| 377 |
Warn_On_Non_Local_Exception := True; |
| 378 |
end if; |
| 379 |
|
| 380 |
-- Disable Initialize_Scalars for runtime files to avoid circular |
| 381 |
-- dependencies. |
| 382 |
|
| 383 |
if Initialize_Scalars and then Is_Predefined_Unit (Main_Unit) then |
| 384 |
Initialize_Scalars := False; |
| 385 |
Init_Or_Norm_Scalars := Normalize_Scalars; |
| 386 |
end if; |
| 387 |
|
| 388 |
-- Now on to the semantics. Skip if in syntax only mode |
| 389 |
|
| 390 |
if Operating_Mode /= Check_Syntax then |
| 391 |
|
| 392 |
-- Install the configuration pragmas in the tree |
| 393 |
|
| 394 |
Set_Config_Pragmas |
| 395 |
(Aux_Decls_Node (Cunit (Main_Unit)), Config_Pragmas); |
| 396 |
|
| 397 |
-- Following steps are skipped if we had a fatal error during parsing |
| 398 |
|
| 399 |
if Fatal_Error (Main_Unit) /= Error_Detected then |
| 400 |
|
| 401 |
-- Reset Operating_Mode to Check_Semantics for subunits. We cannot |
| 402 |
-- actually generate code for subunits, so we suppress expansion. |
| 403 |
-- This also corrects certain problems that occur if we try to |
| 404 |
-- incorporate subunits at a lower level. |
| 405 |
|
| 406 |
if Operating_Mode = Generate_Code |
| 407 |
and then Nkind (Unit (Cunit (Main_Unit))) = N_Subunit |
| 408 |
then |
| 409 |
Operating_Mode := Check_Semantics; |
| 410 |
end if; |
| 411 |
|
| 412 |
-- Analyze (and possibly expand) main unit |
| 413 |
|
| 414 |
Scope_Suppress := Suppress_Options; |
| 415 |
Semantics (Cunit (Main_Unit)); |
| 416 |
|
| 417 |
-- Cleanup processing after completing main analysis |
| 418 |
|
| 419 |
pragma Assert (Operating_Mode in Check_Semantics | Generate_Code); |
| 420 |
|
| 421 |
if Operating_Mode = Generate_Code or else GNATprove_Mode then |
| 422 |
|
| 423 |
-- In GNATprove_Mode we do not perform most expansions but body |
| 424 |
-- instantiation is needed. |
| 425 |
|
| 426 |
Instantiate_Bodies; |
| 427 |
|
| 428 |
-- Analyze inlined bodies if required |
| 429 |
|
| 430 |
if Inline_Processing_Required then |
| 431 |
Analyze_Inlined_Bodies; |
| 432 |
end if; |
| 433 |
|
| 434 |
-- Remove entities from program that do not have any execution |
| 435 |
-- time references. |
| 436 |
|
| 437 |
if Debug_Flag_UU then |
| 438 |
Collect_Garbage_Entities; |
| 439 |
end if; |
| 440 |
|
| 441 |
-- Check access-before-elaboration rules |
| 442 |
|
| 443 |
if Legacy_Elaboration_Checks then |
| 444 |
Check_Elab_Calls; |
| 445 |
end if; |
| 446 |
|
| 447 |
-- Examine all top level scenarios collected during analysis |
| 448 |
-- and resolution. Diagnose conditional ABEs, install run-time |
| 449 |
-- checks to catch conditional ABEs, and guarantee the prior |
| 450 |
-- elaboration of external units. |
| 451 |
|
| 452 |
Check_Elaboration_Scenarios; |
| 453 |
|
| 454 |
-- Examine all top level scenarios collected during analysis and |
| 455 |
-- resolution in order to diagnose conditional ABEs, even in the |
| 456 |
-- presence of serious errors. |
| 457 |
|
| 458 |
else |
| 459 |
Check_Elaboration_Scenarios; |
| 460 |
end if; |
| 461 |
|
| 462 |
-- List library units if requested |
| 463 |
|
| 464 |
if List_Units then |
| 465 |
Lib.List; |
| 466 |
end if; |
| 467 |
|
| 468 |
-- Output waiting warning messages |
| 469 |
|
| 470 |
Sem_Warn.Output_Non_Modified_In_Out_Warnings; |
| 471 |
Sem_Warn.Output_Unreferenced_Messages; |
| 472 |
Sem_Warn.Check_Unused_Withs; |
| 473 |
Sem_Warn.Output_Unused_Warnings_Off_Warnings; |
| 474 |
|
| 475 |
-- Remove any ignored Ghost code as it must not appear in the |
| 476 |
-- executable. This action must be performed very late because it |
| 477 |
-- heavily alters the tree. |
| 478 |
|
| 479 |
if Operating_Mode = Generate_Code or else GNATprove_Mode then |
| 480 |
Remove_Ignored_Ghost_Code; |
| 481 |
end if; |
| 482 |
|
| 483 |
-- At this stage we can unnest subprogram bodies if required |
| 484 |
|
| 485 |
if Total_Errors_Detected = 0 then |
| 486 |
Exp_Unst.Unnest_Subprograms (Cunit (Main_Unit)); |
| 487 |
end if; |
| 488 |
|
| 489 |
end if; |
| 490 |
end if; |
| 491 |
end; |
| 492 |
|
| 493 |
-- Qualify all entity names in inner packages, package bodies, etc |
| 494 |
|
| 495 |
if not GNATprove_Mode then |
| 496 |
Exp_Dbug.Qualify_All_Entity_Names; |
| 497 |
end if; |
| 498 |
|
| 499 |
-- SCIL backend requirement. Check that SCIL nodes associated with |
| 500 |
-- dispatching calls reference subprogram calls. |
| 501 |
|
| 502 |
if Generate_SCIL then |
| 503 |
pragma Debug (Sem_SCIL.Check_SCIL_Nodes (Cunit (Main_Unit))); |
| 504 |
null; |
| 505 |
end if; |
| 506 |
|
| 507 |
-- Verify the validity of the tree |
| 508 |
|
| 509 |
if Debug_Flag_Underscore_VV then |
| 510 |
VAST.Check_Tree (Cunit (Main_Unit)); |
| 511 |
end if; |
| 512 |
|
| 513 |
-- Validate all the subprogram calls; this work will be done by VAST; in |
| 514 |
-- the meantime it is done to check extra formals and it can be disabled |
| 515 |
-- using -gnatd_X (which also disables all the other assertions on extra |
| 516 |
-- formals). It is invoked using pragma Debug to avoid adding any cost |
| 517 |
-- when the compiler is built with assertions disabled. |
| 518 |
|
| 519 |
if not Debug_Flag_Underscore_XX then |
| 520 |
pragma Debug (Exp_Ch6.Validate_Subprogram_Calls (Cunit (Main_Unit))); |
| 521 |
end if; |
| 522 |
|
| 523 |
-- Dump the source now. Note that we do this as soon as the analysis |
| 524 |
-- of the tree is complete, because it is not just a dump in the case |
| 525 |
-- of -gnatD, where it rewrites all source locations in the tree. |
| 526 |
|
| 527 |
Sprint.Source_Dump; |
| 528 |
|
| 529 |
-- Check again for configuration pragmas that appear in the context |
| 530 |
-- of the main unit. These pragmas only affect the main unit, and the |
| 531 |
-- corresponding flag is reset after each call to Semantics, but they |
| 532 |
-- may affect the generated ali for the unit, and therefore the flag |
| 533 |
-- must be set properly after compilation. Currently we only check for |
| 534 |
-- Initialize_Scalars, but others should be checked: as well??? |
| 535 |
|
| 536 |
declare |
| 537 |
Item : Node_Id; |
| 538 |
|
| 539 |
begin |
| 540 |
Item := First (Context_Items (Cunit (Main_Unit))); |
| 541 |
while Present (Item) loop |
| 542 |
if Nkind (Item) = N_Pragma |
| 543 |
and then Pragma_Name (Item) = Name_Initialize_Scalars |
| 544 |
then |
| 545 |
Initialize_Scalars := True; |
| 546 |
end if; |
| 547 |
|
| 548 |
Next (Item); |
| 549 |
end loop; |
| 550 |
end; |
| 551 |
|
| 552 |
-- If a mapping file has been specified by a -gnatem switch, update |
| 553 |
-- it if there has been some sources that were not in the mappings. |
| 554 |
|
| 555 |
if Mapping_File_Name /= null then |
| 556 |
Fmap.Update_Mapping_File (Mapping_File_Name.all); |
| 557 |
end if; |
| 558 |
end Frontend; |