The usage of GNAT tools has been enhanced to include lines for options
--version and --help. The test for this is to invoke a GNAT tool with --help
and to check that there are lines for --version and --help in the output.
Tested on x86_64-pc-linux-gnu, committed on trunk
2011-09-02 Vincent Celier <[email protected]>
* bindusg.adb, clean.adb, gnatchop.adb, gnatfind.adb, gnatlink.adb,
gnatls.adb, gnatname.adb, gnatxref.adb, gprep.adb, makeusg.adb: Add
--version and --help in usage.
* switch.ads, switch.adb (Display_Usage_Version_And_Help): New procedure
Index: gnatchop.adb
===================================================================
--- gnatchop.adb (revision 178381)
+++ gnatchop.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1361,6 +1361,9 @@
"[-r] [-p] [-q] [-v] [-w] [-x] [--GCC=xx] file [file ...] [dir]");
New_Line;
+
+ Display_Usage_Version_And_Help;
+
Put_Line
(" -c compilation mode, configuration pragmas " &
"follow RM rules");
Index: bindusg.adb
===================================================================
--- bindusg.adb (revision 178381)
+++ bindusg.adb (working copy)
@@ -25,6 +25,7 @@
with Osint; use Osint;
with Output; use Output;
+with Switch; use Switch;
with System.WCh_Con; use System.WCh_Con;
@@ -55,6 +56,8 @@
Write_Eol;
Write_Eol;
+ Display_Usage_Version_And_Help;
+
-- Line for @response_file
Write_Line (" @<resp_file> Get arguments from response file");
Index: makeusg.adb
===================================================================
--- makeusg.adb (revision 178381)
+++ makeusg.adb (working copy)
@@ -26,6 +26,7 @@
with Makeutl;
with Osint; use Osint;
with Output; use Output;
+with Switch; use Switch;
with Usage;
procedure Makeusg is
@@ -51,6 +52,8 @@
Write_Str ("gnatmake switches:");
Write_Eol;
+ Display_Usage_Version_And_Help;
+
-- Line for -a
Write_Str (" -a Consider all files, even readonly ali files");
Index: gnatlink.adb
===================================================================
--- gnatlink.adb (revision 178381)
+++ gnatlink.adb (working copy)
@@ -1422,6 +1422,8 @@
Write_Eol;
Write_Line (" mainprog.ali the ALI file of the main program");
Write_Eol;
+ Write_Eol;
+ Display_Usage_Version_And_Help;
Write_Line (" -f Force object file list to be generated");
Write_Line (" -g Compile binder source file with debug information");
Write_Line (" -n Do not compile the binder source file");
Index: clean.adb
===================================================================
--- clean.adb (revision 178381)
+++ clean.adb (working copy)
@@ -1893,6 +1893,8 @@
Put_Line ("Usage: gnatclean [switches] {[-innn] name}");
New_Line;
+ Display_Usage_Version_And_Help;
+
Put_Line (" names is one or more file names from which " &
"the .adb or .ads suffix may be omitted");
Put_Line (" names may be omitted if -P<project> is specified");
Index: gprep.adb
===================================================================
--- gprep.adb (revision 178381)
+++ gprep.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -808,6 +808,7 @@
Write_Line (" deffile Name of the definition file");
Write_Eol;
Write_Line ("gnatprep switches:");
+ Display_Usage_Version_And_Help;
Write_Line (" -b Replace preprocessor lines by blank lines");
Write_Line (" -c Keep preprocessor lines as comments");
Write_Line (" -C Do symbol replacements within comments");
Index: gnatxref.adb
===================================================================
--- gnatxref.adb (revision 178381)
+++ gnatxref.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -257,6 +257,7 @@
"including with'ed units");
New_Line;
Put_Line ("gnatxref switches:");
+ Display_Usage_Version_And_Help;
Put_Line (" -a Consider all files, even when the ali file is"
& " readonly");
Put_Line (" -aIdir Specify source files search path");
Index: gnatls.adb
===================================================================
--- gnatls.adb (revision 178420)
+++ gnatls.adb (working copy)
@@ -1386,6 +1386,8 @@
Write_Str ("switches:");
Write_Eol;
+ Display_Usage_Version_And_Help;
+
-- Line for -a
Write_Str (" -a also output relevant predefined units");
Index: gnatfind.adb
===================================================================
--- gnatfind.adb (revision 178381)
+++ gnatfind.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -299,6 +299,7 @@
& "references. This parameters are optional");
New_Line;
Put_Line ("gnatfind switches:");
+ Display_Usage_Version_And_Help;
Put_Line (" -a Consider all files, even when the ali file is "
& "readonly");
Put_Line (" -aIdir Specify source files search path");
Index: gnatname.adb
===================================================================
--- gnatname.adb (revision 178381)
+++ gnatname.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -512,6 +512,8 @@
Write_Eol;
Write_Line ("switches:");
+ Display_Usage_Version_And_Help;
+
Write_Line (" --subdirs=dir real obj/lib/exec dirs are subdirs");
Write_Eol;
Index: switch.adb
===================================================================
--- switch.adb (revision 178381)
+++ switch.adb (working copy)
@@ -98,6 +98,20 @@
end if;
end Check_Version_And_Help_G;
+ ------------------------------------
+ -- Display_Usage_Version_And_Help --
+ ------------------------------------
+
+ procedure Display_Usage_Version_And_Help is
+ begin
+ Write_Str (" --version Display version and exit");
+ Write_Eol;
+
+ Write_Str (" --help Display usage and exit");
+ Write_Eol;
+ Write_Eol;
+ end Display_Usage_Version_And_Help;
+
---------------------
-- Display_Version --
---------------------
Index: switch.ads
===================================================================
--- switch.ads (revision 178381)
+++ switch.ads (working copy)
@@ -64,6 +64,9 @@
Version_String : String := Gnatvsn.Gnat_Version_String);
-- Display version of a tool when switch --version is used
+ procedure Display_Usage_Version_And_Help;
+ -- Output the two lines of usage for switches --version and --help
+
function Is_Switch (Switch_Chars : String) return Boolean;
-- Returns True iff Switch_Chars is at least two characters long, and the
-- first character is an hyphen ('-').