comparison gcc/ada/frontend.adb @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
4 -- -- 4 -- --
5 -- F R O N T E N D -- 5 -- F R O N T E N D --
6 -- -- 6 -- --
7 -- B o d y -- 7 -- B o d y --
8 -- -- 8 -- --
9 -- Copyright (C) 1992-2017, Free Software Foundation, Inc. -- 9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
10 -- -- 10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under -- 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- -- 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- -- 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- -- 14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
301 -- We have now processed the command line switches, and the 301 -- We have now processed the command line switches, and the
302 -- configuration pragma files, so this is the point at which we want to 302 -- configuration pragma files, so this is the point at which we want to
303 -- capture the values of the configuration switches (see Opt for further 303 -- capture the values of the configuration switches (see Opt for further
304 -- details). 304 -- details).
305 305
306 Opt.Register_Opt_Config_Switches; 306 Register_Config_Switches;
307 307
308 -- Check for file which contains No_Body pragma 308 -- Check for file which contains No_Body pragma
309 309
310 if Source_File_Is_No_Body (Source_Index (Main_Unit)) then 310 if Source_File_Is_No_Body (Source_Index (Main_Unit)) then
311 Change_Main_Unit_To_Spec; 311 Change_Main_Unit_To_Spec;
438 438
439 if Debug_Flag_UU then 439 if Debug_Flag_UU then
440 Collect_Garbage_Entities; 440 Collect_Garbage_Entities;
441 end if; 441 end if;
442 442
443 if Legacy_Elaboration_Checks then
444 Check_Elab_Calls;
445 end if;
446
443 -- Examine all top level scenarios collected during analysis 447 -- Examine all top level scenarios collected during analysis
444 -- and resolution. Diagnose conditional and guaranteed ABEs, 448 -- and resolution. Diagnose conditional ABEs, install run-time
445 -- install run-time checks to catch ABEs, and guarantee the 449 -- checks to catch conditional ABEs, and guarantee the prior
446 -- prior elaboration of external units. 450 -- elaboration of external units.
447 451
448 Check_Elaboration_Scenarios; 452 Check_Elaboration_Scenarios;
449 453
450 -- Remove any ignored Ghost code as it must not appear in the 454 -- Examine all top level scenarios collected during analysis and
451 -- executable. 455 -- resolution in order to diagnose conditional ABEs, even in the
452 456 -- presence of serious errors.
453 Remove_Ignored_Ghost_Code;
454
455 -- Otherwise check the access-before-elaboration rules even when
456 -- previous errors were detected or the compilation is verifying
457 -- semantics.
458 457
459 else 458 else
460 Check_Elaboration_Scenarios; 459 Check_Elaboration_Scenarios;
461 end if; 460 end if;
462 461
463 -- At this stage we can unnest subprogram bodies if required 462 -- At this stage we can unnest subprogram bodies if required
464 463
465 Exp_Unst.Unnest_Subprograms (Cunit (Main_Unit)); 464 if Total_Errors_Detected = 0 then
465 Exp_Unst.Unnest_Subprograms (Cunit (Main_Unit));
466 end if;
466 467
467 -- List library units if requested 468 -- List library units if requested
468 469
469 if List_Units then 470 if List_Units then
470 Lib.List; 471 Lib.List;
475 Lib.Xref.Process_Deferred_References; 476 Lib.Xref.Process_Deferred_References;
476 Sem_Warn.Output_Non_Modified_In_Out_Warnings; 477 Sem_Warn.Output_Non_Modified_In_Out_Warnings;
477 Sem_Warn.Output_Unreferenced_Messages; 478 Sem_Warn.Output_Unreferenced_Messages;
478 Sem_Warn.Check_Unused_Withs; 479 Sem_Warn.Check_Unused_Withs;
479 Sem_Warn.Output_Unused_Warnings_Off_Warnings; 480 Sem_Warn.Output_Unused_Warnings_Off_Warnings;
481
482 -- Remove any ignored Ghost code as it must not appear in the
483 -- executable. This action must be performed last because it
484 -- heavily alters the tree.
485
486 if Operating_Mode = Generate_Code or else GNATprove_Mode then
487 Remove_Ignored_Ghost_Code;
488 end if;
480 end if; 489 end if;
481 end if; 490 end if;
482 end; 491 end;
483 492
484 -- Qualify all entity names in inner packages, package bodies, etc 493 -- Qualify all entity names in inner packages, package bodies, etc