Skip to content

gnattest: Utils.Drivers.Driver.Process_Files: logic bug with ignored switch #25

Open
@kilian-gebhardt

Description

@kilian-gebhardt

I hit the pragma Assert (Counter = 0); in https://github.com/AdaCore/libadalang-tools/blob/263158611cf1b073db6733a9aa247c3a16f086d3/src/utils-drivers.adb#LL128C11-L128C38
when invoking gnattest with one ignore file that contained more than 1 file name (say 5).

The issue is that Arg_Length (Cmd, Ignore) only provides the number of ignore files but not the actual number of file names in those ignore files:

N_File_Names : constant Natural := Num_File_Names (Cmd) - Arg_Length (Cmd, Ignore);
Counter        : Natural := N_File_Names;

Counter subsequently get's decremented on every non-ignored file. Since Counter = N_File_Names - 1, Counter = 4 when the assertion is hit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions