|
9 | 9 | * University of Stuttgart. All rights reserved. |
10 | 10 | * Copyright (c) 2004-2005 The Regents of the University of California. |
11 | 11 | * All rights reserved. |
12 | | - * Copyright (c) 2007-2019 Cisco Systems, Inc. All rights reserved |
| 12 | + * Copyright (c) 2007-2020 Cisco Systems, Inc. All rights reserved |
13 | 13 | * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. |
14 | 14 | * Copyright (c) 2009-2012 Oak Rigde National Laboratory. All rights reserved. |
15 | 15 | * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. |
|
242 | 242 | * only relevant if we're not building Open MPI (i.e., we're compiling an |
243 | 243 | * MPI application). |
244 | 244 | */ |
245 | | -#if !OMPI_BUILDING \ |
246 | | - |
| 245 | +#if !OMPI_BUILDING |
247 | 246 | /* |
248 | 247 | * Figure out which compiler is being invoked (in order to compare if |
249 | 248 | * it was different than what OMPI was built with). |
|
276 | 275 | * just emit a compiletime warning (via the deprecation function |
277 | 276 | * attribute) that they're using an MPI1 removed function. |
278 | 277 | * |
279 | | - * Otherwise, we'd like to issue a fatal error directing the user |
280 | | - * that they've used an MPI1 removed function. If the user's |
281 | | - * compiler supports C11 _Static_assert feature, we #define |
282 | | - * the MPI routines to instead be a call to _Static_assert |
283 | | - * with an appropriate message suggesting the new MPI3 equivalent. |
| 278 | + * Otherwise, we'd like to issue a fatal error directing the |
| 279 | + * user that they've used an MPI1 removed function. If the |
| 280 | + * user's compiler supports C11 _Static_assert() or |
| 281 | + * C++11 static_assert(), we #define the MPI routines to |
| 282 | + * instead be a call to an assert with an appropriate message |
| 283 | + * suggesting the new MPI3 equivalent. |
284 | 284 | * |
285 | 285 | * Otherwise, if the user's compiler supports the error function |
286 | 286 | * attribute, define the MPI routines with that error attribute. |
|
296 | 296 | # define OMPI_OMIT_MPI1_COMPAT_DECLS 0 |
297 | 297 | # define OMPI_REMOVED_USE_STATIC_ASSERT 0 |
298 | 298 | # define __mpi_interface_removed__(func, newfunc) __mpi_interface_deprecated__(#func " was removed in MPI-3.0. Use " #newfunc " instead. continuing...") |
299 | | -# elif (__STDC_VERSION__ >= 201112L) |
| 299 | +# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) |
| 300 | + /* This is the C11 (or later) case, which uses |
| 301 | + _Static_assert() */ |
300 | 302 | # define OMPI_OMIT_MPI1_COMPAT_DECLS 1 |
301 | 303 | # define OMPI_REMOVED_USE_STATIC_ASSERT 1 |
302 | | -// This macro definition may show up in compiler output. So we both |
303 | | -// outdent it back to column 0 and give it a user-friendly name to |
304 | | -// help users grok what we are trying to tell them here. |
305 | | -#define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(func, newfunc) _Static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.") |
| 304 | +/* This macro definition may show up in compiler output. So we both |
| 305 | + * outdent it back to column 0 and give it a user-friendly name to |
| 306 | + * help users grok what we are trying to tell them here. |
| 307 | + */ |
| 308 | +#define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(symbol, new_symbol) 0; _Static_assert(0, #symbol " was removed in MPI-3.0. Use " #new_symbol " instead.") |
| 309 | +#define THIS_FUNCTION_WAS_REMOVED_IN_MPI30(func, newfunc) _Static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.") |
| 310 | +# elif defined(__cplusplus) && (__cplusplus >= 201103L) |
| 311 | + /* This is the C++11 (or later) case, which uses |
| 312 | + static_assert() */ |
| 313 | +# define OMPI_OMIT_MPI1_COMPAT_DECLS 1 |
| 314 | +# define OMPI_REMOVED_USE_STATIC_ASSERT 1 |
| 315 | +/* This macro definition may show up in compiler output. So we both |
| 316 | + * outdent it back to column 0 and give it a user-friendly name to |
| 317 | + * help users grok what we are trying to tell them here. |
| 318 | + */ |
| 319 | +#define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(symbol, new_symbol) 0; static_assert(0, #symbol " was removed in MPI-3.0. Use " #new_symbol " instead.") |
| 320 | +#define THIS_FUNCTION_WAS_REMOVED_IN_MPI30(func, newfunc) static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.") |
306 | 321 | # elif OPAL_HAVE_ATTRIBUTE_ERROR |
307 | 322 | # define OMPI_OMIT_MPI1_COMPAT_DECLS 0 |
308 | 323 | # define OMPI_REMOVED_USE_STATIC_ASSERT 0 |
|
328 | 343 | #endif |
329 | 344 |
|
330 | 345 | #if !defined(THIS_SYMBOL_WAS_REMOVED_IN_MPI30) |
331 | | -# define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(func, newfunc) |
| 346 | +# define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(symbol, newsymbol) |
| 347 | +#endif |
| 348 | +#if !defined(THIS_FUNCTION_WAS_REMOVED_IN_MPI30) |
| 349 | +# define THIS_FUNCTION_WAS_REMOVED_IN_MPI30(func, newfunc) |
332 | 350 | #endif |
333 | 351 |
|
334 | 352 | #if !defined(OMPI_REMOVED_USE_STATIC_ASSERT) |
@@ -2802,16 +2820,16 @@ OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) |
2802 | 2820 | #endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */ |
2803 | 2821 |
|
2804 | 2822 | #if OMPI_REMOVED_USE_STATIC_ASSERT |
2805 | | -#define MPI_Address(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Address, MPI_Get_address) |
2806 | | -#define MPI_Errhandler_create(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Errhandler_create, MPI_Comm_create_errhandler) |
2807 | | -#define MPI_Errhandler_get(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Errhandler_get, MPI_Comm_get_errhandler) |
2808 | | -#define MPI_Errhandler_set(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Errhandler_set, MPI_Comm_set_errhandler) |
2809 | | -#define MPI_Type_extent(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_extent, MPI_Type_get_extent) |
2810 | | -#define MPI_Type_hindexed(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_hindexed, MPI_Type_create_hindexed) |
2811 | | -#define MPI_Type_hvector(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_hvector, MPI_Type_create_hvector) |
2812 | | -#define MPI_Type_lb(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_lb, MPI_Type_get_extent) |
2813 | | -#define MPI_Type_struct(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_struct, MPI_Type_create_struct) |
2814 | | -#define MPI_Type_ub(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_ub, MPI_Type_get_extent) |
| 2823 | +#define MPI_Address(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Address, MPI_Get_address) |
| 2824 | +#define MPI_Errhandler_create(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Errhandler_create, MPI_Comm_create_errhandler) |
| 2825 | +#define MPI_Errhandler_get(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Errhandler_get, MPI_Comm_get_errhandler) |
| 2826 | +#define MPI_Errhandler_set(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Errhandler_set, MPI_Comm_set_errhandler) |
| 2827 | +#define MPI_Type_extent(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_extent, MPI_Type_get_extent) |
| 2828 | +#define MPI_Type_hindexed(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_hindexed, MPI_Type_create_hindexed) |
| 2829 | +#define MPI_Type_hvector(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_hvector, MPI_Type_create_hvector) |
| 2830 | +#define MPI_Type_lb(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_lb, MPI_Type_get_extent) |
| 2831 | +#define MPI_Type_struct(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_struct, MPI_Type_create_struct) |
| 2832 | +#define MPI_Type_ub(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_ub, MPI_Type_get_extent) |
2815 | 2833 | #endif |
2816 | 2834 |
|
2817 | 2835 | #if defined(c_plusplus) || defined(__cplusplus) |
|
0 commit comments