[mpich2-commits] r7943 - in mpich2/trunk: . src/include src/mpi/errhan
balaji at mcs.anl.gov
balaji at mcs.anl.gov
Fri Feb 11 17:34:30 CST 2011
Author: balaji
Date: 2011-02-11 17:34:30 -0600 (Fri, 11 Feb 2011)
New Revision: 7943
Modified:
mpich2/trunk/configure.in
mpich2/trunk/src/include/mpitypedefs.h
mpich2/trunk/src/mpi/errhan/errutil.c
Log:
Corrections to the detection of the C boolean and complex types.
1. The stdbool.h and complex.h headers seem to be required even for
_Bool and _Complex and not just "bool" and "complex", at least for the
infamous gcc-2.96 compiler.
2. We should compare the C++ boolean type to multiple C integer types,
and not just the C boolean type as the C and C++ compilers might have
different sizes for the two types.
3. Fix one of the functions in MPICH2 that was using the variable
"I". For some non-intuitive reason complex.h decided to define 'I' to
Complex_I, which was causing problems.
Reviewed by goodell.
Modified: mpich2/trunk/configure.in
===================================================================
--- mpich2/trunk/configure.in 2011-02-11 23:34:27 UTC (rev 7942)
+++ mpich2/trunk/configure.in 2011-02-11 23:34:30 UTC (rev 7943)
@@ -3338,12 +3338,28 @@
AC_DEFINE(HAVE_UINT64_T,1,[Define if uint64_t is supported by the C compiler])
fi
-# Other C99 types. stdbool.h and complex.h are not needed for the raw _Bool
-# and _Complex types, only to get the macros "bool" and "complex".
-AC_CHECK_SIZEOF([_Bool])
-AC_CHECK_SIZEOF([float _Complex])
-AC_CHECK_SIZEOF([double _Complex])
-AC_CHECK_SIZEOF([long double _Complex])
+# Other C99 types.
+AC_CHECK_HEADERS([stdbool.h complex.h])
+AC_CHECK_SIZEOF([_Bool],0,[
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif
+])
+AC_CHECK_SIZEOF([float _Complex],0,[
+#ifdef HAVE_COMPLEX_H
+#include <complex.h>
+#endif
+])
+AC_CHECK_SIZEOF([double _Complex],0,[
+#ifdef HAVE_COMPLEX_H
+#include <complex.h>
+#endif
+])
+AC_CHECK_SIZEOF([long double _Complex],0,[
+#ifdef HAVE_COMPLEX_H
+#include <complex.h>
+#endif
+])
# we need really could just use the result of AC_CHECK_SIZEOF, but having a
# HAVE_typename macro is useful for consistency
AC_CHECK_TYPES([_Bool, float _Complex, double _Complex, long double _Complex])
@@ -4622,11 +4638,32 @@
AC_LANG_CPLUSPLUS
AC_CHECK_SIZEOF(bool)
- if test "$ac_cv_type__Bool" = "yes" -a "$ac_cv_sizeof__Bool" = "$ac_cv_sizeof_bool" ; then
- AC_DEFINE_UNQUOTED([MPIR_CXX_BOOL_CTYPE],[_Bool],[a C type used to compute C++ bool reductions])
- else
- AC_MSG_ERROR([unable to determine matching C type for C++ bool])
- fi
+ # Find a C type that matches the size of the C++ boolean type
+ case "$ac_cv_sizeof_bool" in
+ $ac_cv_sizeof__Bool)
+ bool_type=_Bool
+ ;;
+ $ac_cv_sizeof_unsigned_char)
+ bool_type="unsigned char"
+ ;;
+ $ac_cv_sizeof_unsigned_short)
+ bool_type="unsigned short"
+ ;;
+ $ac_cv_sizeof_unsigned_int)
+ bool_type="unsigned int"
+ ;;
+ $ac_cv_sizeof_unsigned_long)
+ bool_type="unsigned long"
+ ;;
+ $ac_cv_sizeof_unsigned_long_long)
+ bool_type="unsigned long long"
+ ;;
+ *)
+ AC_MSG_ERROR([unable to determine matching C type for C++ bool])
+ ;;
+ esac
+ AC_DEFINE_UNQUOTED([MPIR_CXX_BOOL_CTYPE],[$bool_type],
+ [a C type used to compute C++ bool reductions])
AC_CHECK_HEADER(complex)
if test "$ac_cv_header_complex" = "yes" ; then
Modified: mpich2/trunk/src/include/mpitypedefs.h
===================================================================
--- mpich2/trunk/src/include/mpitypedefs.h 2011-02-11 23:34:27 UTC (rev 7942)
+++ mpich2/trunk/src/include/mpitypedefs.h 2011-02-11 23:34:30 UTC (rev 7943)
@@ -25,6 +25,14 @@
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
+/* stdbool.h gives us the C boolean type */
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif
+/* complex.h gives us the C complex type */
+#ifdef HAVE_COMPLEX_H
+#include <complex.h>
+#endif
#ifdef HAVE_WINDOWS_H
#include <winsock2.h>
Modified: mpich2/trunk/src/mpi/errhan/errutil.c
===================================================================
--- mpich2/trunk/src/mpi/errhan/errutil.c 2011-02-11 23:34:27 UTC (rev 7942)
+++ mpich2/trunk/src/mpi/errhan/errutil.c 2011-02-11 23:34:30 UTC (rev 7943)
@@ -1135,7 +1135,7 @@
char *begin, *end, *fmt;
size_t len;
MPI_Comm C;
- MPI_Info I;
+ MPI_Info info;
MPI_Datatype D;
MPI_Win W;
MPI_Group G;
@@ -1267,14 +1267,14 @@
}
break;
case (int)'I':
- I = va_arg(list, MPI_Info);
- if (I == MPI_INFO_NULL)
+ info = va_arg(list, MPI_Info);
+ if (info == MPI_INFO_NULL)
{
MPIU_Strncpy(str, "MPI_INFO_NULL", maxlen);
}
else
{
- MPIU_Snprintf(str, maxlen, "info=0x%x", I);
+ MPIU_Snprintf(str, maxlen, "info=0x%x", info);
}
break;
case (int)'D':
More information about the mpich2-commits
mailing list