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] Legality of null dependence items


This patch catches two syntax errors related to the use of null items in aspect
or pragma [Refined_]Depends. The patch also streamlines the error messages of
various aspects or pragmas that deal with null and non-null items.

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

--  depends_illegal.ads

package Depends_Illegal is
   procedure P1 (Par1 : Integer)
      with Depends => (null =>+ Par1);

   procedure P2 (Par1 : Integer ; Par2 : out Integer)
      with Depends => (Par2 => (Par1, null));
end Depends_Illegal;

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

$ gcc -c -gnatd.V depends_legal.ads
depends_illegal.ads:3:24: useless dependence, null depends on itself
depends_illegal.ads:6:39: cannot mix null and non-null dependency items

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

2013-10-14  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_prag.adb (Analyze_Dependency_Clause): Add new local variable
	Non_Null_Output_Seen.  Update the call to Analyze_Input_Output.
	(Analyze_Input_Item): Streamline the detection mechanism of null and
	non-null items.
	(Analyze_Input_List): Add new local variable
	Non_Null_Input_Seen. Update all calls to Analyze_Input_Output.
	(Analyze_Input_Output): Add new formal parameter Non_Null_Seen
	and update the related comment on usage. Update the
	recursive call to itself. Attribute 'Result is now treated
	as a non-null item. Detect mixes of null and non-null items.
	(Analyze_Initialization_Item): Streamline the detection mechanism
	of null and non-null items.

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]