]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Configuration state not observed for instance bodies
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Jul 2018 08:11:28 +0000 (08:11 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Jul 2018 08:11:28 +0000 (08:11 +0000)
commitb494437187859fb17867a3750f11050db85b8ff0
tree23ba3b31f1558c7507493b0c189898086dd8d135
parent007213505a98f59c9647a3f91d321d742647cf6d
[Ada] Configuration state not observed for instance bodies

This patch ensures that the processing of instantiated and inlined bodies uses
the proper configuration context available at the point of the instantiation or
inlining.

Previously configuration pragmas which appear prior to the context items of a
unit would lose their effect when a body is instantiated or inlined.

2018-07-17  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* frontend.adb (Frontend): Update the call to Register_Config_Switches.
* inline.ads: Add new component Config_Switches to record
Pending_Body_Info which captures the configuration state of the pending
body.  Remove components Version, Version_Pragma, SPARK_Mode, and
SPARK_Mode_Pragma from record Pending_Body_Info because they are
already captured in component Config_Switches.
* opt.adb (Register_Opt_Config_Switches): Rename to
Register_Config_Switches.
(Restore_Opt_Config_Switches): Rename to Restore_Config_Switches.
(Save_Opt_Config_Switches): Rename to Save_Config_Switches. This
routine is now a function, and returns the saved configuration state as
an aggregate to avoid missing an attribute.
(Set_Opt_Config_Switches): Rename to Set_Config_Switches.
* opt.ads (Register_Opt_Config_Switches): Rename to
Register_Config_Switches.
(Restore_Opt_Config_Switches): Rename to Restore_Config_Switches.
(Save_Opt_Config_Switches): Rename to Save_Config_Switches. This
routine is now a function.
(Set_Opt_Config_Switches): Rename to Set_Config_Switches.
* par.adb (Par): Update the calls to configuration switch-related
subprograms.
* sem.adb (Semantics): Update the calls to configuration switch-related
subprograms.
* sem_ch10.adb (Analyze_Package_Body_Stub): Update the calls to
configuration switch-related subprograms.
(Analyze_Protected_Body_Stub): Update the calls to configuration
switch-related subprograms.
(Analyze_Subprogram_Body_Stub): Update calls to configuration
switch-related subprograms.
* sem_ch12.adb (Add_Pending_Instantiation): Update the capture of
pending instantiation attributes.
(Inline_Instance_Body): Update the capture of pending instantiation
attributes.  It is no longer needed to explicitly manipulate the SPARK
mode.
(Instantiate_Package_Body): Update the restoration of the context
attributes.
(Instantiate_Subprogram_Body): Update the restoration of context
attributes.
(Load_Parent_Of_Generic): Update the capture of pending instantiation
attributes.
(Set_Instance_Env): Update the way relevant configuration attributes
are saved and restored.

gcc/testsuite/

* gnat.dg/config_pragma1.adb, gnat.dg/config_pragma1_pkg.ads: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262794 138bc75d-0d04-0410-961f-82ee72b054a4
12 files changed:
gcc/ada/ChangeLog
gcc/ada/frontend.adb
gcc/ada/inline.ads
gcc/ada/opt.adb
gcc/ada/opt.ads
gcc/ada/par.adb
gcc/ada/sem.adb
gcc/ada/sem_ch10.adb
gcc/ada/sem_ch12.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/config_pragma1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/config_pragma1_pkg.ads [new file with mode: 0644]