Skip to content

Commit 1bce6a6

Browse files
committed
Mark mpif.h as deprecated
MPI 4.1 has deprecated mpif.h. We add a `#warning` directive that may be interpreted correctly if the Fortran compiler uses a C-style preprocessor or generate a warning about a illegal directive, showing the warning anyway: ``` 1 | #warning mpif.h is deprecated since MPI 4.1. Refer to MPI Sec. 19.1.4. | 1 Error: Illegal preprocessor directive [-Werror] ``` Signed-off-by: Joseph Schuchart <[email protected]>
1 parent 42b17ae commit 1bce6a6

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

config/ompi_setup_mpi_fortran.m4

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dnl Copyright (c) 2016-2022 IBM Corporation. All rights reserved.
2121
dnl Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
2222
dnl Copyright (c) 2022 Triad National Security, LLC. All rights
2323
dnl reserved.
24+
dnl Copyright (c) 2025 Stony Brook University. All rights reserved.
2425
dnl $COPYRIGHT$
2526
dnl
2627
dnl Additional copyrights may follow
@@ -54,6 +55,23 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
5455
OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK=0
5556
OMPI_FORTRAN_HAVE_PRIVATE=0
5657

58+
AC_MSG_CHECKING([if we should mark mpif.h bindings as deprecated])
59+
AC_ARG_ENABLE([deprecate-mpif-h],
60+
[AS_HELP_STRING([--enable-deprecate-mpif-h],
61+
[Mark the mpif.h bindings as deprecated (default: enabled)])])
62+
if test "$enable_deprecate_mpif_h" = "no"; then
63+
AC_MSG_RESULT([no])
64+
OMPI_FORTRAN_DEPRECATE_MPIF_H=""
65+
else
66+
if test "$enable_deprecate_mpif_h" = "yes"; then
67+
AC_MSG_RESULT([yes])
68+
else
69+
AC_MSG_RESULT([yes (default)])
70+
fi
71+
OMPI_FORTRAN_DEPRECATE_MPIF_H="#warning mpif.h is deprecated since MPI 4.1. Refer to MPI Sec. 19.1.4."
72+
fi
73+
AC_SUBST(OMPI_FORTRAN_DEPRECATE_MPIF_H)
74+
5775
# These macros control symbol names for Fortran/C interoperability
5876
#
5977
OMPI_F08_SUFFIX="_f08"

ompi/include/mpif.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
! WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
5454
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5555
56+
@OMPI_FORTRAN_DEPRECATE_MPIF_H@
57+
5658
include 'mpif-config.h'
5759
include 'mpif-constants.h'
5860
include 'mpif-handles.h'

0 commit comments

Comments
 (0)