]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Initial infrastructure for adding a tree checker
authorArnaud Charlet <charlet@adacore.com>
Thu, 9 Jan 2020 16:04:35 +0000 (11:04 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 3 Jun 2020 10:01:39 +0000 (06:01 -0400)
2020-06-03  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* frontend.adb (Frontend): Call (dummy for now) tree checker.
* debug.adb: Reserve -gnatd_V for the tree checker.
* vast.ads, vast.adb: New files.
* gcc-interface/Make-lang.in: Add vast.o.

gcc/ada/debug.adb
gcc/ada/frontend.adb
gcc/ada/gcc-interface/Make-lang.in
gcc/ada/vast.adb [new file with mode: 0644]
gcc/ada/vast.ads [new file with mode: 0644]

index a1a7462084a2c9887db1e51f8e7bb3917d3ad443..764228e78fc724119e64fbfe6ce73458b06dd5cd 100644 (file)
@@ -193,7 +193,7 @@ package body Debug is
    --  d_S
    --  d_T  Output trace information on invocation path recording
    --  d_U
-   --  d_V
+   --  d_V  Enable verifications on the expanded tree
    --  d_W
    --  d_X
    --  d_Y
@@ -1012,9 +1012,12 @@ package body Debug is
    --       it is checked, and the progress of the recursive trace through
    --       elaboration calls at compile time.
 
-   --  d_T  The compiler outputs trance information to standard output whenever
+   --  d_T  The compiler outputs trace information to standard output whenever
    --       an invocation path is recorded.
 
+   --  d_V  Enable verification of the expanded code before calling the backend
+   --       and generate error messages on each inconsistency found.
+
    --  d1   Error messages have node numbers where possible. Normally error
    --       messages have only source locations. This option is useful when
    --       debugging errors caused by expanded code, where the source location
index 712340a3a929393015966f03f5f25315060f560a..0fd3424b38b5f8305a2930523986e88fc19c3d22 100644 (file)
@@ -66,6 +66,7 @@ with Sinput.L; use Sinput.L;
 with SCIL_LL;
 with Tbuild;   use Tbuild;
 with Types;    use Types;
+with VAST;
 
 procedure Frontend is
 begin
@@ -505,6 +506,12 @@ begin
       null;
    end if;
 
+   --  Verify the validity of the tree
+
+   if Debug_Flag_Underscore_VV then
+      VAST.Check_Tree (Cunit (Main_Unit));
+   end if;
+
    --  Dump the source now. Note that we do this as soon as the analysis
    --  of the tree is complete, because it is not just a dump in the case
    --  of -gnatD, where it rewrites all source locations in the tree.
index 2e0f6b42e6425792cb483c0854ef4e33d00d3032..12a0c58d97643983bf66847e14face6e6c018c18 100644 (file)
@@ -481,6 +481,7 @@ GNAT_ADA_OBJS =     \
  ada/urealp.o  \
  ada/usage.o   \
  ada/validsw.o \
+ ada/vast.o    \
  ada/warnsw.o  \
  ada/widechar.o
 
diff --git a/gcc/ada/vast.adb b/gcc/ada/vast.adb
new file mode 100644 (file)
index 0000000..87de26e
--- /dev/null
@@ -0,0 +1,46 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT COMPILER COMPONENTS                         --
+--                                                                          --
+--                                 V A S T                                  --
+--                                                                          --
+--                                 B o d y                                  --
+--                                                                          --
+--             Copyright (C) 2020, Free Software Foundation, Inc.           --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  Dummy implementation
+
+package body VAST is
+
+   ----------------
+   -- Check_Tree --
+   ----------------
+
+   procedure Check_Tree (GNAT_Root : Node_Id) is
+      pragma Unreferenced (GNAT_Root);
+   begin
+      null;
+   end Check_Tree;
+
+end VAST;
diff --git a/gcc/ada/vast.ads b/gcc/ada/vast.ads
new file mode 100644 (file)
index 0000000..01dfbfd
--- /dev/null
@@ -0,0 +1,42 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT COMPILER COMPONENTS                         --
+--                                                                          --
+--                                 V A S T                                  --
+--                                                                          --
+--                                 S p e c                                  --
+--                                                                          --
+--             Copyright (C) 2020, Free Software Foundation, Inc.           --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package is the entry point for VAST: Verifier for the Ada Semantic
+--  Tree.
+
+with Types; use Types;
+
+package VAST is
+
+   procedure Check_Tree (GNAT_Root : Node_Id);
+   --  Check the validity of the given Root tree
+
+end VAST;