aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/switch-c.adb
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-12-05 12:12:22 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-12-05 12:12:22 +0000
commit967947ed6b3b9e1b3723b2587feccb4dac47715e (patch)
treefca443d4dc9d36a11449dda831a8b95f2b870dbe /gcc/ada/switch-c.adb
parent6cbd45e40605d0f77cdc4d31f5b80c1e3d656055 (diff)
downloadgcc-967947ed6b3b9e1b3723b2587feccb4dac47715e.zip
gcc-967947ed6b3b9e1b3723b2587feccb4dac47715e.tar.gz
gcc-967947ed6b3b9e1b3723b2587feccb4dac47715e.tar.bz2
[multiple changes]
2017-12-05 Olivier Hainque <hainque@adacore.com> * s-dwalin.adb (Read_And_Execute_Isn): Adjust test checking for the end of section. Add comments explaining the rationale of the computation. 2017-12-05 Bob Duff <duff@adacore.com> * exp_ch11.adb: Minor refactoring. 2017-12-05 Hristian Kirtchev <kirtchev@adacore.com> * debug.adb: Add debug switches d_a, d_e, and d_p, along with documentation. (Set_Underscored_Debug_Flag): New routine. * debug.ads: Add the flags for all underscore switches. (Set_Underscored_Debug_Flag): New routine. * einfo.adb: Flag303 is now Suppress_Elaboration_Warnings. (Suppress_Elaboration_Warnings): New routine. (Set_Suppress_Elaboration_Warnings): New routine. (Write_Entity_Flags): Add output for Suppress_Elaboration_Warnings. * einfo.ads: Add new flag Suppress_Elaboration_Warnings. (Suppress_Elaboration_Warnings): New routine along with pragma Inline. (Set_Suppress_Elaboration_Warnings): New routine along with pragma Inline. * exp_ch3.adb (Build_Init_Procedure): Restore the behavior of the legacy elaboration model. (Default_Initialize_Object): Restore the behavior of the legacy elaboration model. * exp_ch9.adb: Add with and use clause for Sem_Elab. (Build_Task_Activation_Call): Restore the behavior of the legacy elaboration model. * frontend.adb (Frontend): Restore the behavior of the legacy elaboration model. * opt.ads: Add new flags Legacy_Elaboration_Checks and Relaxed_Elaboration_Checks, along with documentation. * sem_attr.adb (Analyze_Access_Attribute): Restore the behavior of the legacy elaboration model. * sem_ch5.adb (Analyze_Assignment): Restore the behavior of the legacy elaboration model. * sem_ch7.adb (Analyze_Package_Declaration): Restore the behavior of the legacy elaboration model. * sem_ch8.adb (Attribute_Renaming): Restore the behavior of the legacy elaboration model. * sem_ch12.adb (Analyze_Instance_And_Renamings): Restore the behavior of the legacy elaboration model. (Analyze_Package_Instantiation): Restore the behavior of the legacy elaboration model. (Analyze_Subprogram_Instantiation): Restore the behavior of the legacy elaboration model. * sem_elab.adb: Update the documentation of the Processing phase. Update the documentation on elaboration-related compilation switches. Update the documentation on adding a new target. Add Processing_Attributes which represent the state of the Processing phase. Resurrect the previous elaboration model as "legacy elaboration model". (Build_Call_Marker): This routine does not function when the legacy elaboration model is in effect. Do not consider entry calls and requeue statements when debug flag d_e is in effect. Do not consider calls to subprograms which verify the runtime semantics of certain assertion pragmas when debug flag d_p is in effect. (Build_Variable_Reference_Marker): This routine does not function when the legacy elaboration model is in effect. (Check_Elaboration_Scenarios): This routine does not function when the legacy elaboration model is in effect. (Ensure_Prior_Elaboration): The various flags have now been replaced with a state. Do not generate implicit Elaborate[_All] pragmas when their creation has been suppressed. (Ensure_Prior_Elaboration_Static): The with clause is marked based on the requested pragma, not on the nature of the scenario. (In_External_Context): Removed. (Is_Assertion_Pragma_Target): New routine. (Is_Potential_Scenario): Stop the traversal of a task body when reaching an accept or select statement, and debug switch d_a is in effect. (Kill_Elaboration_Scenario): This routine does not function when the legacy elaboration model is in effect. (Process_Activation_Generic): The various flags have now been replaced with a state. (Process_Conditional_ABE): The various flags have now been replaced with a state. (Process_Conditional_ABE_Access): The various flags have now been replaced with a state. (Process_Conditional_ABE_Activation_Impl): The various flags have now been replaced with a state. Do not process an activation call which activates a task whose type is defined in an external instance, and debug switch dL is in effect. Suppress the generation of implicit Elaborate[_All] pragmas once a conditional ABE check has been installed. (Process_Conditional_ABE_Call): The various flags have now been replaced with a state. Do not process a call which invokes a subprogram defined in an external instance, and debug switch dL is in effect. (Process_Conditional_ABE_Call_Ada): The various flags have now been replaced with a state. Suppress the generation of implicit Elaborate[_All] pragmas once a conditional ABE check has been installed. (Process_Conditional_ABE_Call_SPARK): The various flags have now been replaced with a state. (Process_Conditional_ABE_Instantiation): The various flags have now been replaced with a state. (Process_Conditional_ABE_Instantiation_Ada): The various flags have now been replaced with a state. Suppress the generation of implicit Elaborate[_All] pragmas once a conditional ABE check has been installed. (Process_Conditional_ABE_Instantiation_SPARK): The various flags have now been replaced with a state. (Process_Guaranteed_ABE_Activation_Impl): The various flags have now been replaced with a state. (Process_Single_Activation): The various flags have now been replaced with a state. (Record_Elaboration_Scenario): This routine does not function when the legacy elaboration model is in effect. (Traverse_Body): The various flags have now been replaced with a state. * sem_elab.ads: Resurrect the pre-18.x elaboration model as "legacy elaboration model". * sem_prag.adb (Analyze_Pragma): Restore the behavior of the legacy elaboration model. * sem_res.adb (Resolve_Call): Restore the behavior of the legacy elaboration model. (Resolve_Entity_Name): Restore the behavior of the legacy elaboration model. * sem_util.adb (Mark_Elaboration_Attributes): This routine does not function when the legacy elaboration model is in effect. * sinfo.adb (Is_Known_Guaranteed_ABE): Update the assertion check. (No_Elaboration_Check): New routine. (Set_Is_Known_Guaranteed_ABE): Update the assertion check. (Set_No_Elaboration_Check): New routine. * sinfo.ads: Update the documentation of flag Is_Known_Guaranteed_ABE along with occurrences in nodes. Add new flag No_Elaboration_Check along with occurrences in nodes. * switch-c.adb (Scan_Front_End_Switches): Add processing for debug switches with underscores. Add processing for switches -gnatH and -gnatJ. * usage.adb (Usage): Add output for switches -gnatH and -gnatJ. * doc/gnat_ugn/elaboration_order_handling_in_gnat.rst: Update the documentation to include the legacy and relaxed elaboration models. * gnat_ugn.texi: Regenerate. 2017-12-05 Arnaud Charlet <charlet@adacore.com> * doc/gnat_ugn/platform_specific_information.rst: Minor edit. Improve doc on required packages for linux 32bits. 2017-12-05 Doug Rupp <rupp@adacore.com> * tracebak.c (ppc64-vx7): USE_GCC_UNWINDER for 64bit. 2017-12-05 Javier Miranda <miranda@adacore.com> * checks.adb (Generate_Range_Check): Force evaluation of the node in more cases. This patch was written to improve the code generated by the CCG compiler but it is enabled for all targets since double evaluation is always a potential source of inefficiency. 2017-12-05 Gary Dismukes <dismukes@adacore.com> * doc/gnat_ugn/gnat_utility_programs.rst: Remove reference to obsolete -fdump-xref switch. From-SVN: r255412
Diffstat (limited to 'gcc/ada/switch-c.adb')
-rw-r--r--gcc/ada/switch-c.adb96
1 files changed, 81 insertions, 15 deletions
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index c1ff88d..c6ba979 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -131,13 +131,22 @@ package body Switch.C is
Args : String_List;
Arg_Rank : Positive)
is
- First_Switch : Boolean := True;
- -- False for all but first switch
-
Max : constant Natural := Switch_Chars'Last;
- Ptr : Natural;
C : Character := ' ';
+ Ptr : Natural;
+
Dot : Boolean;
+ -- This flag is set upon encountering a dot in a debug switch
+
+ First_Char : Positive;
+ -- Marks start of switch to be stored
+
+ First_Ptr : Positive;
+ -- Save position of first character after -gnatd (for checking that
+ -- debug flags that must come first are first, in particular -gnatd.b).
+
+ First_Switch : Boolean := True;
+ -- False for all but first switch
Store_Switch : Boolean;
-- For -gnatxx switches, the normal processing, signalled by this flag
@@ -148,12 +157,8 @@ package body Switch.C is
-- appropriate calls to Store_Compilation_Switch are made from within
-- the case branch.
- First_Char : Positive;
- -- Marks start of switch to be stored
-
- First_Ptr : Positive;
- -- Save position of first character after -gnatd (for checking that
- -- debug flags that must come first are first, in particular -gnatd.b),
+ Underscore : Boolean;
+ -- This flag is set upon encountering an underscode in a debug switch
begin
Ptr := Switch_Chars'First;
@@ -342,8 +347,10 @@ package body Switch.C is
-- -gnatd (compiler debug options)
when 'd' =>
+ Dot := False;
Store_Switch := False;
- Dot := False;
+ Underscore := False;
+
First_Ptr := Ptr + 1;
-- Note: for the debug switch, the remaining characters in this
@@ -374,11 +381,17 @@ package body Switch.C is
or else not First_Switch)
then
Osint.Fail
- ("-gnatd.b must be first if combined "
- & "with other switches");
+ ("-gnatd.b must be first if combined with other "
+ & "switches");
end if;
- -- Not a dotted flag
+ -- Case of an underscored flag
+
+ elsif Underscore then
+ Set_Underscored_Debug_Flag (C);
+ Store_Compilation_Switch ("-gnatd_" & C);
+
+ -- Normal flag
else
Set_Debug_Flag (C);
@@ -388,8 +401,15 @@ package body Switch.C is
elsif C = '.' then
Dot := True;
+ elsif C = '_' then
+ Underscore := True;
+
elsif Dot then
Bad_Switch ("-gnatd." & Switch_Chars (Ptr .. Max));
+
+ elsif Underscore then
+ Bad_Switch ("-gnatd_" & Switch_Chars (Ptr .. Max));
+
else
Bad_Switch ("-gnatd" & Switch_Chars (Ptr .. Max));
end if;
@@ -879,6 +899,12 @@ package body Switch.C is
Ptr := Ptr + 1;
Usage_Requested := True;
+ -- -gnatH (legacy static elaboration checking mode enabled)
+
+ when 'H' =>
+ Ptr := Ptr + 1;
+ Legacy_Elaboration_Checks := True;
+
-- -gnati (character set)
when 'i' =>
@@ -916,6 +942,46 @@ package body Switch.C is
Ptr := Ptr + 1;
Scan_Nat (Switch_Chars, Max, Ptr, Error_Msg_Line_Length, C);
+ -- -gnatJ (relaxed elaboration checking mode enabled)
+
+ when 'J' =>
+ Ptr := Ptr + 1;
+ Relaxed_Elaboration_Checks := True;
+
+ -- Common relaxations for both ABE mechanisms
+ --
+ -- -gnatd.G (ignore calls through generic formal parameters for
+ -- elaboration)
+ -- -gnatd.U (ignore indirect calls for static elaboration)
+ -- -gnatd.y (disable implicit pragma Elaborate_All on task
+ -- bodies)
+
+ Debug_Flag_Dot_GG := True;
+ Debug_Flag_Dot_UU := True;
+ Debug_Flag_Dot_Y := True;
+
+ -- Relaxatons to the legacy ABE mechanism
+
+ if Legacy_Elaboration_Checks then
+ null;
+
+ -- Relaxations to the default ABE mechanism
+ --
+ -- -gnatd_a (stop elaboration checks on accept or select
+ -- statement)
+ -- -gnatd_e (ignore entry calls and requeue statements for
+ -- elaboration)
+ -- -gnatd_p (ignore assertion pragmas for elaboration)
+ -- -gnatdL (ignore activations and calls to instances for
+ -- elaboration)
+
+ else
+ Debug_Flag_Underscore_A := True;
+ Debug_Flag_Underscore_E := True;
+ Debug_Flag_Underscore_P := True;
+ Debug_Flag_LL := True;
+ end if;
+
-- -gnatk (limit file name length)
when 'k' =>
@@ -1267,7 +1333,7 @@ package body Switch.C is
Bad_Switch ("-gnatw_" & Switch_Chars (Ptr .. Max));
end if;
- -- Normal case, no dot
+ -- Normal case
else
if Set_Warning_Switch (C) then