aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gnat1drv.adb
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2018-12-11 11:10:07 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-12-11 11:10:07 +0000
commit5fc26697366abd160c4e755b6fe25c778ac97784 (patch)
tree1af5b93a7d1bc3ccf9cc3fd5f8d32f5ba45cafe1 /gcc/ada/gnat1drv.adb
parente64ac63149a6ec0ee9403079eea7df857ff59587 (diff)
downloadgcc-5fc26697366abd160c4e755b6fe25c778ac97784.zip
gcc-5fc26697366abd160c4e755b6fe25c778ac97784.tar.gz
gcc-5fc26697366abd160c4e755b6fe25c778ac97784.tar.bz2
[Ada] Better error message from GNATprove on illegal switch
When a compilation switch is wrongly passed to GNATprove without the leading hyphen, this patch issues a clear error message instead of the obscure 'usage' message previously displayed. There is no impact on compilation. 2018-12-11 Yannick Moy <moy@adacore.com> gcc/ada/ * gnat1drv.adb (Gnat1drv): Issue specific error message in GNATprove mode when multiple file names on the command line. * osint.adb, osint.ads (Dump_Command_Line_Source_File_Names): New procedure to print file names on the command line. From-SVN: r266989
Diffstat (limited to 'gcc/ada/gnat1drv.adb')
-rw-r--r--gcc/ada/gnat1drv.adb17
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index eab2fda..3c1bf36 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -1161,8 +1161,21 @@ begin
-- gnat1 is invoked from gcc in the normal case.
if Osint.Number_Of_Files /= 1 then
- Usage;
- Write_Eol;
+
+ -- In GNATprove mode, gcc is not called, so we may end up with
+ -- switches wrongly interpreted as source file names when they are
+ -- written by mistake without a starting hyphen. Issue a specific
+ -- error message but do not print the internal 'usage' message.
+
+ if GNATprove_Mode then
+ Write_Str ("one of the following is not a valid switch"
+ & " or source file name: ");
+ Osint.Dump_Command_Line_Source_File_Names;
+ else
+ Usage;
+ Write_Eol;
+ end if;
+
Osint.Fail ("you must provide one source file");
elsif Usage_Requested then