summaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-30 16:15:00 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-30 16:15:00 +0000
commitc05be8671d0c5eeffdd417faad91583e791083d7 (patch)
tree205b68f7ca81a40e0ec33999911c7cd124be49b1 /gcc/lto
parent29f68d21d683541a286f85185c7e6a9a0cb21e3d (diff)
downloadgcc-c05be8671d0c5eeffdd417faad91583e791083d7.tar.gz
Always pass explicit location to fatal_error.
The patch <https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00698.html> adding an overload for fatal_error that passes an explicit location broke gcc.pot regeneration because xgettext cannot handle function overloads with the diagnostic string argument in different positions. As the desired direction is for all diagnostics to have explicit locations, this patch addresses the regression by removing the version of fatal_error that does not pass a location, passing explicit input_location everywhere (in the hope that those will incrementally be changed to other locations, much as with the addition of a location argument to pedwarn some time ago - a lot of cases aren't meaningfully associated with a source file so UNKNOWN_LOCATION may be better). Note that this patch does not attempt to fix any existing issues with these diagnostics (such as wrongly starting with capital letters or ending with '.' or '\n'); it just adds the input_location argument. Bootstrapped with no regressions for x86_64-unknown-linux-gnu (Go excluded). gcc: * diagnostic.c (fatal_error (const char *, ...)): Remove function. * diagnostic-core.h (fatal_error (const char *, ...)): Remove prototype. * toplev.h (init_asm_output): Update comment on use of UNKNOWN_LOCATION with fatal_error. * cgraph.c, collect-utils.c, collect2.c, config/arc/arc.c, config/arc/arc.md, config/avr/avr.c, config/c6x/c6x.h, config/darwin.c, config/host-darwin.c, config/i386/host-cygwin.c, config/i386/intelmic-mkoffload.c, config/nios2/nios2.c, config/nvptx/mkoffload.c, config/nvptx/nvptx.h, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, gcc.c, gcov-io.h, gcov-tool.c, ggc-common.c, ggc-page.c, graph.c, ipa-inline-analysis.c, ipa-reference.c, lto-cgraph.c, lto-section-in.c, lto-streamer-in.c, lto-streamer.c, lto-wrapper.c, objc/objc-act.c, opts.c, passes.c, plugin.c, tlink.c, toplev.c, tree-streamer-in.c, varpool.c: All callers of fatal_error changed to pass input_location as first argument. gcc/c-family: * c-opts.c, c-pch.c, cppspec.c: All callers of fatal_error changed to pass input_location as first argument. gcc/cp: * class.c, except.c, parser.c, pt.c: All callers of fatal_error changed to pass input_location as first argument. gcc/fortran: * f95-lang.c, gfortranspec.c, trans-const.c, trans-expr.c: All callers of fatal_error changed to pass input_location as first argument. gcc/java: * class.c, expr.c, jcf-parse.c, jvspec.c: All callers of fatal_error changed to pass input_location as first argument. gcc/lto: * lto-object.c, lto-symtab.c, lto.c: All callers of fatal_error changed to pass input_location as first argument. libcc1: * plugin.cc: All callers of fatal_error changed to pass input_location as first argument. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220293 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog5
-rw-r--r--gcc/lto/lto-object.c14
-rw-r--r--gcc/lto/lto-symtab.c2
-rw-r--r--gcc/lto/lto.c31
4 files changed, 31 insertions, 21 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 98f256a035c..c77e6ccae40 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-30 Joseph Myers <joseph@codesourcery.com>
+
+ * lto-object.c, lto-symtab.c, lto.c: All callers of fatal_error
+ changed to pass input_location as first argument.
+
2014-12-11 Jan Hubicka <hubicka@ucw.cz>
* lto-symtab.c (lto_varpool_replace_node): Merge TLS models.
diff --git a/gcc/lto/lto-object.c b/gcc/lto/lto-object.c
index 08f351c1b4d..34dafb10dd2 100644
--- a/gcc/lto/lto-object.c
+++ b/gcc/lto/lto-object.c
@@ -208,9 +208,9 @@ lto_obj_file_close (lto_file *file)
if (errmsg != NULL)
{
if (err == 0)
- fatal_error ("%s", errmsg);
+ fatal_error (input_location, "%s", errmsg);
else
- fatal_error ("%s: %s", errmsg, xstrerror (err));
+ fatal_error (input_location, "%s: %s", errmsg, xstrerror (err));
}
simple_object_release_write (lo->sobj_w);
@@ -219,7 +219,7 @@ lto_obj_file_close (lto_file *file)
if (lo->fd != -1)
{
if (close (lo->fd) < 0)
- fatal_error ("close: %s", xstrerror (errno));
+ fatal_error (input_location, "close: %s", xstrerror (errno));
}
}
@@ -362,9 +362,9 @@ lto_obj_begin_section (const char *name)
if (lo->section == NULL)
{
if (err == 0)
- fatal_error ("%s", errmsg);
+ fatal_error (input_location, "%s", errmsg);
else
- fatal_error ("%s: %s", errmsg, xstrerror (errno));
+ fatal_error (input_location, "%s: %s", errmsg, xstrerror (errno));
}
}
@@ -386,9 +386,9 @@ lto_obj_append_data (const void *data, size_t len, void *)
if (errmsg != NULL)
{
if (err == 0)
- fatal_error ("%s", errmsg);
+ fatal_error (input_location, "%s", errmsg);
else
- fatal_error ("%s: %s", errmsg, xstrerror (errno));
+ fatal_error (input_location, "%s: %s", errmsg, xstrerror (errno));
}
}
diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index 98edb883440..39c9257edc0 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -382,7 +382,7 @@ lto_symtab_resolve_symbols (symtab_node *first)
&& (e->resolution == LDPR_PREVAILING_DEF_IRONLY
|| e->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP
|| e->resolution == LDPR_PREVAILING_DEF))
- fatal_error ("multiple prevailing defs for %qE",
+ fatal_error (input_location, "multiple prevailing defs for %qE",
DECL_NAME (prevailing->decl));
return prevailing;
}
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index a875edeef9a..c86f8358f35 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -2328,7 +2328,7 @@ lto_read_section_data (struct lto_file_decl_data *file_data,
fd = open (file_data->file_name, O_RDONLY|O_BINARY);
if (fd == -1)
{
- fatal_error ("Cannot open %s", file_data->file_name);
+ fatal_error (input_location, "Cannot open %s", file_data->file_name);
return NULL;
}
fd_name = xstrdup (file_data->file_name);
@@ -2349,7 +2349,7 @@ lto_read_section_data (struct lto_file_decl_data *file_data,
fd, computed_offset);
if (result == MAP_FAILED)
{
- fatal_error ("Cannot map %s", file_data->file_name);
+ fatal_error (input_location, "Cannot map %s", file_data->file_name);
return NULL;
}
@@ -2360,7 +2360,7 @@ lto_read_section_data (struct lto_file_decl_data *file_data,
|| read (fd, result, len) != (ssize_t) len)
{
free (result);
- fatal_error ("Cannot read %s", file_data->file_name);
+ fatal_error (input_location, "Cannot read %s", file_data->file_name);
result = NULL;
}
#ifdef __MINGW32__
@@ -2474,7 +2474,7 @@ do_stream_out (char *temp_filename, lto_symtab_encoder_t encoder)
{
lto_file *file = lto_obj_file_open (temp_filename, true);
if (!file)
- fatal_error ("lto_obj_file_open() failed");
+ fatal_error (input_location, "lto_obj_file_open() failed");
lto_set_current_out_file (file);
ipa_write_optimization_summaries (encoder);
@@ -2497,12 +2497,13 @@ wait_for_child ()
#endif
int w = waitpid (0, &status, WUNTRACED | WCONTINUED);
if (w == -1)
- fatal_error ("waitpid failed");
+ fatal_error (input_location, "waitpid failed");
if (WIFEXITED (status) && WEXITSTATUS (status))
- fatal_error ("streaming subprocess failed");
+ fatal_error (input_location, "streaming subprocess failed");
else if (WIFSIGNALED (status))
- fatal_error ("streaming subprocess was killed by signal");
+ fatal_error (input_location,
+ "streaming subprocess was killed by signal");
}
while (!WIFEXITED (status) && !WIFSIGNALED (status));
}
@@ -2578,7 +2579,7 @@ lto_wpa_write_files (void)
/* Open the LTRANS output list. */
if (!ltrans_output_list)
- fatal_error ("no LTRANS output list filename provided");
+ fatal_error (input_location, "no LTRANS output list filename provided");
timevar_push (TV_WHOPR_WPA);
@@ -2665,13 +2666,14 @@ lto_wpa_write_files (void)
}
ltrans_output_list_stream = fopen (ltrans_output_list, "w");
if (ltrans_output_list_stream == NULL)
- fatal_error ("opening LTRANS output list %s: %m", ltrans_output_list);
+ fatal_error (input_location,
+ "opening LTRANS output list %s: %m", ltrans_output_list);
for (i = 0; i < n_sets; i++)
{
unsigned int len = strlen (temp_filenames[i]);
if (fwrite (temp_filenames[i], 1, len, ltrans_output_list_stream) < len
|| fwrite ("\n", 1, 1, ltrans_output_list_stream) < 1)
- fatal_error ("writing to LTRANS output list %s: %m",
+ fatal_error (input_location, "writing to LTRANS output list %s: %m",
ltrans_output_list);
free (temp_filenames[i]);
}
@@ -2681,7 +2683,8 @@ lto_wpa_write_files (void)
/* Close the LTRANS output list. */
if (fclose (ltrans_output_list_stream))
- fatal_error ("closing LTRANS output list %s: %m", ltrans_output_list);
+ fatal_error (input_location,
+ "closing LTRANS output list %s: %m", ltrans_output_list);
free_ltrans_partitions();
free (temp_filename);
@@ -2927,7 +2930,8 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
resolution = fopen (resolution_file_name, "r");
if (resolution == NULL)
- fatal_error ("could not open symbol resolution file: %m");
+ fatal_error (input_location,
+ "could not open symbol resolution file: %m");
t = fscanf (resolution, "%u", &num_objects);
gcc_assert (t == 1);
@@ -3067,7 +3071,8 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
/* If there were errors during symbol merging bail out, we have no
good way to recover here. */
if (seen_error ())
- fatal_error ("errors during merging of translation units");
+ fatal_error (input_location,
+ "errors during merging of translation units");
/* Fixup all decls. */
lto_fixup_decls (all_file_decl_data);