aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2014-11-05 22:17:22 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2014-11-05 22:17:22 +0000
commit10a241382b3fed4c7bb090fcc2b686d74eb99d6c (patch)
tree8249e806b1ac70a853b9112a20e3ef9a27d08c1f /gcc/gcc.c
parent14abf8cae10a18fc348df4e1ae93c6afc097d2cb (diff)
downloadgcc-10a241382b3fed4c7bb090fcc2b686d74eb99d6c.zip
gcc-10a241382b3fed4c7bb090fcc2b686d74eb99d6c.tar.gz
gcc-10a241382b3fed4c7bb090fcc2b686d74eb99d6c.tar.bz2
Revert revision 217149 because it breaks Ada:
gcc/testsuite/ChangeLog: 2014-11-05 Anthony Brandon <anthony.brandon@gmail.com> PR driver/36312 * gcc.misc-tests/output.exp: New test case for identical input and output files. include/ChangeLog: 2014-11-05 Anthony Brandon <anthony.brandon@gmail.com> PR driver/36312 * filenames.h: Add prototype for canonical_filename_eq. gcc/ChangeLog: 2014-11-05 Anthony Brandon <anthony.brandon@gmail.com> PR driver/36312 * diagnostic-core.h: Add prototype for fatal_error. * diagnostic.c (fatal_error): New function fatal_error. * gcc.c (store_arg): Remove have_o_argbuf_index. (process_command): Check if input and output files are the same. * toplev.c (init_asm_output): Check if input and output files are the same. libiberty/ChangeLog: 2014-11-05 Anthony Brandon <anthony.brandon@gmail.com> PR driver/36312 * filename_cmp.c (canonical_filename_eq): New function to check if file names are the same. * functions.texi: Updated with documentation for new function. From-SVN: r217159
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 6f144de..e013d52 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1702,15 +1702,17 @@ typedef const char *const_char_p; /* For DEF_VEC_P. */
static vec<const_char_p> argbuf;
+/* Position in the argbuf vector containing the name of the output file
+ (the value associated with the "-o" flag). */
+
+static int have_o_argbuf_index = 0;
+
/* Were the options -c, -S or -E passed. */
static int have_c = 0;
/* Was the option -o passed. */
static int have_o = 0;
-/* Pointer to output file name passed in with -o. */
-static const char *output_file = 0;
-
/* This is the list of suffixes and codes (%g/%u/%U/%j) and the associated
temp file. If the HOST_BIT_BUCKET is used for %j, no entry is made for
it here. */
@@ -1760,6 +1762,8 @@ store_arg (const char *arg, int delete_always, int delete_failure)
{
argbuf.safe_push (arg);
+ if (strcmp (arg, "-o") == 0)
+ have_o_argbuf_index = argbuf.length ();
if (delete_always || delete_failure)
{
const char *p;
@@ -3709,7 +3713,6 @@ driver_handle_option (struct gcc_options *opts,
#if defined(HAVE_TARGET_EXECUTABLE_SUFFIX) || defined(HAVE_TARGET_OBJECT_SUFFIX)
arg = convert_filename (arg, ! have_c, 0);
#endif
- output_file = arg;
/* Save the output name in case -save-temps=obj was used. */
save_temps_prefix = xstrdup (arg);
/* On some systems, ld cannot handle "-o" without a space. So
@@ -4049,14 +4052,6 @@ process_command (unsigned int decoded_options_count,
CL_DRIVER, &handlers, global_dc);
}
- if (output_file && strcmp (output_file, "-"))
- {
- int i;
- for (i = 0; i < n_infiles; i++)
- if (canonical_filename_eq (infiles[i].name, output_file))
- fatal_error ("output file %s is the same as input file", output_file);
- }
-
/* If -save-temps=obj and -o name, create the prefix to use for %b.
Otherwise just make -save-temps=obj the same as -save-temps=cwd. */
if (save_temps_flag == SAVE_TEMPS_OBJ && save_temps_prefix != NULL)