This is the mail archive of the gcc-patches@gcc.gnu.org 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] Missing parentheses on [Refined_]Global and [Refined_]Depends


This patch modifies the parser to detect missing parentheses on SPARK aspects
Global, Depends, Refined_Global and Refined_Depends.

------------
-- Source --
------------

--  malformed_contracts.ads

package Malformed_Contracts
  with Abstract_State => (State_1, State_2)
is
   procedure OK_1
     with Global => State_1;

   procedure OK_2
     with Global => (State_1, State_2);

   procedure Error_0
     with Global => State_1, State_2;

   procedure Error_1
     with Global => Input => State_1;

   procedure Error_2
     with Global => (Input => State_1;

   procedure Error_3
     with Global => Input => State_1, In_Out => State_2;

   procedure Error_4
     with Global => (Input => State_1, In_Out => State_2;

   procedure Error_5
     with Global  => (In_Out  => State_1),
          Depends =>  State_1 => State_1;

   procedure Error_6
     with Global  => (In_Out  => State_1),
          Depends => (State_1 => State_1;

   procedure Error_7
     with Global  => (Input   => State_1, In_Out => State_2),
          Depends =>  State_2 => State_1, null   => State_2;

   procedure Error_8
     with Global  => (Input   => State_1, In_Out => State_2),
          Depends => (State_2 => State_1, null   => State_2;
end Malformed_Contracts;

----------------------------
-- Compilation and output --
----------------------------

$ gcc -c malformed_contracts.ads
malformed_contracts.ads:11:21: missing "("
malformed_contracts.ads:14:21: missing "("
malformed_contracts.ads:17:38: ";" should be ","
malformed_contracts.ads:20:21: missing "("
malformed_contracts.ads:23:57: ";" should be ","
malformed_contracts.ads:27:23: missing "("
malformed_contracts.ads:31:41: ";" should be ","
malformed_contracts.ads:35:23: missing "("
malformed_contracts.ads:39:60: missing ")"

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

2014-02-19  Hristian Kirtchev  <kirtchev@adacore.com>

	* par.adb Alphabetize the routines in Par.Sync.
	(Resync_Past_Malformed_Aspect): New routine.
	* par-ch13.adb (Get_Aspect_Specifications): Alphabetize local
	variables. Code and comment reformatting. Detect missing
	parentheses on aspects [Refined_]Global and [Refined_]Depends
	with a non-null definition.
	* par-sync.adb: Alphabetize all routines in this separate unit.
	(Resync_Past_Malformed_Aspect): New routine.

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]