From patchwork Fri Sep 2 09:36:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 113069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 3AF62B6F72 for ; Fri, 2 Sep 2011 19:37:14 +1000 (EST) Received: (qmail 30641 invoked by alias); 2 Sep 2011 09:37:12 -0000 Received: (qmail 30633 invoked by uid 22791); 2 Sep 2011 09:37:11 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Sep 2011 09:36:53 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 112F72BB472; Fri, 2 Sep 2011 05:36:53 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 4OKtc2wiB2v3; Fri, 2 Sep 2011 05:36:53 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id F1A4C2BB454; Fri, 2 Sep 2011 05:36:52 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id E10273FEE8; Fri, 2 Sep 2011 05:36:52 -0400 (EDT) Date: Fri, 2 Sep 2011 05:36:52 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] --version and --help in usage of GNAT tools Message-ID: <20110902093652.GA28495@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * 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 (" @ 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 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 ('-').