aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/lib-xref.adb
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2021-03-13 14:47:59 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-18 04:36:46 -0400
commit07537fe632cd6e2fcf83954fb85455d118d80c06 (patch)
treebc9f0d9d55fe25b8be5707f6bf968456701674c4 /gcc/ada/lib-xref.adb
parent64b5da8f97122de895af1b13c5f5e103717858c6 (diff)
downloadgcc-07537fe632cd6e2fcf83954fb85455d118d80c06.zip
gcc-07537fe632cd6e2fcf83954fb85455d118d80c06.tar.gz
gcc-07537fe632cd6e2fcf83954fb85455d118d80c06.tar.bz2
[Ada] Ada2020: Special handling of types derived from runtime
gcc/ada/ * einfo.ads (Is_Ada_2022_Only): Adding documentation. * gen_il-fields.ads (Is_Ada_2022_Only): New flag. * gen_il-gen-gen_entities.adb (Is_Ada_2022_Only): New flag. * itypes.adb (Create_Null_Excluding_Itype): Inherit Is_Ada_2022_Only. * sem_ch3.adb (Check_Abstract_Overriding): Skip reporting error on Ada 2022 only subprograms that require overriding if we are not in Ada 2022 mode. (Derive_Subprogram): Inherit Is_Ada_2022_Only. * sem_ch6.adb (Check_Overriding_Indicator): Inherit Is_Ada_2022_Only. (New_Overloaded_Entity): Inherit Is_Ada_2022_Only. * sem_ch7.adb (Declare_Inherited_Private_Subprograms): Inherit Is_Ada_2022_Only. (Preserve_Full_Attributes): Inherit Is_Ada_2022_Only. * sem_disp.adb (Find_Hidden_Overridden_Primitive): Inherit Is_Ada_2022_Only. (Override_Dispatching_Operation): Inherit Is_Ada_2022_Only. * sem_prag.adb (Analyze_Pragma): Allow form with argument for Ada 2022. * sem_type.adb: (Disambiguate): Deal with Is_Ada_2022_Only * lib-xref.adb (Generate_Reference): Error on static and dispatching calls to Ada 2022 subprograms that require overriding if we are not in Ada 2022 mode; warn on other references to Ada 2022 entities when not in Ada 2022 mode. * sem_ch13.adb (Inherit_Aspects_At_Freeze_Point): Inherit Ada_2020_Only. * libgnat/a-cdlili.ads (Empty): Adding pragma Ada_2022. * libgnat/a-cidlli.ads (Empty): Adding pragma Ada_2022. * libgnat/a-ciorma.ads (Empty): Adding pragma Ada_2022. * libgnat/a-cobove.ads (Empty): Adding pragma Ada_2022. * libgnat/a-coorma.ads (Empty): Adding pragma Ada_2022. (New_Vector): Adding pragma Ada_2022. (Insert_Vector): Adding pragma Ada_2022. (Prepend_Vector): Adding pragma Ada_2022. (Append_Vector): Adding pragma Ada_2022.
Diffstat (limited to 'gcc/ada/lib-xref.adb')
-rw-r--r--gcc/ada/lib-xref.adb31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index a426745..17de886 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -703,6 +703,37 @@ package body Lib.Xref is
Error_Msg_NE ("& is only defined in Ada 2012?y?", N, E);
end if;
+ -- Warn if reference to Ada 2022 entity not in Ada 2022 mode. We only
+ -- detect real explicit references (modifications and references).
+
+ if Comes_From_Source (N)
+ and then Is_Ada_2022_Only (E)
+ and then not Is_Subprogram (E)
+ and then Ada_Version < Ada_2022
+ and then Warn_On_Ada_2022_Compatibility
+ and then (Typ = 'm' or else Typ = 'r')
+ then
+ Error_Msg_NE ("& is only defined in Ada 2022?y?", N, E);
+
+ -- Error on static and dispatching calls to Ada 2022 subprograms that
+ -- require overriding if we are not in Ada 2022 mode (since overriding
+ -- was skipped); warn if the subprogram does not require overriding.
+
+ elsif Comes_From_Source (N)
+ and then Is_Ada_2022_Only (E)
+ and then Ada_Version < Ada_2022
+ and then Is_Subprogram (E)
+ and then (Typ = 'r' or else Typ = 's' or else Typ = 'R')
+ then
+ if Requires_Overriding (E) then
+ Error_Msg_NE
+ ("& is only defined in Ada 2022 and requires overriding", N, E);
+
+ elsif Warn_On_Ada_2022_Compatibility then
+ Error_Msg_NE ("& is only defined in Ada 2022?y?", N, E);
+ end if;
+ end if;
+
-- Do not generate references if we are within a postcondition sub-
-- program, because the reference does not comes from source, and the
-- preanalysis of the aspect has already created an entry for the ALI