From 8a53e873d7221e4b9146cf2c21d67d1fec4cd4f2 Mon Sep 17 00:00:00 2001
From: Jeff Hammond <jeff.r.hammond@intel.com>
Date: Sun, 1 Mar 2020 21:41:27 -0800
Subject: [PATCH 2/2] conditionalize MPI_UB/MPI_LB on existence

Open-MPI 4 implements the MPI-3 standard deletion of MPI_UB and MPI_LB.
There is a backwards-compatibility mode, so we test for Open-MPI 4 and
not the compatibility mode when disabling references to these
identifiers.

There may be other valid strategies for dealing with this problem...

See https://www.open-mpi.org/faq/?category=mpi-removed#mpi-1-mpi-lb-ub
for details.

Signed-off-by: Jeff Hammond <jeff.r.hammond@intel.com>
---
 mpi/libmpiwrap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mpi/libmpiwrap.c b/mpi/libmpiwrap.c
index 987964396..c3e069839 100644
--- a/mpi/libmpiwrap.c
+++ b/mpi/libmpiwrap.c
@@ -278,8 +278,10 @@ static void showTy ( FILE* f, MPI_Datatype ty )
    else if (ty == MPI_LONG_INT)       fprintf(f,"LONG_INT");
    else if (ty == MPI_SHORT_INT)      fprintf(f,"SHORT_INT");
    else if (ty == MPI_2INT)           fprintf(f,"2INT");
+#if !((OMPI_MAJOR_VERSION >= 4) && !(OMPI_ENABLE_MPI1_COMPAT))
    else if (ty == MPI_UB)             fprintf(f,"UB");
    else if (ty == MPI_LB)             fprintf(f,"LB");
+#endif
 #  if defined(MPI_WCHAR)
    else if (ty == MPI_WCHAR)          fprintf(f,"WCHAR");
 #  endif
@@ -738,8 +740,10 @@ void walk_type ( void(*f)(void*,long), char* base, MPI_Datatype ty )
          f(base + offsetof(Ty,loc), sizeof(int));
          return;
       }
+#if !((OMPI_MAJOR_VERSION >= 4) && !(OMPI_ENABLE_MPI1_COMPAT))
       if (ty == MPI_LB || ty == MPI_UB)
          return; /* have zero size, so nothing needs to be done */
+#endif
       goto unhandled;
       /*NOTREACHED*/
    }
-- 
2.25.0

