[COMMITTED] ada: Ignore defered compile time errors without backend

Message ID 20231130101912.3094317-1-poulhies@adacore.com
State Committed
Commit ce5572d4b8b391657f050b783f0a65471cd36ad2
Headers
Series [COMMITTED] ada: Ignore defered compile time errors without backend |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 warning Patch is already merged

Commit Message

Marc Poulhiès Nov. 30, 2023, 10:19 a.m. UTC
  From: Viljar Indus <indus@adacore.com>

We defer some compile time warnings and errors until the
backend has added the extra information needed. However
it is not guaranteed that the backend has run by this point.
Avoid checking these errors if the backend has not been activated
and no code has been generated.

gcc/ada/

	* sem_prag.adb (Validate_Compile_Time_Warning_Errors): Avoid
	checking compile time warnings and errors if backend has not been
	activated.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_prag.adb | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Patch

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 02f6f29c8a8..bd1d9d3d59b 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -33972,6 +33972,16 @@  package body Sem_Prag is
    --  Start of processing for Validate_Compile_Time_Warning_Errors
 
    begin
+
+      --  These error/warning messages were deferred because they could not be
+      --  evaluated in the front-end and they needed additional information
+      --  from the back-end. There is no reason to run these checks again if
+      --  the back-end was not activated by this point.
+
+      if not Generating_Code then
+         return;
+      end if;
+
       Expander_Mode_Save_And_Set (False);
       In_Compile_Time_Warning_Or_Error := True;