Skip to content

Commit

Permalink
Don't double-define preprocessor macros
Browse files Browse the repository at this point in the history
If MPI-related macros are already defined,
don't set them again as this will result in
a lot of compiler warnings.
  • Loading branch information
benmwebb committed May 11, 2024
1 parent 0fbac99 commit f5c9553
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/mpi/include/ReplicaExchange.h
Expand Up @@ -14,9 +14,15 @@
#include <string>

// 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>

IMPMPI_BEGIN_NAMESPACE
Expand Down
6 changes: 6 additions & 0 deletions modules/mpi/src/ReplicaExchange.cpp
Expand Up @@ -9,9 +9,15 @@
#include <IMP/mpi/internal/mpi_helpers.h>

// 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 <IMP/random.h>
Expand Down
6 changes: 6 additions & 0 deletions modules/mpi/src/internal/mpi_helpers.cpp
Expand Up @@ -8,9 +8,15 @@
#include <IMP/mpi/internal/mpi_helpers.h>

// 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)
Expand Down
6 changes: 6 additions & 0 deletions modules/mpi/utility/hello_world.cpp
Expand Up @@ -5,9 +5,15 @@
#include <iostream>

// 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>

static int numprocs;
Expand Down
6 changes: 6 additions & 0 deletions modules/spb/bin/spb.cpp
Expand Up @@ -20,9 +20,15 @@
#include <string>

// 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;
Expand Down
6 changes: 6 additions & 0 deletions modules/spb/bin/spb_density_perbead.cpp
Expand Up @@ -18,9 +18,15 @@
#include <string>

// 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;
Expand Down

0 comments on commit f5c9553

Please sign in to comment.