public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-180] [Ada] Use "aspect" instead of "pragma" in warnings
@ 2022-05-09  9:30 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-09  9:30 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:320eb42df09f3cb96fea9a7b090ae61d9edb20b6

commit r13-180-g320eb42df09f3cb96fea9a7b090ae61d9edb20b6
Author: Bob Duff <duff@adacore.com>
Date:   Mon Jan 10 10:29:40 2022 -0500

    [Ada] Use "aspect" instead of "pragma" in warnings
    
    For warnings related to the Unreferenced, Unmodified, and Unused
    aspects, refer to the "aspect", not the "pragma". Note that the aspect
    can be set by an aspect_specification or a pragma, so the term "aspect"
    is correct even in the pragma case.  However, messages in sem_prag.adb
    use Fix_Error, so they refer to "aspect" or "pragma". It's not clear
    that we really ought to refer to "pragma", now that those are obsolete,
    but de call Fix_Error for uniformity. We do not attempt to make
    Fix_Error available outside sem_prag.adb -- too much trouble for
    something that perhaps ought to be removed.
    
    gcc/ada/
    
            * lib-xref.adb, sem_util.adb: Change wording of warning messages
            to use "aspect".
            * sem_prag.adb: Use Fix_Error to change wording of warnings.
            * doc/gnat_rm/implementation_defined_pragmas.rst: Minor: fix
            cut&paste error.
            * gnat_rm.texi: Regenerate.

Diff:
---
 gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst |  2 +-
 gcc/ada/gnat_rm.texi                                   |  4 ++--
 gcc/ada/lib-xref.adb                                   |  8 ++++----
 gcc/ada/sem_prag.adb                                   | 17 +++++++++--------
 gcc/ada/sem_util.adb                                   |  5 +++--
 5 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
index fbd60eba126..895180e6763 100644
--- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
+++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
@@ -7313,7 +7313,7 @@ For the variable case, warnings are never given for unreferenced
 variables whose name contains one of the substrings
 ``DISCARD, DUMMY, IGNORE, JUNK, UNUSED`` in any casing. Such names
 are typically to be used in cases where such warnings are expected.
-Thus it is never necessary to use ``pragma Unmodified`` for such
+Thus it is never necessary to use ``pragma Unused`` for such
 variables, though it is harmless to do so.
 
 Pragma Validity_Checks
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 687e2e4fb9e..4bee272dfd4 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -21,7 +21,7 @@
 
 @copying
 @quotation
-GNAT Reference Manual , Jan 03, 2022
+GNAT Reference Manual , Apr 22, 2022
 
 AdaCore
 
@@ -8837,7 +8837,7 @@ For the variable case, warnings are never given for unreferenced
 variables whose name contains one of the substrings
 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
 are typically to be used in cases where such warnings are expected.
-Thus it is never necessary to use @code{pragma Unmodified} for such
+Thus it is never necessary to use @code{pragma Unused} for such
 variables, though it is harmless to do so.
 
 @node Pragma Validity_Checks,Pragma Volatile,Pragma Unused,Implementation Defined Pragmas
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index 359e0069984..610a4bd17ad 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -936,10 +936,10 @@ package body Lib.Xref is
                      if Chars (BE) = Chars (E) then
                         if Has_Pragma_Unused (E) then
                            Error_Msg_NE -- CODEFIX
-                             ("??pragma Unused given for&!", N, BE);
+                             ("??aspect Unused specified for&!", N, BE);
                         else
                            Error_Msg_NE -- CODEFIX
-                             ("??pragma Unreferenced given for&!", N, BE);
+                             ("??aspect Unreferenced specified for&!", N, BE);
                         end if;
                         exit;
                      end if;
@@ -952,10 +952,10 @@ package body Lib.Xref is
 
             elsif Has_Pragma_Unused (E) then
                Error_Msg_NE -- CODEFIX
-                 ("??pragma Unused given for&!", N, E);
+                 ("??aspect Unused specified for&!", N, E);
             else
                Error_Msg_NE -- CODEFIX
-                 ("??pragma Unreferenced given for&!", N, E);
+                 ("??aspect Unreferenced specified for&!", N, E);
             end if;
          end if;
 
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index f9169eeedd7..1289f4fbe99 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -5168,12 +5168,12 @@ package body Sem_Prag is
                elsif Has_Pragma_Unmodified (Arg_Id) then
                   if Has_Pragma_Unused (Arg_Id) then
                      Error_Msg_NE
-                       ("??pragma Unused already given for &!", Arg_Expr,
-                         Arg_Id);
+                       (Fix_Error ("??pragma Unused already given for &!"),
+                        Arg_Expr, Arg_Id);
                   else
                      Error_Msg_NE
-                       ("??pragma Unmodified already given for &!", Arg_Expr,
-                         Arg_Id);
+                       (Fix_Error ("??pragma Unmodified already given for &!"),
+                        Arg_Expr, Arg_Id);
                   end if;
 
                --  Otherwise the pragma referenced an illegal entity
@@ -5276,12 +5276,13 @@ package body Sem_Prag is
                   if Has_Pragma_Unreferenced (Arg_Id) then
                      if Has_Pragma_Unused (Arg_Id) then
                         Error_Msg_NE
-                          ("??pragma Unused already given for &!", Arg_Expr,
-                            Arg_Id);
+                          (Fix_Error ("??pragma Unused already given for &!"),
+                           Arg_Expr, Arg_Id);
                      else
                         Error_Msg_NE
-                          ("??pragma Unreferenced already given for &!",
-                            Arg_Expr, Arg_Id);
+                          (Fix_Error
+                             ("??pragma Unreferenced already given for &!"),
+                           Arg_Expr, Arg_Id);
                      end if;
 
                   --  Apply Unreferenced to the entity
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 3c55dda5a85..a4199679700 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -25698,10 +25698,11 @@ package body Sem_Util is
                      --  of pragma Unused.
 
                      if Has_Pragma_Unused (Ent) then
-                        Error_Msg_NE ("??pragma Unused given for &!", N, Ent);
+                        Error_Msg_NE
+                          ("??aspect Unused specified for &!", N, Ent);
                      else
                         Error_Msg_NE
-                          ("??pragma Unmodified given for &!", N, Ent);
+                          ("??aspect Unmodified specified for &!", N, Ent);
                      end if;
                   end if;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-09  9:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09  9:30 [gcc r13-180] [Ada] Use "aspect" instead of "pragma" in warnings Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).