mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-26 22:30:28 +00:00
Merged revisions 336734 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r336734 | tilghman | 2011-09-19 15:29:40 -0500 (Mon, 19 Sep 2011) | 18 lines Merged revisions 336733 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r336733 | tilghman | 2011-09-19 15:27:03 -0500 (Mon, 19 Sep 2011) | 11 lines Various changes to allow 1.8 to compile on Mac OS X Lion (10.7) * Makefile workaround for 10.6 extended to work on 10.7 and later. * Now uses the 'weak' symbol for Lion systems, which no longer support 'weak_import' Closes ASTERISK-17612. Closes ASTERISK-18213. Tested by: tilghman, oej. ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@336735 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -103,11 +103,11 @@
|
||||
#define AST_OPTIONAL_API_UNAVAILABLE INT_MIN
|
||||
|
||||
|
||||
#if defined(HAVE_ATTRIBUTE_weak_import)
|
||||
#if defined(HAVE_ATTRIBUTE_weak_import) || defined(HAVE_ATTRIBUTE_weak)
|
||||
|
||||
/*
|
||||
* This is the Darwin (Mac OS/X) implementation, that only provides the
|
||||
* 'weak_import' compiler attribute for weak symbols. On this platform,
|
||||
* This is the Darwin (Mac OS/X) implementation, that only provides the 'weak'
|
||||
* or 'weak_import' compiler attribute for weak symbols. On this platform,
|
||||
*
|
||||
* - The module providing the API will only provide a '__' prefixed version
|
||||
* of the API function to other modules (this will be hidden from the other
|
||||
@@ -117,13 +117,19 @@
|
||||
* - In the API module itself, access to the API function without using a
|
||||
* prefixed name is provided by a static pointer variable that holds the
|
||||
* function address.
|
||||
* - 'Consumer' modules of the API will use a combination of a weak_import
|
||||
* symbol, a local stub function, a pointer variable and a constructor function
|
||||
* (which initializes that pointer variable as the module is being loaded)
|
||||
* to provide safe, optional access to the API function without any special
|
||||
* code being required.
|
||||
* - 'Consumer' modules of the API will use a combination of a weak_import or
|
||||
* weak symbol, a local stub function, a pointer variable and a constructor
|
||||
* function (which initializes that pointer variable as the module is being
|
||||
* loaded) to provide safe, optional access to the API function without any
|
||||
* special code being required.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_ATTRIBUTE_weak_import)
|
||||
#define __default_attribute weak_import /* pre-Lion */
|
||||
#else
|
||||
#define __default_attribute weak /* Lion-onwards */
|
||||
#endif
|
||||
|
||||
#define AST_OPTIONAL_API_NAME(name) __##name
|
||||
|
||||
#if defined(AST_API_MODULE)
|
||||
@@ -140,17 +146,16 @@
|
||||
|
||||
#define AST_OPTIONAL_API(result, name, proto, stub) \
|
||||
static result __stub__##name proto stub; \
|
||||
__attribute__((weak_import)) typeof(__stub__##name) AST_OPTIONAL_API_NAME(name); \
|
||||
__attribute__((__default_attribute)) typeof(__stub__##name) AST_OPTIONAL_API_NAME(name); \
|
||||
static attribute_unused typeof(__stub__##name) * name; \
|
||||
static void __attribute__((constructor)) __init__##name(void) { name = AST_OPTIONAL_API_NAME(name) ? : __stub__##name; }
|
||||
|
||||
#define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) \
|
||||
static __attribute__((attr)) result __stub__##name proto stub; \
|
||||
__attribute__((attr, weak_import)) typeof(__stub__##name) AST_OPTIONAL_API_NAME(name); \
|
||||
__attribute__((attr, __default_attribute)) typeof(__stub__##name) AST_OPTIONAL_API_NAME(name); \
|
||||
static attribute_unused __attribute__((attr)) typeof(__stub__##name) * name; \
|
||||
static void __attribute__((constructor)) __init__##name(void) { name = AST_OPTIONAL_API_NAME(name) ? : __stub__##name; }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* End of Darwin (Mac OS/X) implementation */
|
||||
|
||||
Reference in New Issue
Block a user