https://gcc.gnu.org/g:7abf2222bed225e8b39bc2256eebb29692a8fde9

commit r15-1480-g7abf2222bed225e8b39bc2256eebb29692a8fde9
Author: Ronan Desplanques <desplanq...@adacore.com>
Date:   Wed May 15 14:35:59 2024 +0200

    ada: Add Dump_Buffers hooks for code coverage
    
    The purpose of this patch is to make it possible to set up code
    coverage for the GNAT front end in gnat1 using GNATcoverage. It is
    not obvious how to have GNATcoverage instrument gnat1's main function,
    and since the front end has a clear entry point (Gnat1drv), we add
    manual instrumentation annotations there.
    
    gcc/ada/
    
            * gnat1drv.adb (Gnat1drv): Add coverage instrumentation
            annotations.

Diff:
---
 gcc/ada/gnat1drv.adb | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index 754dab82862d..9743dfd4c4c9 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -1526,6 +1526,8 @@ begin
             Check_Rep_Info;
          end if;
 
+         pragma Annotate (Xcov, Dump_Buffers);
+
          return;
       end if;
 
@@ -1679,6 +1681,8 @@ begin
       Atree.Print_Statistics;
    end if;
 
+   pragma Annotate (Xcov, Dump_Buffers);
+
 --  The outer exception handler handles an unrecoverable error
 
 exception
@@ -1693,6 +1697,9 @@ exception
       Set_Standard_Output;
       Source_Dump;
       Tree_Dump;
+
+      pragma Annotate (Xcov, Dump_Buffers);
+
       Exit_Program (E_Errors);
 
 end Gnat1drv;

Reply via email to