summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt65.adb
blob: 7b429b6b1a39726f5e8d0f2fff702413a1f9130d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- { dg-do run }
-- { dg-options "-O2" }

with Ada.Command_Line; use Ada.Command_Line;

procedure Opt65 is

   procedure Check_Version_And_Help (Version_String : String) is
      Help_Switch_Present    : Boolean := False;
      Next_Arg               : Natural := 1;
   begin
      while Next_Arg <= Argument_Count loop
         declare
            Next_Argv : constant String := Argument (Next_Arg);
         begin
            if Next_Argv = "--help" then
               Help_Switch_Present := True;
            end if;
            Next_Arg := Next_Arg + 1;
         end;
      end loop;

      if Help_Switch_Present then
         raise Program_Error;
      end if;
   end;

begin
   Check_Version_And_Help ("version");
end;