aboutsummaryrefslogtreecommitdiff
path: root/gcc/collect-utils.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-01-30 16:15:00 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2015-01-30 16:15:00 +0000
commit40fecdd62f7d293a214dd71b81de5e0f1099bba7 (patch)
tree205b68f7ca81a40e0ec33999911c7cd124be49b1 /gcc/collect-utils.c
parent4811c44ee01bba9fd09fe5e2b6b9fc9be66b33c9 (diff)
downloadgcc-40fecdd62f7d293a214dd71b81de5e0f1099bba7.zip
gcc-40fecdd62f7d293a214dd71b81de5e0f1099bba7.tar.gz
gcc-40fecdd62f7d293a214dd71b81de5e0f1099bba7.tar.bz2
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. From-SVN: r220293
Diffstat (limited to 'gcc/collect-utils.c')
-rw-r--r--gcc/collect-utils.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/collect-utils.c b/gcc/collect-utils.c
index 001fb28..6bbe9eb 100644
--- a/gcc/collect-utils.c
+++ b/gcc/collect-utils.c
@@ -65,7 +65,7 @@ collect_wait (const char *prog, struct pex_obj *pex)
int status;
if (!pex_get_status (pex, 1, &status))
- fatal_error ("can't get program status: %m");
+ fatal_error (input_location, "can't get program status: %m");
pex_free (pex);
if (status)
@@ -73,7 +73,7 @@ collect_wait (const char *prog, struct pex_obj *pex)
if (WIFSIGNALED (status))
{
int sig = WTERMSIG (status);
- fatal_error ("%s terminated with signal %d [%s]%s",
+ fatal_error (input_location, "%s terminated with signal %d [%s]%s",
prog, sig, strsignal (sig),
WCOREDUMP (status) ? ", core dumped" : "");
}
@@ -89,7 +89,7 @@ do_wait (const char *prog, struct pex_obj *pex)
{
int ret = collect_wait (prog, pex);
if (ret != 0)
- fatal_error ("%s returned %d exit status", prog, ret);
+ fatal_error (input_location, "%s returned %d exit status", prog, ret);
if (response_file && !save_temps)
{
@@ -130,17 +130,20 @@ collect_execute (const char *prog, char **argv, const char *outname,
f = fopen (response_file, "w");
if (f == NULL)
- fatal_error ("could not open response file %s", response_file);
+ fatal_error (input_location, "could not open response file %s",
+ response_file);
status = writeargv (current_argv, f);
if (status)
- fatal_error ("could not write to response file %s", response_file);
+ fatal_error (input_location, "could not write to response file %s",
+ response_file);
status = fclose (f);
if (EOF == status)
- fatal_error ("could not close response file %s", response_file);
+ fatal_error (input_location, "could not close response file %s",
+ response_file);
response_arg = concat ("@", response_file, NULL);
response_argv[0] = argv0;
@@ -173,11 +176,11 @@ collect_execute (const char *prog, char **argv, const char *outname,
since we might not end up needing something that we could not find. */
if (argv[0] == 0)
- fatal_error ("cannot find '%s'", prog);
+ fatal_error (input_location, "cannot find '%s'", prog);
pex = pex_init (0, "collect2", NULL);
if (pex == NULL)
- fatal_error ("pex_init failed: %m");
+ fatal_error (input_location, "pex_init failed: %m");
errmsg = pex_run (pex, flags, argv[0], argv, outname,
errname, &err);
@@ -186,10 +189,10 @@ collect_execute (const char *prog, char **argv, const char *outname,
if (err != 0)
{
errno = err;
- fatal_error ("%s: %m", _(errmsg));
+ fatal_error (input_location, "%s: %m", _(errmsg));
}
else
- fatal_error (errmsg);
+ fatal_error (input_location, errmsg);
}
free (response_arg);