Adds support for the valgrind tool sgcheck.

This commit is contained in:
Andrea Mazzoleni 2013-06-27 21:59:19 +02:00
parent 7b70556e1d
commit edc885ac79
3 changed files with 23 additions and 7 deletions

View file

@ -9,7 +9,7 @@ AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind --leak-check=full --track-fds=yes --error-exitcode=1],[])
AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[])
AC_CHECK_PROG([WINE],[wine],[wine],[])
AC_CHECK_PROG([ADVD2],[advd2],[advd2],[])
AM_CONDITIONAL(HAVE_ADVD2, [test x"$ADVD2" != x])
@ -85,7 +85,15 @@ AC_ARG_ENABLE([coverage],
AC_ARG_ENABLE([valgrind],
[AS_HELP_STRING([--enable-valgrind],[enable the use of valgrind in testing])],
[
TESTENV="$VALGRIND"
TESTENV="$VALGRIND --leak-check=full --track-fds=yes --error-exitcode=1"
CFLAGS="$CFLAGS -DCHECKER"
],
[])
AC_ARG_ENABLE([sgcheck],
[AS_HELP_STRING([--enable-sgcheck],[enable the use of sgcheck in testing])],
[
TESTENV="$VALGRIND --tool=exp-sgcheck --suppressions=sgcheck.supp --error-exitcode=1"
CFLAGS="$CFLAGS -DCHECKER"
],
[])

7
sgcheck.supp Normal file
View file

@ -0,0 +1,7 @@
{
printf reports false positves when printing more than one variables at time
exp-sgcheck:SorG
...
fun:printf
}

View file

@ -158,8 +158,10 @@ tommy_inline void tommy_chain_mergesort(tommy_chain* chain, tommy_compare_func*
/*
* Bit buckets of chains.
* Each bucket contains 2^i nodes or it's empty.
* The chain at address TOMMY_CHAIN_BIT_MAX is an independet variable operating as "carry".
* We keep it in the same "bit" vector to avoid reports from the valgrind tool sgcheck.
*/
tommy_chain bit[TOMMY_CHAIN_BIT_MAX];
tommy_chain bit[TOMMY_CHAIN_BIT_MAX + 1];
/**
* Value stored inside the bit bucket.
@ -174,13 +176,12 @@ tommy_inline void tommy_chain_mergesort(tommy_chain* chain, tommy_compare_func*
counter = 0;
while (1) {
tommy_node* next;
tommy_chain carry;
tommy_chain* last;
/* carry bit to add */
last = &carry;
carry.head = node;
carry.tail = node;
last = &bit[TOMMY_CHAIN_BIT_MAX];
bit[TOMMY_CHAIN_BIT_MAX].head = node;
bit[TOMMY_CHAIN_BIT_MAX].tail = node;
next = node->next;
/* add the bit, propagating the carry */