]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: sem_prag.adb: ignore compile_time_{warning,error} in CodePeer mode
authorGhjuvan Lacambre <lacambre@adacore.com>
Mon, 2 Sep 2024 14:08:16 +0000 (16:08 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 8 Oct 2024 08:37:11 +0000 (10:37 +0200)
GNAT sometimes needs help from the GCC back-end in order to check
whether Compile_Time_{Warning,Error} are true. As CodePeer does not have
access to a GCC back-end, it is unable to perform these checks. Thus we
need to remove said pragmas from the tree.

gcc/ada/ChangeLog:
* sem_prag.adb (Process_Compile_Time_Warning_Or_Error): Turn
Compile_Time pragmas into null nodes

gcc/ada/sem_prag.adb

index 2d31c71f366e3ff15e4c37d14f53d211820d59a4..0d43929df720328cff2d180145fc9e245c7fe680 100644 (file)
@@ -8148,6 +8148,11 @@ package body Sem_Prag is
          Check_Arg_Is_OK_Static_Expression (Arg2, Standard_String);
          Analyze_And_Resolve (Arg1x, Standard_Boolean);
 
+         if CodePeer_Mode then
+               Rewrite (N, Make_Null_Statement (Loc));
+               return;
+         end if;
+
          --  In GNATprove mode, pragma Compile_Time_Error is translated as
          --  a Check pragma in GNATprove mode, handled as an assumption in
          --  GNATprove. This is correct as the compiler will issue an error