From f5c9553e6c4523ed4d697fcb49979859997bb49d Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Fri, 10 May 2024 17:31:29 -0700 Subject: [PATCH] Don't double-define preprocessor macros If MPI-related macros are already defined, don't set them again as this will result in a lot of compiler warnings. --- modules/mpi/include/ReplicaExchange.h | 6 ++++++ modules/mpi/src/ReplicaExchange.cpp | 6 ++++++ modules/mpi/src/internal/mpi_helpers.cpp | 6 ++++++ modules/mpi/utility/hello_world.cpp | 6 ++++++ modules/spb/bin/spb.cpp | 6 ++++++ modules/spb/bin/spb_density_perbead.cpp | 6 ++++++ 6 files changed, 36 insertions(+) diff --git a/modules/mpi/include/ReplicaExchange.h b/modules/mpi/include/ReplicaExchange.h index f5e4a9c009..1678cd1071 100644 --- a/modules/mpi/include/ReplicaExchange.h +++ b/modules/mpi/include/ReplicaExchange.h @@ -14,9 +14,15 @@ #include // We only want the C API, so try to suppress the C++ API +#ifndef MPICH_SKIP_MPICXX #define MPICH_SKIP_MPICXX +#endif +#ifndef OMPI_SKIP_MPICXX #define OMPI_SKIP_MPICXX +#endif +#ifndef _MPICC_H #define _MPICC_H +#endif #include IMPMPI_BEGIN_NAMESPACE diff --git a/modules/mpi/src/ReplicaExchange.cpp b/modules/mpi/src/ReplicaExchange.cpp index 8fc021e74d..3a4849b528 100644 --- a/modules/mpi/src/ReplicaExchange.cpp +++ b/modules/mpi/src/ReplicaExchange.cpp @@ -9,9 +9,15 @@ #include // We only want the C API, so try to suppress the C++ API +#ifndef MPICH_SKIP_MPICXX #define MPICH_SKIP_MPICXX +#endif +#ifndef OMPI_SKIP_MPICXX #define OMPI_SKIP_MPICXX +#endif +#ifndef _MPICC_H #define _MPICC_H +#endif #include "mpi.h" #include diff --git a/modules/mpi/src/internal/mpi_helpers.cpp b/modules/mpi/src/internal/mpi_helpers.cpp index 39524b4848..0fd8f7e378 100644 --- a/modules/mpi/src/internal/mpi_helpers.cpp +++ b/modules/mpi/src/internal/mpi_helpers.cpp @@ -8,9 +8,15 @@ #include // We only want the C API, so try to suppress the C++ API +#ifndef MPICH_SKIP_MPICXX #define MPICH_SKIP_MPICXX +#endif +#ifndef OMPI_SKIP_MPICXX #define OMPI_SKIP_MPICXX +#endif +#ifndef _MPICC_H #define _MPICC_H +#endif #include "mpi.h" #if defined(OMPI_MAJOR_VERSION) && !defined(_MSC_VER) diff --git a/modules/mpi/utility/hello_world.cpp b/modules/mpi/utility/hello_world.cpp index 95cd57a52a..91be8669a9 100644 --- a/modules/mpi/utility/hello_world.cpp +++ b/modules/mpi/utility/hello_world.cpp @@ -5,9 +5,15 @@ #include // We only want the C API, so try to suppress the C++ API +#ifndef MPICH_SKIP_MPICXX #define MPICH_SKIP_MPICXX +#endif +#ifndef OMPI_SKIP_MPICXX #define OMPI_SKIP_MPICXX +#endif +#ifndef _MPICC_H #define _MPICC_H +#endif #include static int numprocs; diff --git a/modules/spb/bin/spb.cpp b/modules/spb/bin/spb.cpp index 93d6af6aba..78fca129b4 100644 --- a/modules/spb/bin/spb.cpp +++ b/modules/spb/bin/spb.cpp @@ -20,9 +20,15 @@ #include // We only want the C API, so try to suppress the C++ API +#ifndef MPICH_SKIP_MPICXX #define MPICH_SKIP_MPICXX +#endif +#ifndef OMPI_SKIP_MPICXX #define OMPI_SKIP_MPICXX +#endif +#ifndef _MPICC_H #define _MPICC_H +#endif #include "mpi.h" using namespace IMP; diff --git a/modules/spb/bin/spb_density_perbead.cpp b/modules/spb/bin/spb_density_perbead.cpp index e0db922ab1..169d34ab36 100644 --- a/modules/spb/bin/spb_density_perbead.cpp +++ b/modules/spb/bin/spb_density_perbead.cpp @@ -18,9 +18,15 @@ #include // We only want the C API, so try to suppress the C++ API +#ifndef MPICH_SKIP_MPICXX #define MPICH_SKIP_MPICXX +#endif +#ifndef OMPI_SKIP_MPICXX #define OMPI_SKIP_MPICXX +#endif +#ifndef _MPICC_H #define _MPICC_H +#endif #include "mpi.h" using namespace IMP;