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] add machinery to warn on local exceptions never being raised


Tested on i686-linux, committed on trunk

This patch adds machinery to warn on local exceptions never being raised.
Source:
   procedure Test1 is
      Error : Exception;
   begin
      null;
   exception
      when Error => null;
   end Test1;
Compilation:
   gnatmake -q -gnatwr test1.adb
Output:
   test1.adb:2:04: warning: exception "Error" is never raised

2007-08-31  Hristian Kirtchev  <kirtchev@adacore.com>

	* einfo.ads, einfo.adb: New flag Is_Raised (Flag224). Update the
	structure of E_Exception to reflect the new flag.
	(Is_Raised, Set_Is_Raised): New inlined routines.
	Update the usage of available flag to reflect the addition of Is_Raised.
	(Is_Raised, Set_Is_Raised): Bodies of new routines.
	(Write_Entity_Flags): Write the status of flag Is_Raised.
	(Is_Descendent_Of_Address): New entity flag, to simplify handling of
	spurious ambiguities when integer literals appear in the context of an
	address type that is a visible integer type.

	* sem_ch11.adb (Analyze_Exception_Handler): Add code to warn on local
	exceptions never being raised.
	(Analyze_Raise_Statement): When analyzing an exception, mark it as being
	explicitly raised.

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]