From 846e6e4badadb11bc74c6588d4f68627c942a6e7 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 4 Aug 2009 18:45:11 +0000 Subject: [PATCH] Fix borkedness from r21755: * No need for OPAL_SIZEOF_BOOL and OPAL_SIZEOF_INT in comm_inln.h -- just use sizeof() * Fix logic in ompi_setup_cxx.m4 to account for the case where we ''do'' have a C++ compiler (duh!!) * Fix spelling error in a shell variable that ended up making a bad/empty #define This should bring the trunk back to being functional. Sorry for the interruption, folks... This commit was SVN r21758. The following SVN revision numbers were found above: r21755 --> open-mpi/ompi@90d64917379ff87fba17ee968a21b0b3061bac82 --- config/ompi_setup_cxx.m4 | 57 ++++++++++++++++++++++------------------ configure.ac | 5 ---- ompi/mpi/cxx/comm_inln.h | 22 ++++++++-------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/config/ompi_setup_cxx.m4 b/config/ompi_setup_cxx.m4 index 8aa203e228..77bb65cf8a 100644 --- a/config/ompi_setup_cxx.m4 +++ b/config/ompi_setup_cxx.m4 @@ -46,6 +46,7 @@ AC_DEFUN([OMPI_SETUP_CXX],[ # -------------------------- # Setup the CXX compiler AC_DEFUN([_OMPI_SETUP_CXX_COMPILER],[ + OMPI_VAR_SCOPE_PUSH(ompi_cxx_compiler_works) # There's a few cases here: # @@ -75,34 +76,37 @@ AC_DEFUN([_OMPI_SETUP_CXX_COMPILER],[ AC_DEFINE_UNQUOTED(OMPI_CXX, "$CXX", [OMPI underlying C++ compiler]) AC_SUBST(OMPI_CXX_ABSOLUTE) + # Make sure that the C++ compiler both works and is actually a C++ + # compiler (if not cross-compiling). Don't just use the AC macro + # so that we can have a pretty message. Do something here that + # should force the linking of C++-specific things (e.g., STL + # strings) so that we can force a hard check of compiling, + # linking, and running a C++ application. Note that some C + # compilers, such as at least some versions of the GNU and Intel + # compilers, will detect that the file extension is ".cc" and + # therefore switch into a pseudo-C++ personality which works for + # *compiling*, but does not work for *linking*. So in this test, + # we want to cover the entire spectrum (compiling, linking, + # running). Note that it is not a fatal error if the C++ compiler + # does not work unless the user specifically requested the C++ + # bindings. AS_IF([test "$CXX" = "none"], - [AS_IF([test "$enable_mpi_cxx" = "yes"], - [AC_MSG_WARN([Could not find functional C++ compiler, but]) - AC_MSG_WARN([support for the C++ MPI bindings was requested]) - AC_MSG_ERROR([Cannot continue])], - [WANT_MPI_CXX_SUPPORT=0])], - [ - # Make sure that the C++ compiler both works and is - # actually a C++ compiler (if not cross-compiling). Don't - # just use the AC macro so that we can have a pretty - # message. Do something here that should force the linking - # of C++-specific things (e.g., STL strings) so that we can - # force a hard check of compiling, linking, and running a - # C++ application. Note that some C compilers, such as at - # least some versions of the GNU and Intel compilers, will - # detect that the file extension is ".cc" and therefore - # switch into a pseudo-C++ personality which works for - # *compiling*, but does not work for *linking*. So in this - # test, we want to cover the entire spectrum (compiling, - # linking, running). Note that it is not a fatal error if - # the C++ compiler does not work unless the user - # specifically requested the C++ bindings. - - AS_IF([test "$ompi_cv_cxx_compiler_vendor" != "microsoft" ], + [ompi_cxx_compiler_works=no], + [AS_IF([test "$ompi_cv_cxx_compiler_vendor" = "microsoft" ], + [ompi_cxx_compiler_works=yes], [OMPI_CHECK_COMPILER_WORKS([C++], [#include ], - [std::string foo = "Hello, world"], [], - [WANT_MPI_CXX_SUPPORT=0])])]) + [std::string foo = "Hello, world"], + [ompi_cxx_compiler_works=yes], + [ompi_cxx_compiler_works=no])])]) + + AS_IF([test "$ompi_cxx_compiler_works" = "yes"], + [_OMPI_SETUP_CXX_COMPILER_BACKEND], + [AS_IF([test "$enable_mpi_cxx" = "yes"], + [AC_MSG_WARN([Could not find functional C++ compiler, but]) + AC_MSG_WARN([support for the C++ MPI bindings was requested.]) + AC_MSG_ERROR([Cannot continue])], + [WANT_MPI_CXX_SUPPORT=0])]) AC_MSG_CHECKING([if able to build the MPI C++ bindings]) AS_IF([test "$WANT_MPI_CXX_SUPPORT" = "1"], @@ -114,6 +118,7 @@ AC_DEFUN([_OMPI_SETUP_CXX_COMPILER],[ AS_IF([test "$WANT_MPI_CXX_SUPPORT" = "1"], [OMPI_CXX_COMPILER_VENDOR([ompi_cxx_vendor])]) + OMPI_VAR_SCOPE_POP ]) # _OMPI_SETUP_CXX_COMPILER_BACKEND() @@ -318,7 +323,7 @@ AC_DEFUN([_OMPI_CXX_CHECK_EXCEPTIONS_BACKEND],[ AC_DEFUN([_OMPI_CXX_CHECK_BUILTIN],[ OMPI_VAR_SCOPE_PUSH([have_cxx_builtin_expect have_cxx_builtin_prefetch]) have_cxx_builtin_expect=0 - have_cxx_builtin_prefectch=0 + have_cxx_builtin_prefetch=0 AS_IF([test "$WANT_MPI_CXX_SUPPORT" = "1"], [_OMPI_CXX_CHECK_BUILTIN_BACKEND]) diff --git a/configure.ac b/configure.ac index 8240956d85..cde57cbfb8 100644 --- a/configure.ac +++ b/configure.ac @@ -1375,11 +1375,6 @@ if test $ac_cv_header_sys_synch_h = yes ; then [Do not use outside of mpi.h. Define to 1 if you have the header file.]) fi -AC_DEFINE_UNQUOTED(OPAL_SIZEOF_BOOL, $ac_cv_sizeof_bool, - [Do not use outside of mpi.h. The size of a `bool', as computed by sizeof.]) dnl ` -AC_DEFINE_UNQUOTED(OPAL_SIZEOF_INT, $ac_cv_sizeof_int, - [Do not use outside of mpi.h. The size of a `int', as computed by sizeof.]) dnl ` - ############################################################################ # Party on ############################################################################ diff --git a/ompi/mpi/cxx/comm_inln.h b/ompi/mpi/cxx/comm_inln.h index 5ed15e6236..1c154a05c2 100644 --- a/ompi/mpi/cxx/comm_inln.h +++ b/ompi/mpi/cxx/comm_inln.h @@ -654,17 +654,17 @@ MPI::Comm::DUP_FN(const MPI::Comm& oldcomm, int comm_keyval, void* extra_state, void* attribute_val_in, void* attribute_val_out, bool& flag) { -#if OPAL_SIZEOF_BOOL != OPAL_SIZEOF_INT - int f = (int)flag; - int ret; - ret = MPI_DUP_FN(oldcomm, comm_keyval, extra_state, attribute_val_in, - attribute_val_out, &f); - flag = OPAL_INT_TO_BOOL(f); - return ret; -#else - return MPI_DUP_FN(oldcomm, comm_keyval, extra_state, attribute_val_in, - attribute_val_out, (int*)&flag); -#endif + if (sizeof(bool) != sizeof(int)) { + int f = (int)flag; + int ret; + ret = MPI_DUP_FN(oldcomm, comm_keyval, extra_state, attribute_val_in, + attribute_val_out, &f); + flag = OPAL_INT_TO_BOOL(f); + return ret; + } else { + return MPI_DUP_FN(oldcomm, comm_keyval, extra_state, attribute_val_in, + attribute_val_out, (int*)&flag); + } } inline int