This patch cleans up a minor glitch of outputting an extra semicolon after the code statement appearing as the expression of an Asm construct when using machine code.
The following is compiled on an x86 with -gnatG 1. with system.machine_code; use system.machine_code; 2. procedure repro is 3. c : integer := -1; 4. r : integer; 5. begin 6. asm ("nop", integer'asm_output ("=m", r), 7. integer'asm_input("r", c)); 8. if r /= 0 then 9. raise program_error; 10. end if; 11. end; and the output is: Source recreated from tree for repro (body) ------------------------------------------- with system; with system.system__machine_code; use system.system__machine_code; with system.system__machine_code; procedure repro is c : integer := -1; r : integer; begin system__machine_code__asm_insn'( system__machine_code__asm__4 ("nop", integer'asm_output("=m", r), integer'asm_input("r", c), clobber => "", volatile => false)); if r /= 0 then [program_error "explicit raise"] end if; return; end repro; There used to be an extra semicolon "false););" in the output Tested on x86_64-pc-linux-gnu, committed on trunk 2011-11-04 Robert Dewar <de...@adacore.com> * sprint.adb (Sprint_Node_Actual, case Qualified_Expression): Avoid junk semicolon after argument of machine code Asm operand.
Index: sprint.adb =================================================================== --- sprint.adb (revision 180934) +++ sprint.adb (working copy) @@ -2694,9 +2694,19 @@ if Paren_Count (Expression (Node)) /= 0 then Sprint_Node (Expression (Node)); + else Write_Char ('('); Sprint_Node (Expression (Node)); + + -- Odd case, for the qualified expressions used in machine + -- code the argument may be a procedure call, resulting in + -- a junk semicolon before the right parent, get rid of it. + + Write_Erase_Char (';'); + + -- Now we can add the terminating right paren + Write_Char (')'); end if;