Merge remote-tracking branch 'origin/pr/330'

Fixes #1983
This commit is contained in:
Adam Sutton 2014-03-05 08:50:01 +00:00
commit 1d1fc2bbaa
5 changed files with 25 additions and 12 deletions

9
configure vendored
View file

@ -103,6 +103,15 @@ int test ( void )
return ok;
}' -lpthread
check_cc_snippet qsort_r '
#include <stdlib.h>
#define TEST test
int test(void)
{
qsort_r(NULL, 0, 0, NULL, NULL);
return 0;
}
'
#
# Python
#

View file

@ -74,9 +74,8 @@
#define CW_DUMP(buf, len, format, ...) \
printf(format, __VA_ARGS__); int j; for (j = 0; j < len; ++j) printf("%02X ", buf[j]); printf("\n");
#if defined(__GNUC__) && defined(PLATFORM_LINUX)
#include <features.h>
#if __GNUC_PREREQ(4, 3)
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
#if 100*__GNUC__+__GNUC_MINOR >=403
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
#endif

View file

@ -175,7 +175,7 @@ traphandler(int sig, siginfo_t *si, void *UC)
tvhlog_spawn(LOG_ALERT, "CRASH", "Loaded libraries: %s ", libs);
#ifdef NGREG
snprintf(tmpbuf, sizeof(tmpbuf), "Register dump [%d]: ", NGREG);
snprintf(tmpbuf, sizeof(tmpbuf), "Register dump [%d]: ", (int)NGREG);
for(i = 0; i < NGREG; i++) {
sappend(tmpbuf, sizeof(tmpbuf), "%016" PRIx64, uc->uc_mcontext.gregs[i]);

View file

@ -31,6 +31,7 @@
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <limits.h>
#if ENABLE_LOCKOWNER
#include <sys/syscall.h>
#endif
@ -603,16 +604,22 @@ int rmtree ( const char *path );
char *regexp_escape ( const char *str );
#ifdef PLATFORM_LINUX
/* glibc wrapper */
#if !__GLIBC_PREREQ(2,8)
#if ! ENABLE_QSORT_R
void
qsort_r(void *base, size_t nmemb, size_t size,
int (*cmp)(const void *, const void *, void *), void *aux);
#endif
#endif /* PLATFORM_LINUX */
#endif /* ENABLE_QSORT_R */
/* printing */
#ifndef __WORDSIZE
# if ULONG_MAX == 0xffffffffffffffff
# define __WORDSIZE 64
# elif ULONG_MAX == 0xffffffff
# define __WORDSIZE 32
# endif /* ULONG_MAX */
#endif /* __WORDSIZE */
# if __WORDSIZE == 64
#define PRIsword_t PRId64
#define PRIuword_t PRIu64

View file

@ -135,12 +135,11 @@ tvhthread_create0
return r;
}
#ifdef PLATFORM_LINUX
#if ! ENABLE_QSORT_R
/*
* qsort_r wrapper for pre GLIBC 2.8
*/
#if !__GLIBC_PREREQ(2,8)
static __thread struct {
int (*cmp) ( const void *a, const void *b, void *p );
void *aux;
@ -160,5 +159,4 @@ qsort_r(void *base, size_t nmemb, size_t size,
qsort_r_data.aux = aux;
qsort(base, nmemb, size, qsort_r_wrap);
}
#endif /* GLIBC < 2.8 */
#endif /* PLATFORM_LINUX */
#endif /* ENABLE_QSORT_R */