From a2a05b0a358ce7cbd768224e99ea194a51e39150 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Sat, 18 Apr 1998 15:31:36 +0000 Subject: [PATCH] Patches to make g++/g77 give useful error when no files are given. * gcc.c (lang_specific_driver): Add new parm type to prototype. (added_libraries): New file scope static variable. (process_command): Initialize added_libraries. Pass it to lang_specific_driver. (main): Use added_libraries in check for no input files. From-SVN: r19281 --- gcc/ChangeLog | 8 ++++++++ gcc/gcc.c | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3100c60a769..ea74c5340a1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +Sat Apr 18 15:30:49 1998 Jim Wilson + + * gcc.c (lang_specific_driver): Add new parm type to prototype. + (added_libraries): New file scope static variable. + (process_command): Initialize added_libraries. Pass it to + lang_specific_driver. + (main): Use added_libraries in check for no input files. + Sat Apr 18 01:23:11 1998 John Carr * sparc.c, sparc.h, sparc.md, sol2.h: Many changes related to V9 diff --git a/gcc/gcc.c b/gcc/gcc.c index 614553ae0f8..ab1408f1f04 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -265,7 +265,7 @@ char *xmalloc (); char *xrealloc (); #ifdef LANG_SPECIFIC_DRIVER -extern void lang_specific_driver PROTO ((void (*) (), int *, char ***)); +extern void lang_specific_driver PROTO ((void (*) (), int *, char ***, int *)); #endif /* Specs are strings containing lines, each of which (if not blank) @@ -2291,6 +2291,11 @@ static struct infile *infiles; static int n_infiles; +/* This counts the number of libraries added by LANG_SPECIFIC_DRIVER, so that + we can tell if there were any user supplied any files or libraries. */ + +static int added_libraries; + /* And a vector of corresponding output files is made up later. */ static char **outfiles; @@ -2373,6 +2378,7 @@ process_command (argc, argv) n_switches = 0; n_infiles = 0; + added_libraries = 0; /* Figure compiler version from version string. */ @@ -2515,7 +2521,7 @@ process_command (argc, argv) #ifdef LANG_SPECIFIC_DRIVER /* Do language-specific adjustment/addition of flags. */ - lang_specific_driver (fatal, &argc, &argv); + lang_specific_driver (fatal, &argc, &argv, &added_libraries); #endif /* Scan argv twice. Here, the first time, just count how many switches @@ -4696,7 +4702,7 @@ main (argc, argv) exit (0); } - if (n_infiles == 0) + if (n_infiles == added_libraries) fatal ("No input files"); /* Make a place to record the compiler output file names -- 2.30.2