opts.o opts-common.o options.o vec.o hooks.o common/common-targhooks.o \
hash-table.o file-find.o
+OBJS-diagnostics-common = \
+ $(common_out_object_file) prefix.o params.o \
+ opts.o opts-common.o options.o hooks.o common/common-targhooks.o
+
# This lists all host objects for the front ends.
ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS))
collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS)
# Don't try modifying collect2 (aka ld) in place--it might be linking this.
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o T$@ \
- $(COLLECT2_OBJS) $(LIBS) $(COLLECT2_LIBS)
+ $(COLLECT2_OBJS) $(LIBS) $(COLLECT2_LIBS) $(OBJS-diagnostics-common)
mv -f T$@ $@
CFLAGS-collect2.o += -DTARGET_MACHINE=\"$(target_noncanonical)\" \
GCOV_OBJS = gcov.o
gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_OBJS) \
- hash-table.o ggc-none.o $(LIBS) -o $@
+ hash-table.o ggc-none.o $(LIBS) \
+ $(OBJS-diagnostics-common) -o $@
GCOV_DUMP_OBJS = gcov-dump.o
gcov-dump$(exeext): $(GCOV_DUMP_OBJS) $(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_DUMP_OBJS) \
hash-table.o ggc-none.o\
- $(LIBS) -o $@
+ $(LIBS) $(OBJS-diagnostics-common) -o $@
GCOV_TOOL_DEP_FILES = $(srcdir)/../libgcc/libgcov-util.c gcov-io.c $(GCOV_IO_H) \
$(srcdir)/../libgcc/libgcov-driver.c $(srcdir)/../libgcc/libgcov-driver-system.c \
-DIN_GCOV_TOOL=1 -o $@ $<
GCOV_TOOL_OBJS = gcov-tool.o libgcov-util.o libgcov-driver-tool.o libgcov-merge-tool.o
gcov-tool$(exeext): $(GCOV_TOOL_OBJS) $(LIBDEPS)
- +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_TOOL_OBJS) $(LIBS) -o $@
+ +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_TOOL_OBJS) $(LIBS) \
+ $(OBJS-diagnostics-common) -o $@
#\f
# Build the include directories. The stamp files are stmp-* rather than
# s-* so that mostlyclean does not force the include directory to
Common Var(pedantic) Init(0) Warning
Issue warnings needed for strict compliance to the standard.
+Wprint-abs-path
+Common Var(flag_source_abs_path) Init(0)
+Print a absolute path to the source file.
+
Wreturn-local-addr
Common Var(warn_return_local_addr) Init(1) Warning
Warn about returning a pointer/reference to a local or temporary variable.
#include "coretypes.h"
#include "version.h"
#include "demangle.h"
+#include "options.h"
#include "intl.h"
#include "backtrace.h"
#include "diagnostic.h"
if (!strcmp (s.file, N_("<built-in>")))
return build_message_string ("%s%s:%s", locus_cs, s.file, locus_ce);
+ char *resolved_path = NULL;
+ if (flag_source_abs_path != 0)
+ resolved_path = realpath (s.file, NULL);
+
+ char *ret;
if (context->show_column)
- return build_message_string ("%s%s:%d:%d:%s", locus_cs, s.file, s.line,
- s.column, locus_ce);
+ ret = build_message_string ("%s%s:%d:%d:%s", locus_cs,
+ (!resolved_path ? s.file : resolved_path),
+ s.line, s.column, locus_ce);
else
- return build_message_string ("%s%s:%d:%s", locus_cs, s.file, s.line,
- locus_ce);
+ ret = build_message_string ("%s%s:%d:%s", locus_cs,
+ (!resolved_path ? s.file : resolved_path),
+ s.line, locus_ce);
+ free(resolved_path);
+ return ret;
}
/* Return a malloc'd string describing a location and the severity of the