configure.ac: Don't define ENABLE_CHECKING whenever --enable-checking is seen...
* configure.ac: Don't define ENABLE_CHECKING whenever --enable-checking is seen, instead use similar --enable-checking=yes vs. --enable-checking=release default as gcc/ subdir has and define ENABLE_CHECKING if ENABLE_CHECKING is defined in gcc/. Define ENABLE_VALGRIND_CHECKING if requested. * lex.c (new_buff): If ENABLE_VALGRIND_CHECKING, put _cpp_buff struct first in the allocated buffer and result->base after it. (_cpp_free_buff): If ENABLE_VALGRIND_CHECKING, free buff itself instead of buff->base. * config.in: Regenerated. * configure: Regenerated. From-SVN: r196333
This commit is contained in:
parent
ff24afc8d0
commit
1a80db971d
@ -1,3 +1,17 @@
|
||||
2013-02-28 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* configure.ac: Don't define ENABLE_CHECKING whenever
|
||||
--enable-checking is seen, instead use similar --enable-checking=yes
|
||||
vs. --enable-checking=release default as gcc/ subdir has and
|
||||
define ENABLE_CHECKING if ENABLE_CHECKING is defined in gcc/.
|
||||
Define ENABLE_VALGRIND_CHECKING if requested.
|
||||
* lex.c (new_buff): If ENABLE_VALGRIND_CHECKING, put _cpp_buff
|
||||
struct first in the allocated buffer and result->base after it.
|
||||
(_cpp_free_buff): If ENABLE_VALGRIND_CHECKING, free buff itself
|
||||
instead of buff->base.
|
||||
* config.in: Regenerated.
|
||||
* configure: Regenerated.
|
||||
|
||||
2013-02-13 Ed Smith-Rowland <3dw4rd@verizon.net>
|
||||
|
||||
PR c++/55582
|
||||
|
@ -21,6 +21,10 @@
|
||||
language is requested. */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define if you want to workaround valgrind (a memory checker) warnings about
|
||||
possible memory leaks because of libcpp use of interior pointers. */
|
||||
#undef ENABLE_VALGRIND_CHECKING
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
|
52
libcpp/configure
vendored
52
libcpp/configure
vendored
@ -1333,7 +1333,11 @@ Optional Features:
|
||||
--enable-werror-always enable -Werror despite compiler version
|
||||
--disable-rpath do not hardcode runtime library paths
|
||||
--enable-maintainer-mode enable rules only needed by maintainers
|
||||
--enable-checking enable expensive run-time checks
|
||||
--enable-checking[=LIST]
|
||||
enable expensive run-time checks. With LIST, enable
|
||||
only specific categories of checks. Categories are:
|
||||
yes,no,all,none,release. Flags are: misc,valgrind or
|
||||
other strings
|
||||
--enable-canonical-system-headers
|
||||
enable or disable system headers canonicalization
|
||||
|
||||
@ -7083,20 +7087,54 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-checking was given.
|
||||
if test "${enable_checking+set}" = set; then :
|
||||
enableval=$enable_checking;
|
||||
else
|
||||
enable_checking=no
|
||||
# Enable expensive internal checks
|
||||
is_release=
|
||||
if test -f $srcdir/../gcc/DEV-PHASE \
|
||||
&& test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then
|
||||
is_release=yes
|
||||
fi
|
||||
|
||||
# Check whether --enable-checking was given.
|
||||
if test "${enable_checking+set}" = set; then :
|
||||
enableval=$enable_checking; ac_checking_flags="${enableval}"
|
||||
else
|
||||
|
||||
if test $enable_checking != no ; then
|
||||
# Determine the default checks.
|
||||
if test x$is_release = x ; then
|
||||
ac_checking_flags=yes
|
||||
else
|
||||
ac_checking_flags=release
|
||||
fi
|
||||
fi
|
||||
|
||||
IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
|
||||
for check in release $ac_checking_flags
|
||||
do
|
||||
case $check in
|
||||
# these set all the flags to specific states
|
||||
yes|all) ac_checking=1 ; ac_valgrind_checking= ;;
|
||||
no|none|release) ac_checking= ; ac_valgrind_checking= ;;
|
||||
# these enable particular checks
|
||||
misc) ac_checking=1 ;;
|
||||
valgrind) ac_valgrind_checking=1 ;;
|
||||
# accept
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
IFS="$ac_save_IFS"
|
||||
|
||||
if test x$ac_checking != x ; then
|
||||
|
||||
$as_echo "#define ENABLE_CHECKING 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
if test x$ac_valgrind_checking != x ; then
|
||||
|
||||
$as_echo "#define ENABLE_VALGRIND_CHECKING 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
# Check whether --enable-canonical-system-headers was given.
|
||||
if test "${enable_canonical_system_headers+set}" = set; then :
|
||||
enableval=$enable_canonical_system_headers;
|
||||
|
@ -123,15 +123,53 @@ else
|
||||
fi
|
||||
AC_SUBST(MAINT)
|
||||
|
||||
AC_ARG_ENABLE(checking,
|
||||
[ --enable-checking enable expensive run-time checks],,
|
||||
enable_checking=no)
|
||||
# Enable expensive internal checks
|
||||
is_release=
|
||||
if test -f $srcdir/../gcc/DEV-PHASE \
|
||||
&& test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then
|
||||
is_release=yes
|
||||
fi
|
||||
|
||||
if test $enable_checking != no ; then
|
||||
AC_ARG_ENABLE(checking,
|
||||
[AS_HELP_STRING([[--enable-checking[=LIST]]],
|
||||
[enable expensive run-time checks. With LIST,
|
||||
enable only specific categories of checks.
|
||||
Categories are: yes,no,all,none,release.
|
||||
Flags are: misc,valgrind or other strings])],
|
||||
[ac_checking_flags="${enableval}"],[
|
||||
# Determine the default checks.
|
||||
if test x$is_release = x ; then
|
||||
ac_checking_flags=yes
|
||||
else
|
||||
ac_checking_flags=release
|
||||
fi])
|
||||
IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
|
||||
for check in release $ac_checking_flags
|
||||
do
|
||||
case $check in
|
||||
# these set all the flags to specific states
|
||||
yes|all) ac_checking=1 ; ac_valgrind_checking= ;;
|
||||
no|none|release) ac_checking= ; ac_valgrind_checking= ;;
|
||||
# these enable particular checks
|
||||
misc) ac_checking=1 ;;
|
||||
valgrind) ac_valgrind_checking=1 ;;
|
||||
# accept
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
IFS="$ac_save_IFS"
|
||||
|
||||
if test x$ac_checking != x ; then
|
||||
AC_DEFINE(ENABLE_CHECKING, 1,
|
||||
[Define if you want more run-time sanity checks.])
|
||||
fi
|
||||
|
||||
if test x$ac_valgrind_checking != x ; then
|
||||
AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
|
||||
[Define if you want to workaround valgrind (a memory checker) warnings about
|
||||
possible memory leaks because of libcpp use of interior pointers.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(canonical-system-headers,
|
||||
[ --enable-canonical-system-headers
|
||||
enable or disable system headers canonicalization],
|
||||
|
13
libcpp/lex.c
13
libcpp/lex.c
@ -2846,8 +2846,17 @@ new_buff (size_t len)
|
||||
len = MIN_BUFF_SIZE;
|
||||
len = CPP_ALIGN (len);
|
||||
|
||||
#ifdef ENABLE_VALGRIND_CHECKING
|
||||
/* Valgrind warns about uses of interior pointers, so put _cpp_buff
|
||||
struct first. */
|
||||
size_t slen = CPP_ALIGN2 (sizeof (_cpp_buff), 2 * DEFAULT_ALIGNMENT);
|
||||
base = XNEWVEC (unsigned char, len + slen);
|
||||
result = (_cpp_buff *) base;
|
||||
base += slen;
|
||||
#else
|
||||
base = XNEWVEC (unsigned char, len + sizeof (_cpp_buff));
|
||||
result = (_cpp_buff *) (base + len);
|
||||
#endif
|
||||
result->base = base;
|
||||
result->cur = base;
|
||||
result->limit = base + len;
|
||||
@ -2934,7 +2943,11 @@ _cpp_free_buff (_cpp_buff *buff)
|
||||
for (; buff; buff = next)
|
||||
{
|
||||
next = buff->next;
|
||||
#ifdef ENABLE_VALGRIND_CHECKING
|
||||
free (buff);
|
||||
#else
|
||||
free (buff->base);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user