From db8ebd33ad899db5fff41fe4c7749783e540ca92 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 18 Dec 2017 19:18:53 -0800 Subject: [PATCH] Fix the optnone attribute, add extension attribute See how the various compilers handle these Signed-off-by: Ralph Castain --- config/opal_check_attributes.m4 | 10 +++++++++- opal/include/opal_config_bottom.h | 6 ++++++ orte/orted/orted_submit.c | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config/opal_check_attributes.m4 b/config/opal_check_attributes.m4 index 9a23251d7b3..cd9acf6b4e2 100644 --- a/config/opal_check_attributes.m4 +++ b/config/opal_check_attributes.m4 @@ -561,12 +561,18 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [ _OPAL_CHECK_SPECIFIC_ATTRIBUTE([optnone], [ - void foo(void) __attribute__ ((__optnone__)); + void __attribute__ ((__optnone__)) foo(void); void foo(void) { return ; } ], [], []) + _OPAL_CHECK_SPECIFIC_ATTRIBUTE([extension], + [ + #define FOO __extension__ ({size_t bar; bar = 3;}) + ], + [], + []) fi # Now that all the values are set, define them @@ -621,4 +627,6 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [ [Whether your compiler has __attribute__ destructor or not]) AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_OPTNONE, [$opal_cv___attribute__optnone], [Whether your compiler has __attribute__ optnone or not]) + AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_EXTENSION, [$opal_cv___attribute__extension], + [Whether your compiler has __attribute__ extension or not]) ]) diff --git a/opal/include/opal_config_bottom.h b/opal/include/opal_config_bottom.h index c913c1f5107..58823471774 100644 --- a/opal/include/opal_config_bottom.h +++ b/opal/include/opal_config_bottom.h @@ -240,6 +240,12 @@ # define __opal_attribute_optnone__ #endif +#if OPAL_HAVE_ATTRIBUTE_EXTENSION +# define __opal_attribute_extension__ __extension__ +#else +# define __opal_attribute_extension__ +#endif + # if OPAL_C_HAVE_VISIBILITY # define OPAL_DECLSPEC __opal_attribute_visibility__("default") # define OPAL_MODULE_DECLSPEC __opal_attribute_visibility__("default") diff --git a/orte/orted/orted_submit.c b/orte/orted/orted_submit.c index 5c5f5fc4ae0..f4c350bc02a 100644 --- a/orte/orted/orted_submit.c +++ b/orte/orted/orted_submit.c @@ -173,7 +173,7 @@ char MPIR_attach_fifo[MPIR_MAX_PATH_LENGTH] = {0}; int MPIR_force_to_main = 0; static void orte_debugger_init_before_spawn(orte_job_t *jdata); -ORTE_DECLSPEC void* MPIR_Breakpoint(void) __opal_attribute_optnone__; +ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void); /* * Breakpoint function for parallel debuggers