From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Sheri Bernstein <bernstein@adacore.com>
Subject: [COMMITTED] ada: Remove GNATcheck violations
Date: Tue, 5 Sep 2023 13:07:59 +0200 [thread overview]
Message-ID: <20230905110759.562386-1-poulhies@adacore.com> (raw)
From: Sheri Bernstein <bernstein@adacore.com>
Use pragma Annotate to exempt GNATcheck violations that are related
to proof code. Specifically, exempt rules "Metrics_LSLOC" and
"Metrics_Cyclomatic_Complexity" whose limits are exceeded due to
proof code, and exempt rule "Discriminated_Records" for a variant record
that is only used in proof code.
gcc/ada/
* libgnat/s-aridou.adb: Add pragma to exempt Metrics_LSLOC.
(Double_Divide): Add pragma to exempt
Metrics_Cyclomatic_Complexity.
(Scaled_Divide): Likewise.
* libgnat/s-vauspe.ads (Uns_Option): Add pragma to exempt
Discriminated_Records.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/libgnat/s-aridou.adb | 11 +++++++++++
gcc/ada/libgnat/s-vauspe.ads | 3 +++
2 files changed, 14 insertions(+)
diff --git a/gcc/ada/libgnat/s-aridou.adb b/gcc/ada/libgnat/s-aridou.adb
index beb56bfabe1..6bcce59cfeb 100644
--- a/gcc/ada/libgnat/s-aridou.adb
+++ b/gcc/ada/libgnat/s-aridou.adb
@@ -29,6 +29,9 @@
-- --
------------------------------------------------------------------------------
+pragma Annotate (Gnatcheck, Exempt_On, "Metrics_LSLOC",
+ "limit exceeded due to proof code");
+
with Ada.Unchecked_Conversion;
with System.SPARK.Cut_Operations; use System.SPARK.Cut_Operations;
@@ -814,6 +817,8 @@ is
-- Double_Divide --
-------------------
+ pragma Annotate (Gnatcheck, Exempt_On, "Metrics_Cyclomatic_Complexity",
+ "limit exceeded due to proof code");
procedure Double_Divide
(X, Y, Z : Double_Int;
Q, R : out Double_Int;
@@ -1221,6 +1226,7 @@ is
Prove_Signs;
end Double_Divide;
+ pragma Annotate (Gnatcheck, Exempt_Off, "Metrics_Cyclomatic_Complexity");
---------
-- Le3 --
@@ -1899,6 +1905,8 @@ is
-- Scaled_Divide --
-------------------
+ pragma Annotate (Gnatcheck, Exempt_On, "Metrics_Cyclomatic_Complexity",
+ "limit exceeded due to proof code");
procedure Scaled_Divide
(X, Y, Z : Double_Int;
Q, R : out Double_Int;
@@ -3317,6 +3325,7 @@ is
Prove_Sign_R;
Prove_Signs;
end Scaled_Divide;
+ pragma Annotate (Gnatcheck, Exempt_Off, "Metrics_Cyclomatic_Complexity");
----------
-- Sub3 --
@@ -3658,3 +3667,5 @@ is
pragma Annotate (Gnatcheck, Exempt_Off, "Improper_Returns");
end System.Arith_Double;
+
+pragma Annotate (Gnatcheck, Exempt_Off, "Metrics_LSLOC");
diff --git a/gcc/ada/libgnat/s-vauspe.ads b/gcc/ada/libgnat/s-vauspe.ads
index a6f81d715c4..b276eed5105 100644
--- a/gcc/ada/libgnat/s-vauspe.ads
+++ b/gcc/ada/libgnat/s-vauspe.ads
@@ -68,6 +68,8 @@ is
when others => raise Program_Error)
with Ghost;
+ pragma Annotate (Gnatcheck, Exempt_On, "Discriminated_Records",
+ "variant record only used in proof code");
type Uns_Option (Overflow : Boolean := False) is record
case Overflow is
when True =>
@@ -76,6 +78,7 @@ is
Value : Uns := 0;
end case;
end record;
+ pragma Annotate (Gnatcheck, Exempt_Off, "Discriminated_Records");
function Wrap_Option (Value : Uns) return Uns_Option is
(Overflow => False, Value => Value);
--
2.40.0
next reply other threads:[~2023-09-05 11:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 11:07 Marc Poulhiès [this message]
2023-11-30 10:19 Marc Poulhiès
2023-12-19 14:31 Marc Poulhiès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230905110759.562386-1-poulhies@adacore.com \
--to=poulhies@adacore.com \
--cc=bernstein@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).