From 561ff4897407105f37791f39b936da1d1c7c09d7 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 23 May 2012 16:22:00 +0200 Subject: [PATCH] Apparently, constructor priorities are not supported on Macs. --- include/xbt/log.h | 8 +++++++- include/xbt/misc.h | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/xbt/log.h b/include/xbt/log.h index 00cee16dad..d4225712e1 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -90,6 +90,12 @@ typedef enum { #define _XBT_LOGV_CTOR(cat) _XBT_LOG_CONCAT2(_XBT_LOGV(cat), __constructor__) #define _XBT_LOG_CONCAT(x, y) x ## y #define _XBT_LOG_CONCAT2(x, y) _XBT_LOG_CONCAT(x, y) +/* Apparently, constructor priorities are not supported on Macs */ +#if APPLE +# define _XBT_LOGV_CTOR_ATTRIBUTE +#else +# define _XBT_LOGV_CTOR_ATTRIBUTE _XBT_GNUC_CONSTRUCTOR(600) +#endif /* The root of the category hierarchy. */ #define XBT_LOG_ROOT_CAT root @@ -120,7 +126,7 @@ typedef enum { * to avoid an extra declaration of root when XBT_LOG_NEW_SUBCATEGORY is called by * XBT_LOG_NEW_CATEGORY */ #define XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \ - XBT_PUBLIC(void) _XBT_LOGV_CTOR(catName)(void) _XBT_GNUC_CONSTRUCTOR(600); \ + XBT_PUBLIC(void) _XBT_LOGV_CTOR(catName)(void) _XBT_LOGV_CTOR_ATTRIBUTE; \ void _XBT_LOGV_CTOR(catName)(void) \ { \ XBT_LOG_EXTERNAL_CATEGORY(catName); \ diff --git a/include/xbt/misc.h b/include/xbt/misc.h index ed4bc8ac6e..314dd88a43 100644 --- a/include/xbt/misc.h +++ b/include/xbt/misc.h @@ -17,8 +17,14 @@ __attribute__((__format__ (__scanf__, format_idx, arg_idx))) # define _XBT_GNUC_NORETURN __attribute__((__noreturn__)) # define _XBT_GNUC_UNUSED __attribute__((__unused__)) -# define _XBT_GNUC_CONSTRUCTOR(prio) __attribute__((__constructor__ (prio))) -# define _XBT_GNUC_DESTRUCTOR(prio) __attribute__((__destructor__ (prio))) +/* Apparently, constructor priorities are not supported on Macs */ +# if APPLE +# define _XBT_GNUC_CONSTRUCTOR(prio) __attribute__((__constructor__)) +# define _XBT_GNUC_DESTRUCTOR(prio) __attribute__((__destructor__)) +# else +# define _XBT_GNUC_CONSTRUCTOR(prio) __attribute__((__constructor__ (prio))) +# define _XBT_GNUC_DESTRUCTOR(prio) __attribute__((__destructor__ (prio))) +# endif # undef _XBT_NEED_INIT_PRAGMA #else /* !__GNUC__ */ -- 2.20.1