Commit be419a8e authored by Josh Watzman's avatar Josh Watzman Committed by Sara Golemon

Remove constructor version attribute on OS X

Summary:
OS X doesn't support this -- it requires support at the linker
level which OS X just doesn't have. Reasonable OS X compilers will yell
about it, but even the ones that don't are just silently dropping it
on the floor.

So I'm not sure what //we// can do other than just silently dropping
this on the floor too and hoping that everything works.

Test Plan:
HHVM build on OS X gets ever so slightly further (runs into
other issues). HHVM build in fbcode still seems to build folly okay
(didn't wait for it to finish fully).

Fixes https://github.com/facebook/folly/issues/78

Reviewed By: tudorb@fb.com

FB internal diff: D1487191

Blame Revision: rFBCODE502be7cb0fda306ddc33b9c5ad7a53b0cfbdc893
parent 747f8a8e
......@@ -67,6 +67,14 @@
*
* ... and then commpile your file with -DMYLIB_VERSION=\"1\"
*/
#ifdef __APPLE__
// OS X doesn't support constructor priorities. Just pray it works, I guess.
#define FOLLY_VERSION_CHECK_PRIORITY __attribute__((constructor))
#else
#define FOLLY_VERSION_CHECK_PRIORITY __attribute__((constructor(101)))
#endif
// Note that this is carefully crafted: PRODUCT##Version must have external
// linkage (so it collides among versions), versionCheck must have internal
// linkage (so it does NOT collide between versions); if we're trying to have
......@@ -75,7 +83,7 @@
#define FOLLY_VERSION_CHECK(PRODUCT, VERSION) \
const char* PRODUCT##Version = VERSION; \
namespace { \
__attribute__((constructor(101))) void versionCheck() { \
FOLLY_VERSION_CHECK_PRIORITY void versionCheck() { \
if (strcmp(PRODUCT##Version, VERSION)) { \
fprintf(stderr, \
"Invalid %s version: desired [%s], currently loaded [%s]\n", \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment