diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-22 10:31:30 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-22 10:31:30 +0000 |
commit | a67a63e2f256e0ea10297c519be188f09c4a8189 (patch) | |
tree | 7a679922c3da9b4129f120983a84f5f7406ef2d3 /gcc/ada/sem_ch10.adb | |
parent | 721cc2027b17be0c98236340d7d957899bb3c2ba (diff) | |
download | gcc-a67a63e2f256e0ea10297c519be188f09c4a8189.tar.gz |
2009-07-22 Thomas Quinot <quinot@adacore.com>
* sem_elab.adb (Insert_Elab_Check): When relocating an overloaded
expression to insert an elab check using a conditional expression, be
sure to carry the original list of interpretations to the new location.
2009-07-22 Gary Dismukes <dismukes@adacore.com>
* gnat1drv.adb: Fix spelling error.
2009-07-22 Javier Miranda <miranda@adacore.com>
* sem_type.ads, sem_type.adb (In_Generic_Actual): Leave this subprogram
at the library level and fix a hidden bug in its implementation: its
functionality for renaming objects was broken because
N_Object_Renaming_Declarations nodes are not a subclass of
N_Declaration nodes (as documented in sinfo.ads).
* sem_util.adb (Check_Dynamically_Tagged_Expression): Include in this
check nodes that are actuals of generic instantiations.
2009-07-22 Ed Schonberg <schonberg@adacore.com>
* sinfo.ads, sinfo.adb (Pending_Context): New flag to indicate that the
context of a compilation unit is being analyzed. Used to detect
circularities created by with_clauses that are not detected by the
loading machinery.
* sem_ch10.adb (Analyze_Compilation_Unit): Set Pending_Context before
analyzing the context of the current compilation unit, to detect
possible circularities created by with_clauses.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149925 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch10.adb')
-rw-r--r-- | gcc/ada/sem_ch10.adb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 687dd5c2f9a..88edbcc56e2 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -661,9 +661,59 @@ package body Sem_Ch10 is end if; -- Analyze context (this will call Sem recursively for with'ed units) + -- To detect circularities among with-clauses that are not caught during + -- loading, we set the Context_Pending flag on the current unit. If the + -- flag is already set there is a potential circularity. + -- We exclude predefined units from this check because they are known + -- to be safe. we also exclude package bodies that are present because + -- circularities between bodies are harmless (and necessary). + + if Context_Pending (N) then + declare + Circularity : Boolean := True; + + begin + if Is_Predefined_File_Name + (Unit_File_Name (Get_Source_Unit (Unit (N)))) + then + Circularity := False; + + else + for U in Main_Unit + 1 .. Last_Unit loop + if Nkind (Unit (Cunit (U))) = N_Package_Body + and then not Analyzed (Cunit (U)) + then + Circularity := False; + exit; + end if; + end loop; + end if; + + if Circularity then + Error_Msg_N + ("circular dependency caused by with_clauses", N); + Error_Msg_N + ("\possibly missing limited_with clause" + & " in one of the following", N); + + for U in Main_Unit .. Last_Unit loop + if Context_Pending (Cunit (U)) then + Error_Msg_Unit_1 := Get_Unit_Name (Unit (Cunit (U))); + Error_Msg_N ("\unit$", N); + end if; + end loop; + + raise Unrecoverable_Error; + end if; + end; + else + Set_Context_Pending (N); + end if; Analyze_Context (N); + Set_Context_Pending (N, False); + -- If the unit is a package body, the spec is already loaded and must be -- analyzed first, before we analyze the body. |