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] new flag -gnatwy/Y


Tested on i686-linux, committed on mainline.

This patch adds a new warning flag -gnatwy/Y to turn on and off
warnings associated with compatibility issues between Ada 95 and
Ada 2005 (in particular, warnings on use of new keywords, and
warnings on calls of newly obsolescent routines). The warnings
are on by default, but can be turned off with -gnatwY. There is
also a fix in sem_prag to properly recognize the Ada_05 parameter
of pragma Obsolescent only if Ada 2005 mode has been specified
explicitly.

A test program for the obsolsecent warning is:

with Ada.Characters.Handling; use Ada.Characters.Handling;
procedure Q is
   X : constant Wide_String := To_Wide_String ("hello");
   pragma Unreferenced (X);
begin
   null;
end;

when compiled with options -gnat05 -gnatwa, this will generate the
diagnostics:

q.adb:3:32: warning: call to obsolescent subprogram "To_Wide_String"
q.adb:3:32: warning: (Ada 2005) use Ada.Characters.Conversions.To_Wide_String

These warnings disappear if -gnat05 is removed, or if -gnatwY is added.

A test program for the keyword case is:

package k is
   Interface : Integer;
end K;

which compiled with no switches gives:

k.ads:2:04: warning: "Interface" is a reserved word in Ada 2005

this warning goes away if -gnatwY is used

2005-06-14  Robert Dewar  <dewar@adacore.com>

	* opt.ads, opt.adb: New flags for persistent_bss mode
	Add Ada_Version_Explicit, for implementation of AI-362
	Add Assertions_Enabled_Config and associated handling
	Needed since setting can be changed with Assertion_Policy pragma
	Add new flag Warn_On_Ada_2005_Compatibility

	* switch-c.adb: Recognize -gnatwy/Y
	Set Ada_Version_Explicit, for implementation of AI-362
	The -gnatg switch now includes -gnatyu

	* usage.adb: Add -gnatwy/Y
	Remove wrong asterisk on -gnatwX line
	Add line for -gnatyu switch

Attachment: difs.38
Description: Text document


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