From be21ea2391cb5985a01f32adf8f688c52d1e1a51 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 28 Oct 2008 12:25:08 +0000 Subject: [PATCH] Back out r19805 and replace it with something a bit better, based on a suggestion from George during review. Refs trac:1595. This commit was SVN r19818. The following SVN revision numbers were found above: r19805 --> open-mpi/ompi@bc710baa75f801f6b4245be0cda8cbaa1a893fad The following Trac tickets were found above: Ticket 1595 --> https://svn.open-mpi.org/trac/ompi/ticket/1595 --- config/ompi_configure_options.m4 | 5 ----- ompi/tools/ompi_info/param.cc | 23 +++++++++++++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/config/ompi_configure_options.m4 b/config/ompi_configure_options.m4 index ab8129b684..55c52dc7b0 100644 --- a/config/ompi_configure_options.m4 +++ b/config/ompi_configure_options.m4 @@ -345,25 +345,20 @@ mpi_param_check=ompi_mpi_param_check if test "$with_mpi_param_check" = "no" -o \ "$with_mpi_param_check" = "never"; then mpi_param_check=0 - mpi_param_check_level=0 AC_MSG_RESULT([never]) elif test "$with_mpi_param_check" = "yes" -o \ "$with_mpi_param_check" = "always"; then mpi_param_check=1 - mpi_param_check_level=1 AC_MSG_RESULT([always]) elif test "$with_mpi_param_check" = "runtime" -o \ -z "$with_mpi_params_check"; then AC_MSG_RESULT([runtime]) - mpi_param_check_level=2 else AC_MSG_RESULT([unknown]) AC_MSG_WARN([*** Unrecognized --with-mpi-param-check value]) AC_MSG_WARN([*** See "configure --help" output]) AC_MSG_WARN([*** Defaulting to "runtime"]) fi -AC_DEFINE_UNQUOTED(MPI_PARAM_CHECK_LEVEL, $mpi_param_check_level, - [Whether we want to check MPI parameters never (0), always (1), or decide at run-time (2) -- this macro mainly for displaying the right value in ompi_info]) AC_DEFINE_UNQUOTED(MPI_PARAM_CHECK, $mpi_param_check, [Whether we want to check MPI parameters always, never, or decide at run-time]) diff --git a/ompi/tools/ompi_info/param.cc b/ompi/tools/ompi_info/param.cc index 3f5214eb71..356c006be5 100644 --- a/ompi/tools/ompi_info/param.cc +++ b/ompi/tools/ompi_info/param.cc @@ -501,8 +501,27 @@ void ompi_info::do_config(bool want_all) const string f90profiling((OMPI_ENABLE_MPI_PROFILING && OMPI_WANT_F90_BINDINGS) ? "yes" : "no"); const string cxxexceptions(OMPI_HAVE_CXX_EXCEPTION_SUPPORT ? "yes" : "no"); - const string paramcheck(0 == MPI_PARAM_CHECK_LEVEL ? "never" : - 1 == MPI_PARAM_CHECK_LEVEL ? "always" : "runtime"); + // Do a little preprocessor trickery here to figure out the + // tri-state of MPI_PARAM_CHECK (which will be either 0, 1, or + // ompi_mpi_param_check). The preprocessor will only allow + // comparisons against constants, so you'll get a warning if you + // check MPI_PARAM_CHECK against 0 or 1, but its real value is the + // string ompi_mpi_param_check. So define ompi_mpi_param_check to + // be a constant, and then all the preprocessor comparisons work out + // ok. Note that we chose the preprocessor comparison route because + // it is not sufficient to simply set the variable + // ompi_mpi_param_check to a non-0/non-1 value. This is because the + // compiler will generate a warning that that C variable is unused + // when MPI_PARAM_CHECK is hard-coded to 0 or 1. + string paramcheck; +#define ompi_mpi_param_check 999 +#if 0 == MPI_PARAM_CHECK + paramcheck = "never"; +#elif 1 == MPI_PARAM_CHECK + paramcheck = "always"; +#else + paramcheck = "runtime"; +#endif string threads; const string want_libltdl(OMPI_WANT_LIBLTDL ? "yes" : "no"); const string mpirun_prefix_by_default(ORTE_WANT_ORTERUN_PREFIX_BY_DEFAULT ?