From 9d1d00ca249c62a6df038254e1fc986bd6b26f39 Mon Sep 17 00:00:00 2001 From: Justin Squirek Date: Mon, 4 Jul 2016 10:05:53 +0000 Subject: einfo.adb (Has_Pragma_Unused): Create this function as a setter for a new flag294 (Set_Has_Pragma_Unused):... 2016-07-04 Justin Squirek * einfo.adb (Has_Pragma_Unused): Create this function as a setter for a new flag294 (Set_Has_Pragma_Unused): Create this procedure as a getter for flag294 (Write_Entity_Flags): Register the new flag with an alias * einfo.ads Add comment documenting Has_Pragma_Unused (flag294) and subsequent getter and setter declarations. * lib-xref.adb (Generate_Reference): Recognize Has_Pragma_Unused flag to print appropriate warning messages. * par-prag.adb (Prag): Classify Pragma_Unused into "All Other Pragmas." * snames.ads-tmpl Add a new name to the name constants and a new pramga to Pragma_Id for pramga Unused. * sem_prag.adb (Analyze_Pragma): Create case for Pragma_Unused and move the block for Pragma_Unmodified and Pragma_Unreferenced out and into local subprograms. (Analyze_Unmodified, Analyze_Unreferenced): From the old pragma blocks that have been separated in to local subprograms add a parameter to indicate the if they are being called in the context of Pragma_Unused and handle it accordingly. (Is_Non_Significant_Pragma_Reference): Add an entry for Pragma_Unused and correct the position of Pragma_Unevaluated_Use_Of_Old. * sem_util.adb (Note_Possible_Modification): Recognize Has_Pragma_Unused flag to print appropriate warning messages. From-SVN: r237961 --- gcc/ada/lib-xref.adb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gcc/ada/lib-xref.adb') diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index bff6d25..b1d5978 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -841,6 +841,8 @@ package body Lib.Xref is -- Check for pragma Unreferenced given and reference is within -- this source unit (occasion for possible warning to be issued). + -- Note that the entity may be marked as unreferenced by pragma + -- Unused. if Has_Unreferenced (E) and then In_Same_Extended_Unit (E, N) @@ -875,8 +877,13 @@ package body Lib.Xref is BE := First_Entity (Current_Scope); while Present (BE) loop if Chars (BE) = Chars (E) then - Error_Msg_NE -- CODEFIX - ("??pragma Unreferenced given for&!", N, BE); + if Has_Pragma_Unused (E) then + Error_Msg_NE -- CODEFIX + ("??pragma Unused given for&!", N, BE); + else + Error_Msg_NE -- CODEFIX + ("??pragma Unreferenced given for&!", N, BE); + end if; exit; end if; @@ -886,6 +893,9 @@ package body Lib.Xref is -- Here we issue the warning, since this is a real reference + elsif Has_Pragma_Unused (E) then + Error_Msg_NE -- CODEFIX + ("??pragma Unused given for&!", N, E); else Error_Msg_NE -- CODEFIX ("??pragma Unreferenced given for&!", N, E); -- cgit v1.1