From 78dccd425965e35ead292a02578f71d1ffda4f24 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 26 Apr 2011 16:48:43 -0500 Subject: [svn-r20653] Description: Bring r20651 & r20652 from trunk to 1.8 branch: Switch from using 'pthread_create' to 'pthread_self' when trying to detect the pthread library, so that the Intel C compiler is happier with the prototype. Teach the tracing script & routines about the 'unsigned long' and 'unsigned long long' types, so that the H5Pset_fapl_log() API routine gets tracing information correct. Tested on: FreeBSD/32 6.3 (duty) (h5committested on trunk) --- bin/trace | 2 ++ configure | 64 +++++++++++++++++++++++++++++------------------------------ configure.in | 8 ++++---- src/H5FDlog.c | 2 +- src/H5trace.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 95 insertions(+), 37 deletions(-) diff --git a/bin/trace b/bin/trace index 951d349..4ccf74c 100755 --- a/bin/trace +++ b/bin/trace @@ -84,6 +84,8 @@ $Source = ""; "H5T_sign_t" => "Ts", "H5T_class_t" => "Tt", "H5T_str_t" => "Tz", + "unsigned long" => "Ul", + "unsigned long long" => "UL", "void" => "x", "FILE" => "x", "H5A_operator_t" => "x", diff --git a/configure b/configure index d69e1af..5183dc8 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 20565 2011-04-20 16:41:42Z mamcgree . +# From configure.in Id: configure.in 20647 2011-04-26 20:21:38Z koziol . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for HDF5 1.8.8-snap0. # @@ -25296,9 +25296,9 @@ fi done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -$as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_create+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in -lpthread" >&5 +$as_echo_n "checking for pthread_join in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_join+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25312,7 +25312,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char pthread_create (); +char pthread_join (); #ifdef FC_DUMMY_MAIN #ifndef FC_DUMMY_MAIN_EQ_F77 # ifdef __cplusplus @@ -25324,23 +25324,23 @@ char pthread_create (); int main () { -return pthread_create (); +return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_create=yes + ac_cv_lib_pthread_pthread_join=yes else - ac_cv_lib_pthread_pthread_create=no + ac_cv_lib_pthread_pthread_join=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_join" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_join" >&6; } +if test "x$ac_cv_lib_pthread_pthread_join" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF @@ -25421,9 +25421,9 @@ done saved_AM_LDFLAGS="$AM_LDFLAGS" LDFLAGS="$LDFLAGS -L$pthread_lib" AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -$as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_create+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in -lpthread" >&5 +$as_echo_n "checking for pthread_join in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_join+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25437,7 +25437,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char pthread_create (); +char pthread_join (); #ifdef FC_DUMMY_MAIN #ifndef FC_DUMMY_MAIN_EQ_F77 # ifdef __cplusplus @@ -25449,23 +25449,23 @@ char pthread_create (); int main () { -return pthread_create (); +return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_create=yes + ac_cv_lib_pthread_pthread_join=yes else - ac_cv_lib_pthread_pthread_create=no + ac_cv_lib_pthread_pthread_join=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_join" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_join" >&6; } +if test "x$ac_cv_lib_pthread_pthread_join" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF @@ -25478,9 +25478,9 @@ fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -$as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_create+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in -lpthread" >&5 +$as_echo_n "checking for pthread_join in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_join+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25494,7 +25494,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char pthread_create (); +char pthread_join (); #ifdef FC_DUMMY_MAIN #ifndef FC_DUMMY_MAIN_EQ_F77 # ifdef __cplusplus @@ -25506,23 +25506,23 @@ char pthread_create (); int main () { -return pthread_create (); +return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_create=yes + ac_cv_lib_pthread_pthread_join=yes else - ac_cv_lib_pthread_pthread_create=no + ac_cv_lib_pthread_pthread_join=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_join" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_join" >&6; } +if test "x$ac_cv_lib_pthread_pthread_join" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF @@ -25577,7 +25577,7 @@ $as_echo "no" >&6; } int main () { -pthread_create() +pthread_join() ; return 0; } diff --git a/configure.in b/configure.in index df9acce..c717b0b 100644 --- a/configure.in +++ b/configure.in @@ -1872,7 +1872,7 @@ AC_ARG_WITH([pthread], case "$withval" in yes) AC_CHECK_HEADERS([pthread.h]) - AC_CHECK_LIB([pthread], [pthread_create],, [unset PTHREAD]) + AC_CHECK_LIB([pthread], [pthread_join],, [unset PTHREAD]) ;; no) AC_MSG_CHECKING([for pthread]) @@ -1917,11 +1917,11 @@ case "$withval" in saved_AM_LDFLAGS="$AM_LDFLAGS" LDFLAGS="$LDFLAGS -L$pthread_lib" AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" - AC_CHECK_LIB([pthread], [pthread_create],, + AC_CHECK_LIB([pthread], [pthread_join],, [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset PTHREAD]) else - AC_CHECK_LIB([pthread], [pthread_create],, [unset PTHREAD]) + AC_CHECK_LIB([pthread], [pthread_join],, [unset PTHREAD]) fi ;; esac @@ -1958,7 +1958,7 @@ case "X-$THREADSAFE" in ;; X-yes) dnl Check that we can link a simple Pthread program. - AC_TRY_LINK(, [pthread_create()], + AC_TRY_LINK(, [pthread_join()], [AC_MSG_RESULT([yes]); THREADSAFE=yes], [AC_MSG_ERROR([needed pthread library not available])]) ;; diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 96df596..76053ec 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -318,7 +318,7 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si herr_t ret_value; FUNC_ENTER_API(H5Pset_fapl_log, FAIL) - H5TRACE4("e", "i*sIuz", fapl_id, logfile, flags, buf_size); + H5TRACE4("e", "i*sULz", fapl_id, logfile, flags, buf_size); if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") diff --git a/src/H5trace.c b/src/H5trace.c index 870e881..0c6faed 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2167,6 +2167,62 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end else */ break; + case 'U': + switch(type[1]) { + case 'l': + if(ptr) { + if(vp) { + fprintf(out, "0x%lx", (unsigned long)vp); + if(asize_idx >= 0 && asize[asize_idx] >= 0) { + unsigned long *p = (unsigned long *)vp; + + fprintf(out, " {"); + for(i = 0; i < asize[asize_idx]; i++) + HDfprintf(out, "%s%lu", i?", ":"", p[i]); + fprintf(out, "}"); + } /* end if */ + } /* end if */ + else + fprintf(out, "NULL"); + } /* end if */ + else { + unsigned long iul = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occuring */ + + fprintf(out, "%lu", iul); + asize[argno] = iul; + } /* end else */ + break; + + case 'L': + if(ptr) { + if(vp) { + fprintf(out, "0x%lx", (unsigned long)vp); + if(asize_idx >= 0 && asize[asize_idx] >= 0) { + unsigned long long *p = (unsigned long long *)vp; + + fprintf(out, " {"); + for(i = 0; i < asize[asize_idx]; i++) + HDfprintf(out, "%s%llu", i?", ":"", p[i]); + fprintf(out, "}"); + } /* end if */ + } /* end if */ + else + fprintf(out, "NULL"); + } /* end if */ + else { + unsigned long long iull = va_arg(ap, unsigned long long); /*lint !e732 Loss of sign not really occuring */ + + fprintf(out, "%llu", iull); + asize[argno] = iull; + } /* end else */ + break; + + default: + fprintf (out, "BADTYPE(U%c)", type[1]); + goto error; + } /* end switch */ + break; + case 'x': if(ptr) { if(vp) { -- cgit v0.12