Commit 414d23ae by Hans-Peter Nilsson Committed by Hans-Peter Nilsson

Makefile.in (RUN_GEN, [...]): New variables.

	* Makefile.in (RUN_GEN, VALGRIND_DRIVER_DEFINES): New variables.
	(DRIVER_DEFINES): Add $(VALGRIND_DRIVER_DEFINES).
	(executing gencheck, genconfigs, genconditions, genflags,
	gencodes, genconstants, genemit, genrecog, genopinit, genextract,
	genpeep, genattr, genattrtab, genoutput, gengenrtl, genpreds,
	gengtype, genprotos): Prepend $(RUN_GEN).
	* configure.in: Move host compiler tests before --enable-checking
	tests.
	(--enable-checking=valgrind): New.
	* config.in, configure: Regenerate.
	* cppfiles.c [!ENABLE_VALGRIND_CHECKING] (VALGRIND_DISCARD):
	Define as empty.
	(read_include_file): When doing the mmap+1 trick,
	valgrind-annotate the byte after the mmap:ed area as readable.
	(purge_cache): Remove above annotation.
	* gcc.c (execute) [ENABLE_VALGRIND_CHECKING]: Arrange to prepend
	VALGRIND_PATH -q to each command.

From-SVN: r59309
parent 3ba2436a
2002-11-20 Hans-Peter Nilsson <hp@bitrange.com>
* Makefile.in (RUN_GEN, VALGRIND_DRIVER_DEFINES): New variables.
(DRIVER_DEFINES): Add $(VALGRIND_DRIVER_DEFINES).
(executing gencheck, genconfigs, genconditions, genflags,
gencodes, genconstants, genemit, genrecog, genopinit, genextract,
genpeep, genattr, genattrtab, genoutput, gengenrtl, genpreds,
gengtype, genprotos): Prepend $(RUN_GEN).
* configure.in: Move host compiler tests before --enable-checking
tests.
(--enable-checking=valgrind): New.
* config.in, configure: Regenerate.
* cppfiles.c [!ENABLE_VALGRIND_CHECKING] (VALGRIND_DISCARD):
Define as empty.
(read_include_file): When doing the mmap+1 trick,
valgrind-annotate the byte after the mmap:ed area as readable.
(purge_cache): Remove above annotation.
* gcc.c (execute) [ENABLE_VALGRIND_CHECKING]: Arrange to prepend
VALGRIND_PATH -q to each command.
2002-11-20 Ulrich Weigand <uweigand@de.ibm.com> 2002-11-20 Ulrich Weigand <uweigand@de.ibm.com>
* recog.c (constrain_operands): Prefer exact match over reloadable * recog.c (constrain_operands): Prefer exact match over reloadable
......
...@@ -96,6 +96,10 @@ STRICT2_WARN = -Wtraditional -pedantic -Wno-long-long ...@@ -96,6 +96,10 @@ STRICT2_WARN = -Wtraditional -pedantic -Wno-long-long
# "extern" tags in header files. # "extern" tags in header files.
NOCOMMON_FLAG = @nocommon_flag@ NOCOMMON_FLAG = @nocommon_flag@
# These are set by --enable-checking=valgrind.
RUN_GEN = @valgrind_command@
VALGRIND_DRIVER_DEFINES = @valgrind_path_defines@
# This is how we control whether or not the additional warnings are applied. # This is how we control whether or not the additional warnings are applied.
.-warn = $(STRICT_WARN) .-warn = $(STRICT_WARN)
GCC_WARN_CFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG) GCC_WARN_CFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG)
...@@ -1260,6 +1264,7 @@ DRIVER_DEFINES = \ ...@@ -1260,6 +1264,7 @@ DRIVER_DEFINES = \
-DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \ -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
-DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \ -DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \
-DTOOLDIR_BASE_PREFIX=\"$(unlibsubdir)/../\" \ -DTOOLDIR_BASE_PREFIX=\"$(unlibsubdir)/../\" \
$(VALGRIND_DRIVER_DEFINES) \
`test "X$${SHLIB_LINK}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \ `test "X$${SHLIB_LINK}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \
`test "X$${SHLIB_MULTILIB}" = "X" || echo "-DNO_SHARED_LIBGCC_MULTILIB"` `test "X$${SHLIB_MULTILIB}" = "X" || echo "-DNO_SHARED_LIBGCC_MULTILIB"`
...@@ -1282,7 +1287,7 @@ cppspec.o: cppspec.c $(CONFIG_H) $(SYSTEM_H) $(GCC_H) ...@@ -1282,7 +1287,7 @@ cppspec.o: cppspec.c $(CONFIG_H) $(SYSTEM_H) $(GCC_H)
tree-check.h: s-check ; @true tree-check.h: s-check ; @true
s-check : gencheck$(build_exeext) $(srcdir)/move-if-change s-check : gencheck$(build_exeext) $(srcdir)/move-if-change
./gencheck$(build_exeext) > tmp-check.h $(RUN_GEN) ./gencheck$(build_exeext) > tmp-check.h
$(SHELL) $(srcdir)/move-if-change tmp-check.h tree-check.h $(SHELL) $(srcdir)/move-if-change tmp-check.h tree-check.h
$(STAMP) s-check $(STAMP) s-check
...@@ -1690,13 +1695,13 @@ mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H) ...@@ -1690,13 +1695,13 @@ mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H)
insn-config.h: s-config ; @true insn-config.h: s-config ; @true
s-config : $(md_file) genconfig$(build_exeext) $(srcdir)/move-if-change s-config : $(md_file) genconfig$(build_exeext) $(srcdir)/move-if-change
./genconfig$(build_exeext) $(md_file) > tmp-config.h $(RUN_GEN) ./genconfig$(build_exeext) $(md_file) > tmp-config.h
$(SHELL) $(srcdir)/move-if-change tmp-config.h insn-config.h $(SHELL) $(srcdir)/move-if-change tmp-config.h insn-config.h
$(STAMP) s-config $(STAMP) s-config
insn-conditions.c: s-conditions ; @true insn-conditions.c: s-conditions ; @true
s-conditions : $(md_file) genconditions$(build_exeext) $(srcdir)/move-if-change s-conditions : $(md_file) genconditions$(build_exeext) $(srcdir)/move-if-change
./genconditions$(build_exeext) $(md_file) > tmp-conditions.c $(RUN_GEN) ./genconditions$(build_exeext) $(md_file) > tmp-conditions.c
$(SHELL) $(srcdir)/move-if-change tmp-conditions.c insn-conditions.c $(SHELL) $(srcdir)/move-if-change tmp-conditions.c insn-conditions.c
$(STAMP) s-conditions $(STAMP) s-conditions
...@@ -1711,19 +1716,19 @@ dummy-conditions.o : dummy-conditions.c $(HCONFIG_H) $(SYSTEM_H) gensupport.h ...@@ -1711,19 +1716,19 @@ dummy-conditions.o : dummy-conditions.c $(HCONFIG_H) $(SYSTEM_H) gensupport.h
insn-flags.h: s-flags ; @true insn-flags.h: s-flags ; @true
s-flags : $(md_file) genflags$(build_exeext) $(srcdir)/move-if-change s-flags : $(md_file) genflags$(build_exeext) $(srcdir)/move-if-change
./genflags$(build_exeext) $(md_file) > tmp-flags.h $(RUN_GEN) ./genflags$(build_exeext) $(md_file) > tmp-flags.h
$(SHELL) $(srcdir)/move-if-change tmp-flags.h insn-flags.h $(SHELL) $(srcdir)/move-if-change tmp-flags.h insn-flags.h
$(STAMP) s-flags $(STAMP) s-flags
insn-codes.h: s-codes ; @true insn-codes.h: s-codes ; @true
s-codes : $(md_file) gencodes$(build_exeext) $(srcdir)/move-if-change s-codes : $(md_file) gencodes$(build_exeext) $(srcdir)/move-if-change
./gencodes$(build_exeext) $(md_file) > tmp-codes.h $(RUN_GEN) ./gencodes$(build_exeext) $(md_file) > tmp-codes.h
$(SHELL) $(srcdir)/move-if-change tmp-codes.h insn-codes.h $(SHELL) $(srcdir)/move-if-change tmp-codes.h insn-codes.h
$(STAMP) s-codes $(STAMP) s-codes
insn-constants.h: s-constants ; @true insn-constants.h: s-constants ; @true
s-constants : $(md_file) genconstants$(build_exeext) $(srcdir)/move-if-change s-constants : $(md_file) genconstants$(build_exeext) $(srcdir)/move-if-change
./genconstants$(build_exeext) $(md_file) > tmp-constants.h $(RUN_GEN) ./genconstants$(build_exeext) $(md_file) > tmp-constants.h
$(SHELL) $(srcdir)/move-if-change tmp-constants.h insn-constants.h $(SHELL) $(srcdir)/move-if-change tmp-constants.h insn-constants.h
$(STAMP) s-constants $(STAMP) s-constants
...@@ -1735,7 +1740,7 @@ insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) $(EXPR_H) real.h output.h \ ...@@ -1735,7 +1740,7 @@ insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) $(EXPR_H) real.h output.h \
insn-emit.c: s-emit ; @true insn-emit.c: s-emit ; @true
s-emit : $(md_file) genemit$(build_exeext) $(srcdir)/move-if-change s-emit : $(md_file) genemit$(build_exeext) $(srcdir)/move-if-change
./genemit$(build_exeext) $(md_file) > tmp-emit.c $(RUN_GEN) ./genemit$(build_exeext) $(md_file) > tmp-emit.c
$(SHELL) $(srcdir)/move-if-change tmp-emit.c insn-emit.c $(SHELL) $(srcdir)/move-if-change tmp-emit.c insn-emit.c
$(STAMP) s-emit $(STAMP) s-emit
...@@ -1747,7 +1752,7 @@ insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \ ...@@ -1747,7 +1752,7 @@ insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \
insn-recog.c: s-recog ; @true insn-recog.c: s-recog ; @true
s-recog : $(md_file) genrecog$(build_exeext) $(srcdir)/move-if-change s-recog : $(md_file) genrecog$(build_exeext) $(srcdir)/move-if-change
./genrecog$(build_exeext) $(md_file) > tmp-recog.c $(RUN_GEN) ./genrecog$(build_exeext) $(md_file) > tmp-recog.c
$(SHELL) $(srcdir)/move-if-change tmp-recog.c insn-recog.c $(SHELL) $(srcdir)/move-if-change tmp-recog.c insn-recog.c
$(STAMP) s-recog $(STAMP) s-recog
...@@ -1758,7 +1763,7 @@ insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) \ ...@@ -1758,7 +1763,7 @@ insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) \
insn-opinit.c: s-opinit ; @true insn-opinit.c: s-opinit ; @true
s-opinit : $(md_file) genopinit$(build_exeext) $(srcdir)/move-if-change s-opinit : $(md_file) genopinit$(build_exeext) $(srcdir)/move-if-change
./genopinit$(build_exeext) $(md_file) > tmp-opinit.c $(RUN_GEN) ./genopinit$(build_exeext) $(md_file) > tmp-opinit.c
$(SHELL) $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c $(SHELL) $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
$(STAMP) s-opinit $(STAMP) s-opinit
...@@ -1769,7 +1774,7 @@ insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H) toplev.h \ ...@@ -1769,7 +1774,7 @@ insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H) toplev.h \
insn-extract.c: s-extract ; @true insn-extract.c: s-extract ; @true
s-extract : $(md_file) genextract$(build_exeext) $(srcdir)/move-if-change s-extract : $(md_file) genextract$(build_exeext) $(srcdir)/move-if-change
./genextract$(build_exeext) $(md_file) > tmp-extract.c $(RUN_GEN) ./genextract$(build_exeext) $(md_file) > tmp-extract.c
$(SHELL) $(srcdir)/move-if-change tmp-extract.c insn-extract.c $(SHELL) $(srcdir)/move-if-change tmp-extract.c insn-extract.c
$(STAMP) s-extract $(STAMP) s-extract
...@@ -1780,7 +1785,7 @@ insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h \ ...@@ -1780,7 +1785,7 @@ insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h \
insn-peep.c: s-peep ; @true insn-peep.c: s-peep ; @true
s-peep : $(md_file) genpeep$(build_exeext) $(srcdir)/move-if-change s-peep : $(md_file) genpeep$(build_exeext) $(srcdir)/move-if-change
./genpeep$(build_exeext) $(md_file) > tmp-peep.c $(RUN_GEN) ./genpeep$(build_exeext) $(md_file) > tmp-peep.c
$(SHELL) $(srcdir)/move-if-change tmp-peep.c insn-peep.c $(SHELL) $(srcdir)/move-if-change tmp-peep.c insn-peep.c
$(STAMP) s-peep $(STAMP) s-peep
...@@ -1792,13 +1797,13 @@ insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \ ...@@ -1792,13 +1797,13 @@ insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \
insn-attr.h: s-attr ; @true insn-attr.h: s-attr ; @true
s-attr : $(md_file) genattr$(build_exeext) $(srcdir)/move-if-change s-attr : $(md_file) genattr$(build_exeext) $(srcdir)/move-if-change
./genattr$(build_exeext) $(md_file) > tmp-attr.h $(RUN_GEN) ./genattr$(build_exeext) $(md_file) > tmp-attr.h
$(SHELL) $(srcdir)/move-if-change tmp-attr.h insn-attr.h $(SHELL) $(srcdir)/move-if-change tmp-attr.h insn-attr.h
$(STAMP) s-attr $(STAMP) s-attr
insn-attrtab.c: s-attrtab ; @true insn-attrtab.c: s-attrtab ; @true
s-attrtab : $(md_file) genattrtab$(build_exeext) $(srcdir)/move-if-change s-attrtab : $(md_file) genattrtab$(build_exeext) $(srcdir)/move-if-change
./genattrtab$(build_exeext) $(md_file) > tmp-attrtab.c $(RUN_GEN) ./genattrtab$(build_exeext) $(md_file) > tmp-attrtab.c
$(SHELL) $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c $(SHELL) $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
$(STAMP) s-attrtab $(STAMP) s-attrtab
...@@ -1811,7 +1816,7 @@ insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(GGC_H) $(REGS_H) real.h \ ...@@ -1811,7 +1816,7 @@ insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(GGC_H) $(REGS_H) real.h \
insn-output.c: s-output ; @true insn-output.c: s-output ; @true
s-output : $(md_file) genoutput$(build_exeext) $(srcdir)/move-if-change s-output : $(md_file) genoutput$(build_exeext) $(srcdir)/move-if-change
./genoutput$(build_exeext) $(md_file) > tmp-output.c $(RUN_GEN) ./genoutput$(build_exeext) $(md_file) > tmp-output.c
$(SHELL) $(srcdir)/move-if-change tmp-output.c insn-output.c $(SHELL) $(srcdir)/move-if-change tmp-output.c insn-output.c
$(STAMP) s-output $(STAMP) s-output
...@@ -1820,16 +1825,16 @@ genrtl.c genrtl.h : s-genrtl ...@@ -1820,16 +1825,16 @@ genrtl.c genrtl.h : s-genrtl
@true # force gnu make to recheck modification times. @true # force gnu make to recheck modification times.
s-genrtl: gengenrtl$(build_exeext) $(srcdir)/move-if-change $(RTL_BASE_H) s-genrtl: gengenrtl$(build_exeext) $(srcdir)/move-if-change $(RTL_BASE_H)
./gengenrtl$(build_exeext) -h > tmp-genrtl.h $(RUN_GEN) ./gengenrtl$(build_exeext) -h > tmp-genrtl.h
$(SHELL) $(srcdir)/move-if-change tmp-genrtl.h genrtl.h $(SHELL) $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
./gengenrtl$(build_exeext) > tmp-genrtl.c $(RUN_GEN) ./gengenrtl$(build_exeext) > tmp-genrtl.c
$(SHELL) $(srcdir)/move-if-change tmp-genrtl.c genrtl.c $(SHELL) $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
$(STAMP) s-genrtl $(STAMP) s-genrtl
tm-preds.h: s-preds; @true tm-preds.h: s-preds; @true
s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change
./genpreds$(build_exeext) > tmp-preds.h $(RUN_GEN) ./genpreds$(build_exeext) > tmp-preds.h
$(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h $(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h
$(STAMP) s-preds $(STAMP) s-preds
...@@ -1894,7 +1899,7 @@ gtyp-gen.h: Makefile ...@@ -1894,7 +1899,7 @@ gtyp-gen.h: Makefile
$(SHELL) $(srcdir)/move-if-change tmp-gtyp.h gtyp-gen.h $(SHELL) $(srcdir)/move-if-change tmp-gtyp.h gtyp-gen.h
s-gtype: gengtype$(build_exeext) $(GTFILES) s-gtype: gengtype$(build_exeext) $(GTFILES)
./gengtype $(RUN_GEN) ./gengtype
$(STAMP) s-gtype $(STAMP) s-gtype
# #
...@@ -2402,7 +2407,7 @@ xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos$(build_ ...@@ -2402,7 +2407,7 @@ xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos$(build_
mv tmp-fixtmp.c fixtmp.c mv tmp-fixtmp.c fixtmp.c
$(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \ $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
| sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \ | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
| ./gen-protos >xsys-protos.hT | $(RUN_GEN) ./gen-protos >xsys-protos.hT
mv xsys-protos.hT xsys-protos.h mv xsys-protos.hT xsys-protos.h
rm -rf fixtmp.c rm -rf fixtmp.c
......
...@@ -279,6 +279,39 @@ ...@@ -279,6 +279,39 @@
/* Define to enable the use of a default assembler. */ /* Define to enable the use of a default assembler. */
#undef DEFAULT_ASSEMBLER #undef DEFAULT_ASSEMBLER
/* Define if your compiler understands volatile. */
#undef HAVE_VOLATILE
/* Define if your compiler supports the `long double' type. */
#undef HAVE_LONG_DOUBLE
/* Define if your compiler supports the `long long' type. */
#undef HAVE_LONG_LONG
/* Define if your compiler supports the `__int64' type. */
#undef HAVE___INT64
/* Define if the `_Bool' type is built-in. */
#undef HAVE__BOOL
/* The number of bytes in type short */
#undef SIZEOF_SHORT
/* The number of bytes in type int */
#undef SIZEOF_INT
/* The number of bytes in type long */
#undef SIZEOF_LONG
/* The number of bytes in type long long */
#undef SIZEOF_LONG_LONG
/* The number of bytes in type __int64 */
#undef SIZEOF___INT64
/* Define if the host execution character set is EBCDIC. */
#undef HOST_EBCDIC
/* Define if you want more run-time sanity checks. This one gets a grab /* Define if you want more run-time sanity checks. This one gets a grab
bag of miscellaneous but relatively cheap checks. */ bag of miscellaneous but relatively cheap checks. */
#undef ENABLE_CHECKING #undef ENABLE_CHECKING
...@@ -307,6 +340,10 @@ ...@@ -307,6 +340,10 @@
every opportunity. This is extremely expensive. */ every opportunity. This is extremely expensive. */
#undef ENABLE_GC_ALWAYS_COLLECT #undef ENABLE_GC_ALWAYS_COLLECT
/* Define if you want to run subprograms and generated programs
through valgrind (a memory checker). This is extremely expensive. */
#undef ENABLE_VALGRIND_CHECKING
/* Define if you want to use __cxa_atexit, rather than atexit, to /* Define if you want to use __cxa_atexit, rather than atexit, to
register C++ destructors for local statics and global objects. register C++ destructors for local statics and global objects.
This is essential for fully standards-compliant handling of This is essential for fully standards-compliant handling of
...@@ -317,39 +354,6 @@ ...@@ -317,39 +354,6 @@
character sets for source code. */ character sets for source code. */
#undef MULTIBYTE_CHARS #undef MULTIBYTE_CHARS
/* Define if your compiler understands volatile. */
#undef HAVE_VOLATILE
/* Define if your compiler supports the `long double' type. */
#undef HAVE_LONG_DOUBLE
/* Define if your compiler supports the `long long' type. */
#undef HAVE_LONG_LONG
/* Define if your compiler supports the `__int64' type. */
#undef HAVE___INT64
/* Define if the `_Bool' type is built-in. */
#undef HAVE__BOOL
/* The number of bytes in type short */
#undef SIZEOF_SHORT
/* The number of bytes in type int */
#undef SIZEOF_INT
/* The number of bytes in type long */
#undef SIZEOF_LONG
/* The number of bytes in type long long */
#undef SIZEOF_LONG_LONG
/* The number of bytes in type __int64 */
#undef SIZEOF___INT64
/* Define if the host execution character set is EBCDIC. */
#undef HOST_EBCDIC
/* Always define this when using the GNU C Library */ /* Always define this when using the GNU C Library */
#undef _GNU_SOURCE #undef _GNU_SOURCE
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -176,6 +176,82 @@ changequote([, ])dnl ...@@ -176,6 +176,82 @@ changequote([, ])dnl
fi fi
fi fi
# Find the native compiler
AC_PROG_CC
AC_PROG_CC_C_O
# autoconf is lame and doesn't give us any substitution variable for this.
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
NO_MINUS_C_MINUS_O=yes
else
OUTPUT_OPTION='-o $@'
fi
AC_SUBST(NO_MINUS_C_MINUS_O)
AC_SUBST(OUTPUT_OPTION)
# See if GNAT has been installed
gcc_AC_PROG_GNAT
AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
ac_cv_prog_cc_no_long_long,
[save_CFLAGS="$CFLAGS"
CFLAGS="-Wno-long-long"
AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
ac_cv_prog_cc_no_long_long=no)
CFLAGS="$save_CFLAGS"])
if test x$have_gnat != xno ; then
AC_CACHE_CHECK(whether ${ADAC} accepts -Wno-long-long,
ac_cv_prog_adac_no_long_long,
[cat >conftest.adb <<EOF
procedure conftest is begin null; end conftest;
EOF
if $ADAC -Wno-long-long -c conftest.adb 1>&5 2>&5 ; then
ac_cv_prog_adac_no_long_long=yes
else
ac_cv_prog_adac_no_long_long=no
fi
rm -f conftest*])
else
ac_cv_prog_adac_no_long_long=yes
fi
strict1_warn=
if test $ac_cv_prog_cc_no_long_long = yes && \
test $ac_cv_prog_adac_no_long_long = yes ; then
strict1_warn="-pedantic -Wno-long-long"
fi
AC_SUBST(strict1_warn)
AC_PROG_CPP
AC_C_INLINE
gcc_AC_C_VOLATILE
gcc_AC_C_LONG_DOUBLE
gcc_AC_C_LONG_LONG
gcc_AC_C__BOOL
# sizeof(char) is 1 by definition.
gcc_AC_COMPILE_CHECK_SIZEOF(short)
gcc_AC_COMPILE_CHECK_SIZEOF(int)
gcc_AC_COMPILE_CHECK_SIZEOF(long)
if test $ac_cv_c_long_long = yes; then
gcc_AC_COMPILE_CHECK_SIZEOF(long long)
fi
if test $ac_cv_c___int64 = yes; then
gcc_AC_COMPILE_CHECK_SIZEOF(__int64)
fi
gcc_AC_C_CHARSET
# If the native compiler is GCC, we can enable warnings even in stage1.
# That's useful for people building cross-compilers, or just running a
# quick `make'.
warn_cflags=
if test "x$GCC" = "xyes"; then
warn_cflags='$(GCC_WARN_CFLAGS)'
fi
AC_SUBST(warn_cflags)
# Determine whether or not multilibs are enabled. # Determine whether or not multilibs are enabled.
AC_ARG_ENABLE(multilib, AC_ARG_ENABLE(multilib,
[ --enable-multilib enable library support for multiple ABIs], [ --enable-multilib enable library support for multiple ABIs],
...@@ -211,6 +287,7 @@ no) ;; ...@@ -211,6 +287,7 @@ no) ;;
rtl) ac_rtl_checking=1 ;; rtl) ac_rtl_checking=1 ;;
gc) ac_gc_checking=1 ;; gc) ac_gc_checking=1 ;;
gcac) ac_gc_always_collect=1 ;; gcac) ac_gc_always_collect=1 ;;
valgrind) ac_checking_valgrind=1 ;;
*) AC_MSG_ERROR(unknown check category $check) ;; *) AC_MSG_ERROR(unknown check category $check) ;;
esac esac
done done
...@@ -256,6 +333,25 @@ if test x$ac_gc_always_collect != x ; then ...@@ -256,6 +333,25 @@ if test x$ac_gc_always_collect != x ; then
paranoid mode, validating the entire heap and collecting garbage at paranoid mode, validating the entire heap and collecting garbage at
every opportunity. This is extremely expensive.]) every opportunity. This is extremely expensive.])
fi fi
valgrind_path_defines=
valgrind_command=
if test x$ac_checking_valgrind != x ; then
# It is certainly possible that there's valgrind but no valgrind.h.
# GCC relies on making annotations so we must have both.
AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
[$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
if test "x$valgrind_path" = "x" || test $have_valgrind_h = no; then
AC_MSG_ERROR([*** Can't find both valgrind and valgrind.h])
fi
valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
valgrind_command="$valgrind_path -q"
AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
[Define if you want to run subprograms and generated programs
through valgrind (a memory checker). This is extremely expensive.])
fi
AC_SUBST(valgrind_path_defines)
AC_SUBST(valgrind_command)
# Enable code coverage collection # Enable code coverage collection
AC_ARG_ENABLE(coverage, AC_ARG_ENABLE(coverage,
...@@ -379,82 +475,6 @@ AC_CANONICAL_SYSTEM ...@@ -379,82 +475,6 @@ AC_CANONICAL_SYSTEM
# Set program_transform_name # Set program_transform_name
AC_ARG_PROGRAM AC_ARG_PROGRAM
# Find the native compiler
AC_PROG_CC
AC_PROG_CC_C_O
# autoconf is lame and doesn't give us any substitution variable for this.
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
NO_MINUS_C_MINUS_O=yes
else
OUTPUT_OPTION='-o $@'
fi
AC_SUBST(NO_MINUS_C_MINUS_O)
AC_SUBST(OUTPUT_OPTION)
# See if GNAT has been installed
gcc_AC_PROG_GNAT
AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
ac_cv_prog_cc_no_long_long,
[save_CFLAGS="$CFLAGS"
CFLAGS="-Wno-long-long"
AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
ac_cv_prog_cc_no_long_long=no)
CFLAGS="$save_CFLAGS"])
if test x$have_gnat != xno ; then
AC_CACHE_CHECK(whether ${ADAC} accepts -Wno-long-long,
ac_cv_prog_adac_no_long_long,
[cat >conftest.adb <<EOF
procedure conftest is begin null; end conftest;
EOF
if $ADAC -Wno-long-long -c conftest.adb 1>&5 2>&5 ; then
ac_cv_prog_adac_no_long_long=yes
else
ac_cv_prog_adac_no_long_long=no
fi
rm -f conftest*])
else
ac_cv_prog_adac_no_long_long=yes
fi
strict1_warn=
if test $ac_cv_prog_cc_no_long_long = yes && \
test $ac_cv_prog_adac_no_long_long = yes ; then
strict1_warn="-pedantic -Wno-long-long"
fi
AC_SUBST(strict1_warn)
AC_PROG_CPP
AC_C_INLINE
gcc_AC_C_VOLATILE
gcc_AC_C_LONG_DOUBLE
gcc_AC_C_LONG_LONG
gcc_AC_C__BOOL
# sizeof(char) is 1 by definition.
gcc_AC_COMPILE_CHECK_SIZEOF(short)
gcc_AC_COMPILE_CHECK_SIZEOF(int)
gcc_AC_COMPILE_CHECK_SIZEOF(long)
if test $ac_cv_c_long_long = yes; then
gcc_AC_COMPILE_CHECK_SIZEOF(long long)
fi
if test $ac_cv_c___int64 = yes; then
gcc_AC_COMPILE_CHECK_SIZEOF(__int64)
fi
gcc_AC_C_CHARSET
# If the native compiler is GCC, we can enable warnings even in stage1.
# That's useful for people building cross-compilers, or just running a
# quick `make'.
warn_cflags=
if test "x$GCC" = "xyes"; then
warn_cflags='$(GCC_WARN_CFLAGS)'
fi
AC_SUBST(warn_cflags)
# Stage specific cflags for build. # Stage specific cflags for build.
stage1_cflags= stage1_cflags=
case $build in case $build in
......
...@@ -27,6 +27,12 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ...@@ -27,6 +27,12 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "intl.h" #include "intl.h"
#include "mkdeps.h" #include "mkdeps.h"
#include "splay-tree.h" #include "splay-tree.h"
#ifdef ENABLE_VALGRIND_CHECKING
#include <valgrind.h>
#else
/* Avoid #ifdef:s when we can help it. */
#define VALGRIND_DISCARD(x)
#endif
#ifdef HAVE_MMAP_FILE #ifdef HAVE_MMAP_FILE
# include <sys/mman.h> # include <sys/mman.h>
...@@ -417,6 +423,11 @@ read_include_file (pfile, inc) ...@@ -417,6 +423,11 @@ read_include_file (pfile, inc)
buf = (uchar *) mmap (0, size, PROT_READ, MAP_PRIVATE, inc->fd, 0); buf = (uchar *) mmap (0, size, PROT_READ, MAP_PRIVATE, inc->fd, 0);
if (buf == (uchar *) -1) if (buf == (uchar *) -1)
goto perror_fail; goto perror_fail;
/* We must tell Valgrind that the byte at buf[size] is actually
readable. Discard the handle to avoid handle leak. */
VALGRIND_DISCARD (VALGRIND_MAKE_READABLE (buf + size, 1));
inc->mapped = 1; inc->mapped = 1;
} }
else else
...@@ -497,7 +508,14 @@ purge_cache (inc) ...@@ -497,7 +508,14 @@ purge_cache (inc)
{ {
#if MMAP_THRESHOLD #if MMAP_THRESHOLD
if (inc->mapped) if (inc->mapped)
munmap ((PTR) inc->buffer, inc->st.st_size); {
/* Undo the previous annotation for the
known-zero-byte-after-mmap. Discard the handle to avoid
handle leak. */
VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS (inc->buffer
+ inc->st.st_size, 1));
munmap ((PTR) inc->buffer, inc->st.st_size);
}
else else
#endif #endif
free ((PTR) inc->buffer); free ((PTR) inc->buffer);
......
...@@ -2877,6 +2877,33 @@ execute () ...@@ -2877,6 +2877,33 @@ execute ()
#endif /* DEBUG */ #endif /* DEBUG */
} }
#ifdef ENABLE_VALGRIND_CHECKING
/* Run the each command through valgrind. To simplifiy prepending the
path to valgrind and the option "-q" (for quiet operation unless
something triggers), we allocate a separate argv array. */
for (i = 0; i < n_commands; i++)
{
const char **argv;
int argc;
int j;
for (argc = 0; commands[i].argv[argc] != NULL; argc++)
;
argv = alloca ((argc + 3) * sizeof (char *));
argv[0] = VALGRIND_PATH;
argv[1] = "-q";
for (j = 2; j < argc + 2; j++)
argv[j] = commands[i].argv[j - 2];
argv[j] = NULL;
commands[i].argv = argv;
commands[i].prog = argv[0];
}
#endif
/* Run each piped subprocess. */ /* Run each piped subprocess. */
for (i = 0; i < n_commands; i++) for (i = 0; i < n_commands; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment