[Ada] Remove redundant condition for Image attribute and Ada version

Message ID 20210506075812.GA125525@adacore.com
State New
Headers show
Series
  • [Ada] Remove redundant condition for Image attribute and Ada version
Related show

Commit Message

Pierre-Marie de Rodat May 6, 2021, 7:58 a.m.
Routine Error_Msg_Ada_2012_Feature includes a test on Ada_Version, so
there is no need to explicitly test the same condition just before the
call.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_attr.adb (Analyze_Image_Attribute): Remove redundant
	condition; add a missing header box.

Patch

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -1467,6 +1467,10 @@  package body Sem_Attr is
          --  Check that Image_Type is legal as the type of a prefix of 'Image.
          --  Legality depends on the Ada language version.
 
+         ----------------------
+         -- Check_Image_Type --
+         ----------------------
+
          procedure Check_Image_Type (Image_Type : Entity_Id) is
          begin
             --  Image_Type may be empty in case of another error detected,
@@ -1493,7 +1497,7 @@  package body Sem_Attr is
             Set_Etype (N, Str_Typ);
             Check_Image_Type (Etype (P));
 
-            if Attr_Id /= Attribute_Img and then Ada_Version < Ada_2012 then
+            if Attr_Id /= Attribute_Img then
                Error_Msg_Ada_2012_Feature ("|Object''Image", Sloc (P));
             end if;
          else