diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index eab24a04a5c..1cc1ef2850d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2019-08-13 Justin Squirek + + * gnatcmd.adb (GNATCmd): Add constant for new compiler switch + --help-ada, and include usage subprogram. Add line to usage help + explaining the new flag. + (GNATCmd_Usage): Rename from locally declared Usage so as not to + confuse with the newly imported version. Add new argument case + for --help-ada and add bug report email to implicit display of + help without the --help flag so as to unify output between the + two cases. + 2019-08-13 Dmitriy Anisimkov * libgnat/g-comlin.adb (Getopt): Quote unrecognized switch in diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index 271e8998887..f83b0f2db68 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -30,6 +30,7 @@ with Osint; use Osint; with Output; use Output; with Switch; use Switch; with Table; +with Usage; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Command_Line; use Ada.Command_Line; @@ -43,6 +44,9 @@ procedure GNATCmd is Gprname : constant String := "gprname"; Gprls : constant String := "gprls"; + Ada_Help_Switch : constant String := "--help-ada"; + -- Flag to display available build switches + Error_Exit : exception; -- Raise this exception if error detected @@ -229,7 +233,7 @@ procedure GNATCmd is procedure Output_Version; -- Output the version of this program - procedure Usage; + procedure GNATCmd_Usage; -- Display usage -------------------- @@ -244,14 +248,16 @@ procedure GNATCmd is & ", Free Software Foundation, Inc."); end Output_Version; - ----------- - -- Usage -- - ----------- + ------------------- + -- GNATCmd_Usage -- + ------------------- - procedure Usage is + procedure GNATCmd_Usage is begin Output_Version; New_Line; + Put_Line ("To list Ada build switches use " & Ada_Help_Switch); + New_Line; Put_Line ("List of available commands"); New_Line; @@ -276,9 +282,10 @@ procedure GNATCmd is end loop; New_Line; - end Usage; + end GNATCmd_Usage; - procedure Check_Version_And_Help is new Check_Version_And_Help_G (Usage); + procedure Check_Version_And_Help + is new Check_Version_And_Help_G (GNATCmd_Usage); -- Start of processing for GNATCmd @@ -351,6 +358,12 @@ begin Keep_Temporary_Files := True; Command_Arg := Command_Arg + 1; + elsif Command_Arg <= Argument_Count + and then Argument (Command_Arg) = Ada_Help_Switch + then + Usage; + Exit_Program (E_Success); + else exit; end if; @@ -359,7 +372,12 @@ begin -- If there is no command, just output the usage if Command_Arg > Argument_Count then - Usage; + GNATCmd_Usage; + + -- Add the following so that output is consistent with or without the + -- --help flag. + Write_Eol; + Write_Line ("Report bugs to report@adacore.com"); return; end if; @@ -379,7 +397,7 @@ begin exception when Constraint_Error => - Usage; + GNATCmd_Usage; Fail ("unknown command: " & Argument (Command_Arg)); end; end;