From 40fecdd62f7d293a214dd71b81de5e0f1099bba7 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 30 Jan 2015 16:15:00 +0000 Subject: Always pass explicit location to fatal_error. The patch 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 --- gcc/ggc-common.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'gcc/ggc-common.c') diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 524e85e..03fbe7d 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -395,7 +395,7 @@ write_pch_globals (const struct ggc_root_tab * const *tab, { if (fwrite (&ptr, sizeof (void *), 1, state->f) != 1) - fatal_error ("can%'t write PCH file: %m"); + fatal_error (input_location, "can%'t write PCH file: %m"); } else { @@ -403,7 +403,7 @@ write_pch_globals (const struct ggc_root_tab * const *tab, saving_htab->find_with_hash (ptr, POINTER_HASH (ptr)); if (fwrite (&new_ptr->new_addr, sizeof (void *), 1, state->f) != 1) - fatal_error ("can%'t write PCH file: %m"); + fatal_error (input_location, "can%'t write PCH file: %m"); } } } @@ -472,7 +472,7 @@ gt_pch_save (FILE *f) for (rt = gt_pch_scalar_rtab; *rt; rt++) for (rti = *rt; rti->base != NULL; rti++) if (fwrite (rti->base, rti->stride, 1, f) != 1) - fatal_error ("can%'t write PCH file: %m"); + fatal_error (input_location, "can%'t write PCH file: %m"); /* Write out all the global pointers, after translation. */ write_pch_globals (gt_ggc_rtab, &state); @@ -483,17 +483,17 @@ gt_pch_save (FILE *f) long o; o = ftell (state.f) + sizeof (mmi); if (o == -1) - fatal_error ("can%'t get position in PCH file: %m"); + fatal_error (input_location, "can%'t get position in PCH file: %m"); mmi.offset = mmap_offset_alignment - o % mmap_offset_alignment; if (mmi.offset == mmap_offset_alignment) mmi.offset = 0; mmi.offset += o; } if (fwrite (&mmi, sizeof (mmi), 1, state.f) != 1) - fatal_error ("can%'t write PCH file: %m"); + fatal_error (input_location, "can%'t write PCH file: %m"); if (mmi.offset != 0 && fseek (state.f, mmi.offset, SEEK_SET) != 0) - fatal_error ("can%'t write padding to PCH file: %m"); + fatal_error (input_location, "can%'t write padding to PCH file: %m"); ggc_pch_prepare_write (state.d, state.f); @@ -615,7 +615,7 @@ gt_pch_restore (FILE *f) for (rt = gt_pch_scalar_rtab; *rt; rt++) for (rti = *rt; rti->base != NULL; rti++) if (fread (rti->base, rti->stride, 1, f) != 1) - fatal_error ("can%'t read PCH file: %m"); + fatal_error (input_location, "can%'t read PCH file: %m"); /* Read in all the global pointers, in 6 easy loops. */ for (rt = gt_ggc_rtab; *rt; rt++) @@ -623,23 +623,23 @@ gt_pch_restore (FILE *f) for (i = 0; i < rti->nelt; i++) if (fread ((char *)rti->base + rti->stride * i, sizeof (void *), 1, f) != 1) - fatal_error ("can%'t read PCH file: %m"); + fatal_error (input_location, "can%'t read PCH file: %m"); if (fread (&mmi, sizeof (mmi), 1, f) != 1) - fatal_error ("can%'t read PCH file: %m"); + fatal_error (input_location, "can%'t read PCH file: %m"); result = host_hooks.gt_pch_use_address (mmi.preferred_base, mmi.size, fileno (f), mmi.offset); if (result < 0) - fatal_error ("had to relocate PCH"); + fatal_error (input_location, "had to relocate PCH"); if (result == 0) { if (fseek (f, mmi.offset, SEEK_SET) != 0 || fread (mmi.preferred_base, mmi.size, 1, f) != 1) - fatal_error ("can%'t read PCH file: %m"); + fatal_error (input_location, "can%'t read PCH file: %m"); } else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0) - fatal_error ("can%'t read PCH file: %m"); + fatal_error (input_location, "can%'t read PCH file: %m"); ggc_pch_read (f, mmi.preferred_base); -- cgit v1.1