This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Qualified expressions and Code statements in Ada 2012

In Ada 2012 a qualified expression is a valid name, and for example a function
call that is disambiguated by means of a qualification can appear in the place
of a constant object. On the other hand A qualified expression that appears as
a statement denotes a machine code insertion. With the new rule, a qualified
expression by itself is parsed as a parameterless procedure call, and must be
rewritten and analyzed as a code statement.

The following must compile quietly:

     gcc -c -gnat12 -gnatws code_statement.adb

WITH MACHINE_CODE;                            -- N/A => ERROR.
PROCEDURE code_statement IS

          Asm_Insn'(Asm ("nop"));

END code_statement;

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-10-13  Ed Schonberg  <>

	* sem_ch6.adb (Analyze_Procedure_Call_Statement): In Ada 2012 mode,
	if the prefix of the call is a qualified expression, rewrite as
	a code statement.
	* sem_ch13.adb (Analyze_Code_Statement): In Ada 2012 mode, the
	code statement is legal if it is a rewriting of a procedure call.

Attachment: difs
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]