summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt65.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gnat.dg/opt65.adb')
-rw-r--r--gcc/testsuite/gnat.dg/opt65.adb30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/opt65.adb b/gcc/testsuite/gnat.dg/opt65.adb
new file mode 100644
index 00000000000..7b429b6b1a3
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt65.adb
@@ -0,0 +1,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;