aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2019-10-10 15:23:37 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-10-10 15:23:37 +0000
commit81ffc744fb09d51ef79fc69a8d6410ccc97e915e (patch)
tree3ff3ef60f9af7ac147138b08dd2a459044d52685
parent08f66419ef908d199ec55f24d9b64cc3287a5c3c (diff)
downloadgcc-81ffc744fb09d51ef79fc69a8d6410ccc97e915e.zip
gcc-81ffc744fb09d51ef79fc69a8d6410ccc97e915e.tar.gz
gcc-81ffc744fb09d51ef79fc69a8d6410ccc97e915e.tar.bz2
[Ada] T'Size in pragma Compile_Time_Error
2019-10-10 Bob Duff <duff@adacore.com> gcc/ada/ * sem_prag.adb (Defer_Compile_Time_Warning_Error_To_BE): In addition to saving the pragma for further processing, copy the pragma into the main unit if necessary. From-SVN: r276819
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/sem_prag.adb9
2 files changed, 12 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 082fcf4..0182d18 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,6 +1,5 @@
2019-10-10 Bob Duff <duff@adacore.com>
- * einfo.ads, einfo.adb (Invariants_Ignored): New flag on types.
- This leaves just one unused flag.
- * sem_prag.adb (Invariant): Set the flag if appropriate.
- * exp_util.adb (Make_Invariant_Call): Check the flag. \ No newline at end of file
+ * sem_prag.adb (Defer_Compile_Time_Warning_Error_To_BE): In
+ addition to saving the pragma for further processing, copy the
+ pragma into the main unit if necessary. \ No newline at end of file
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index f9ce1d9..fbfa0e0 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -32197,6 +32197,15 @@ package body Sem_Prag is
(New_Val => CTWE_Entry'(Eloc => Sloc (Arg1),
Scope => Current_Scope,
Prag => N));
+
+ -- If the Boolean expression contains T'Size, and we're not in the main
+ -- unit being compiled, then we need to copy the pragma into the main
+ -- unit, because otherwise T'Size might never be computed, leaving it
+ -- as 0.
+
+ if not In_Extended_Main_Code_Unit (N) then
+ Insert_Library_Level_Action (New_Copy_Tree (N));
+ end if;
end Defer_Compile_Time_Warning_Error_To_BE;
------------------------------------------