From: Ghjuvan Lacambre <[email protected]>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_ch13.adb | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 98c3335e593..b90c7301895 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -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;
--
2.51.0