File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -559,6 +559,14 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [
559
559
[],
560
560
[])
561
561
562
+ _OPAL_CHECK_SPECIFIC_ATTRIBUTE([constructor],
563
+ [
564
+ void foo(void) __attribute__ (( __constructor__)) ;
565
+ void foo(void) { return ; }
566
+ ],
567
+ [],
568
+ [])
569
+
562
570
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([destructor],
563
571
[
564
572
void foo(void) __attribute__ (( __destructor__)) ;
@@ -631,6 +639,8 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [
631
639
[Whether your compiler has __attribute__ warn unused result or not])
632
640
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_WEAK_ALIAS, [$opal_cv___attribute__weak_alias ],
633
641
[Whether your compiler has __attribute__ weak alias or not])
642
+ AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_CONSTRUCTOR, [$opal_cv___attribute__constructor ],
643
+ [Whether your compiler has __attribute__ constructor or not])
634
644
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_DESTRUCTOR, [$opal_cv___attribute__destructor ],
635
645
[Whether your compiler has __attribute__ destructor or not])
636
646
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_OPTNONE, [$opal_cv___attribute__optnone ],
Original file line number Diff line number Diff line change @@ -61,11 +61,13 @@ ompi_predefined_instance_t ompi_mpi_instance_null = {{{{0}}}};
61
61
62
62
#if defined(OPAL_RECURSIVE_MUTEX_STATIC_INIT )
63
63
static opal_recursive_mutex_t instance_lock = OPAL_RECURSIVE_MUTEX_STATIC_INIT ;
64
- #else
64
+ #elif defined( OPAL_HAVE_ATTRIBUTE_CONSTRUCTOR )
65
65
static opal_recursive_mutex_t instance_lock ;
66
- __attribute__(( __constructor__ )) static void instance_lock_init (void ) {
66
+ __opal_attribute_constructor__ static void instance_lock_init (void ) {
67
67
OBJ_CONSTRUCT (& instance_lock , opal_recursive_mutex_t );
68
68
}
69
+ #else
70
+ #error "No support for recursive mutexes available on this platform.
69
71
#endif /* defined(OPAL_RECURSIVE_MUTEX_STATIC_INIT) */
70
72
71
73
/** MPI_Init instance */
Original file line number Diff line number Diff line change 229
229
# define __opal_attribute_weak_alias__ (a )
230
230
#endif
231
231
232
+ #if OPAL_HAVE_ATTRIBUTE_CONSTRUCTOR
233
+ # define __opal_attribute_constructor__ __attribute__((__constructor__))
234
+ #else
235
+ # define __opal_attribute_constructor__
236
+ #endif
237
+
232
238
#if OPAL_HAVE_ATTRIBUTE_DESTRUCTOR
233
239
# define __opal_attribute_destructor__ __attribute__((__destructor__))
234
240
#else
You can’t perform that action at this time.
0 commit comments