Martin --

Someone filed the same issue shortly before your post:

    https://github.com/open-mpi/ompi/issues/7810

On Jun 12, 2020, at 6:10 PM, Martin Audet via users 
<users@lists.open-mpi.org<mailto:users@lists.open-mpi.org>> wrote:

Hello OMPI_Developers,

When I compile my C++ code with Open MPI version 4.0.3 or 4.0.4 (I think that 
4.0.2 and 4.0.1 would have the same problem), I get many of warnings like (1 
per source file):

/work/software/x86_64/openmpi-4.0.4/include/mpi.h:316:16: warning: 
"__STDC_VERSION__" is not defined, evaluates to 0 [-Wundef]

I use g++ 9.3.1 on Fedora 31 Linux with many warnings options enabled (like 
-Wundef to report the use of undefined macros) but I have the same problem on 
CentOS 7.6 with the system compiler.

This problem is caused by the fact that, starting with Open MPI version 4.0.1, 
mpi.h try to use the _Static_assert() macro defined by the C11 language to 
cleanly state that a given symbol is no longer available because it was 
deprecated by the MPI 3.0 standard. To see if it is available, it checks the 
__STDC_VERSION__ macro as follow (mpi.h, line 316):

#         elif (__STDC_VERSION__ >= 201112L)

This macro is not defined by the C++ standard (or at least g++ doesn't define 
it) so it would be cleaner if it would be tested only if __cplusplus is not 
defined. Also if __cplusplus is defined and >= 201103L (C++11), the 
static_assert() keyword could be used instead of _Static_assert().

Thanks a lot for looking at how to fix this little annoyance.

Martin Audet


--
Jeff Squyres
jsquy...@cisco.com<mailto:jsquy...@cisco.com>

Reply via email to