]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Remove -gnateE information message for noncontiguous enumeration type
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 10 Sep 2024 13:02:19 +0000 (15:02 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 8 Oct 2024 08:37:15 +0000 (10:37 +0200)
It is very confusing for the user because it does not make any reference
to the source code but only to details of the underlying implementation.

gcc/ada/ChangeLog:
* gcc-interface/trans.cc (Raise_Error_to_gnu) <CE_Invalid_Data>:
Do not the generate range information if the value is a call to a
Rep_To_Pos function.

gcc/ada/gcc-interface/trans.cc

index ebcf2cdf8fe3844a9c6c1b0a14dc91a708594116..a073b2d94f1c3653e8a2e53ad0a0d461d2646cec 100644 (file)
@@ -6124,7 +6124,12 @@ Raise_Error_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
              gnu_index = convert (gnu_type, gnu_index);
            }
 
+         /* Do not print the range information for an enumeration type with
+            holes since it is meaningless.  */
          if (with_extra_info
+             && !(Nkind (gnat_index) == N_Function_Call
+                  && Is_Entity_Name (Name (gnat_index))
+                  && Is_Rep_To_Pos (Entity (Name (gnat_index))))
              && Known_Esize (gnat_type)
              && UI_To_Int (Esize (gnat_type)) <= 32)
            gnu_result