]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: sem_ch13.adb: accept VADS inline asm in Relaxed RM Semantics mode
authorGhjuvan Lacambre <lacambre@adacore.com>
Mon, 17 Nov 2025 15:23:50 +0000 (16:23 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 27 Nov 2025 12:57:44 +0000 (13:57 +0100)
VADS inline assembly works by using a qualified expression for one of
the types defined in the Machine_Code package, e.g.

   procedure P is
   begin
      code_2'(INSTR, OPERAND1, OPERAND2);
   end y;

This is different from GNAT's own inline assembly machinery, which
instead expects a call to Machine_Code.ASM with a set of
differently-typed arguments.

This incompatibility is preventing GNATSAS' GNAT-Warnings engine from
analyzing VADS code, hence we adapt sem_ch13.adb to not fail on such
constructs when GNAT is running under both Check_Semantics_Only_Mode and
Relaxed_RM_Semantics mode.

gcc/ada/ChangeLog:

* sem_ch13.adb (Analyze_Code_Statement): Do not emit error
message when only checking relaxed semantics.

gcc/ada/sem_ch13.adb

index 98c3335e593c98cb4812239a82856ed3239967df..b90c730189530ee037c718b91dc96ff70510f189 100644 (file)
@@ -8482,7 +8482,15 @@ package body Sem_Ch13 is
       if Etype (Expression (N)) = Any_Type then
          return;
       elsif not Is_RTE (Etype (Expression (N)), RE_Asm_Insn) then
-         Error_Msg_N ("incorrect type for code statement", N);
+
+         --  Only emit an error message when not running in Relaxed RM
+         --  Semantics. This enables GNATSAS' GNAT Warnings engine to work on
+         --  VADS codebases.
+
+         if not (Check_Semantics_Only_Mode and then Relaxed_RM_Semantics) then
+            Error_Msg_N ("incorrect type for code statement", N);
+         end if;
+
          return;
       end if;