aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Kehoe <brendan@gcc.gnu.org>1993-01-14 19:19:25 -0500
committerBrendan Kehoe <brendan@gcc.gnu.org>1993-01-14 19:19:25 -0500
commit48fb792a91a6b0850d723dc87bcc18eeab7ac3f5 (patch)
treea829405d785547f5ed120c3fb1ab765e260dd857
parent3dac0de51f62b67c842e8dc1092043ee63c49c7b (diff)
downloadgcc-48fb792a91a6b0850d723dc87bcc18eeab7ac3f5.zip
gcc-48fb792a91a6b0850d723dc87bcc18eeab7ac3f5.tar.gz
gcc-48fb792a91a6b0850d723dc87bcc18eeab7ac3f5.tar.bz2
gcc.c (process_command): Only accept input files which exist and can be read...
* gcc.c (process_command): Only accept input files which exist and can be read; prevent link phase if an input file was rejected. (error_count): Make into a static global variable. From-SVN: r3249
-rw-r--r--gcc/gcc.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index c15ff42..30a0d32 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -144,6 +144,10 @@ static int cross_compile = 1;
static int cross_compile = 0;
#endif
+/* The number of errors that have occurred; the link phase will not be
+ run if this is non-zero. */
+static int error_count = 0;
+
/* This is the obstack which we use to allocate many strings. */
static struct obstack obstack;
@@ -2279,8 +2283,16 @@ process_command (argc, argv)
}
else
{
- infiles[n_infiles].language = spec_lang;
- infiles[n_infiles++].name = argv[i];
+ if (access (argv[i], R_OK) < 0)
+ {
+ perror_with_name (argv[i]);
+ error_count++;
+ }
+ else
+ {
+ infiles[n_infiles].language = spec_lang;
+ infiles[n_infiles++].name = argv[i];
+ }
}
}
@@ -3354,7 +3366,6 @@ main (argc, argv)
register int i;
int j;
int value;
- int error_count = 0;
int linker_was_run = 0;
char *explicit_link_files;
char *specs_file;