From 31360cfbc9538686292e1c1cdba7f15ccec25add Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Thu, 30 Mar 2017 21:44:42 -0400
Subject: [PATCH] Create a common place to use mpidummy.h

---
 include/ADIOS.h                    |  6 +-----
 include/ADIOS_C.h                  |  6 +-----
 include/ADIOS_MPI.h                | 17 +++++++++++++++++
 include/core/Engine.h              |  6 +-----
 include/core/Transport.h           |  6 +-----
 include/format/BP1.h               |  6 +-----
 include/format/BP1Aggregator.h     |  6 +-----
 include/functions/adiosFunctions.h |  6 +-----
 include/mpidummy.h                 |  5 -----
 9 files changed, 24 insertions(+), 40 deletions(-)
 create mode 100644 include/ADIOS_MPI.h

diff --git a/include/ADIOS.h b/include/ADIOS.h
index 8bdca9c20..5d5af9dc0 100644
--- a/include/ADIOS.h
+++ b/include/ADIOS.h
@@ -21,11 +21,7 @@
 #include <vector>
 /// \endcond
 
-#ifdef ADIOS_NOMPI
-#include "mpidummy.h"
-#else
-#include <mpi.h>
-#endif
+#include "ADIOS_MPI.h"
 
 #include "ADIOSTypes.h"
 #include "core/Method.h"
diff --git a/include/ADIOS_C.h b/include/ADIOS_C.h
index 11d019f67..53f96070e 100644
--- a/include/ADIOS_C.h
+++ b/include/ADIOS_C.h
@@ -11,11 +11,7 @@
 #ifndef ADIOS_C_H_
 #define ADIOS_C_H_
 
-#ifdef ADIOS_NOMPI
-#define MPI_Comm int
-#else
-#include <mpi.h>
-#endif
+#include "ADIOS_MPI.h"
 
 typedef void ADIOS;
 typedef void Method;
diff --git a/include/ADIOS_MPI.h b/include/ADIOS_MPI.h
new file mode 100644
index 000000000..9948a8636
--- /dev/null
+++ b/include/ADIOS_MPI.h
@@ -0,0 +1,17 @@
+/*
+ * Distributed under the OSI-approved Apache License, Version 2.0.  See
+ * accompanying file Copyright.txt for details.
+ */
+
+#ifndef ADIOS_MPI_H_
+#define ADIOS_MPI_H_
+
+#ifdef ADIOS_NOMPI
+#include "mpidummy.h"
+#else
+#define OMPI_SKIP_MPICXX 1 // workaround for OpenMPI forcing C++ bindings
+#include <mpi.h>
+#undef OMPI_SKIP_MPICXX
+#endif
+
+#endif /* ADIOS_MPI_H_ */
diff --git a/include/core/Engine.h b/include/core/Engine.h
index 662cc1cbf..26a5fa034 100644
--- a/include/core/Engine.h
+++ b/include/core/Engine.h
@@ -20,11 +20,7 @@
 #include <vector>
 /// \endcond
 
-#ifdef ADIOS_NOMPI
-#include "mpidummy.h"
-#else
-#include <mpi.h>
-#endif
+#include "ADIOS_MPI.h"
 
 #include "ADIOS.h"
 #include "ADIOSTypes.h"
diff --git a/include/core/Transport.h b/include/core/Transport.h
index 127535e65..8b768825a 100644
--- a/include/core/Transport.h
+++ b/include/core/Transport.h
@@ -16,11 +16,7 @@
 #include <vector>
 /// \endcond
 
-#ifdef ADIOS_NOMPI
-#include "mpidummy.h"
-#else
-#include <mpi.h>
-#endif
+#include "ADIOS_MPI.h"
 
 #include "core/Profiler.h"
 
diff --git a/include/format/BP1.h b/include/format/BP1.h
index 8631099a8..fd2e16a4a 100644
--- a/include/format/BP1.h
+++ b/include/format/BP1.h
@@ -19,11 +19,7 @@
 //#include <queue>  //std::priority_queue to be added later
 /// \endcond
 
-#if ADIOS_NOMPI
-#include "mpidummy.h"
-#else
-#include <mpi.h>
-#endif
+#include "ADIOS_MPI.h"
 
 #include "core/Profiler.h"
 #include "core/Transport.h"
diff --git a/include/format/BP1Aggregator.h b/include/format/BP1Aggregator.h
index be2d897a4..a8cf13372 100644
--- a/include/format/BP1Aggregator.h
+++ b/include/format/BP1Aggregator.h
@@ -11,11 +11,7 @@
 #ifndef BP1AGGREGATOR_H_
 #define BP1AGGREGATOR_H_
 
-#ifdef ADIOS_NOMPI
-#include "mpidummy.h"
-#else
-#include <mpi.h>
-#endif
+#include "ADIOS_MPI.h"
 
 namespace adios
 {
diff --git a/include/functions/adiosFunctions.h b/include/functions/adiosFunctions.h
index c651b6a32..ab6edba1d 100644
--- a/include/functions/adiosFunctions.h
+++ b/include/functions/adiosFunctions.h
@@ -19,11 +19,7 @@
 #include <vector>
 /// \endcond
 
-#ifdef ADIOS_NOMPI
-#include "mpidummy.h"
-#else
-#include <mpi.h>
-#endif
+#include "ADIOS_MPI.h"
 
 #include "core/Transform.h"
 
diff --git a/include/mpidummy.h b/include/mpidummy.h
index 5e9035ab4..65b380f5c 100644
--- a/include/mpidummy.h
+++ b/include/mpidummy.h
@@ -1,11 +1,6 @@
 /*
  * Distributed under the OSI-approved Apache License, Version 2.0.  See
  * accompanying file Copyright.txt for details.
- *
- * ADIOS is freely available under the terms of the BSD license described
- * in the COPYING file in the top level directory of this source distribution.
- *
- * Copyright (c) 2008 - 2009.  UT-BATTELLE, LLC. All rights reserved.
  */
 
 #ifndef __MPI_DUMMY_H__
-- 
GitLab