This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Implement SCO (Source Coverage Obligation) information output


This patch is the initial implementation of the capability for
outputting SCO information in the ALI file, for use by the Couverture
project. The full details of the form of the output are in the new
unit par_sco.ads, and the implementation is in par_sco.adb. A new
switch -gnateS activates output of SCO information.

The following program:

     1. procedure FSCO (X : Integer) is
     2.    Z : Integer := 3;
     3.    Q : Integer := X + 1;
     4.    Y : Boolean := (X > 3 or else X < 10);
     5.    R : Integer := X + 2;
     6. begin
     7.    if X > 3 then
     8.       return;
     9.    elsif X < 4 or else (X > 10 and then X /= 122) then
    10.       return;
    11.    end if;
    12.
    13.    if Z = 3 then
    14.       return;
    15.    end if;
    16.
    17.    Z := X + 1;
    18.    Y := Z > 10;
    19. end;

compiled with -gnateS generates the following C lines in the ali file:

CS 2:4-3:23
CX | c4:20-4:24 c4:34-4:38
CS 5:4-5:23
CI c7:7-7:11
CT 8:7-8:7
CI | t9:10-9:14 & f9:25-9:29 t9:41-9:46
CT 10:7-10:7
CI t13:7-13:11
CT 14:7-14:7
CS 17:4-18:13

Tested on x86_64-pc-linux-gnu, committed on trunk

2009-07-15  Robert Dewar  <dewar@adacore.com>

	* debug.adb: Add -gnatd.O to output SCO table

	* lib-writ.adb (Write_Unit_Information): Use SCO_Output to output SCO
	information.

	* lib-writ.ads: Document addition of SCO lines to ALI file

	* par_sco.ads, par_sco.adb: New files.

	* opt.ads (Generate_SCO): New switch

	* par.adb (Par): Call SCO_Record to record SCO information

	* sem_warn.adb (Warn_On_Constant_Condition): Adjust SCO condition

	* switch-c.adb: Recognize -gnateS to generate SCO information

	* usage.adb: Add line for -gnateS

	* gcc-interface/Make-lang.in: Add dependency on par_sco.o for gnat1

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]