From: Ronan Desplanques <desplanq...@adacore.com> 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. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gnat1drv.adb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index 754dab82862..9743dfd4c4c 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; -- 2.45.1