Some Mac header #defines macros like check and equivalent -- gack!!

Given that third-party libraries (such as Boost) can and do use those names,
properly namespace-scoped, it's unpardonable to break any such innocent usage
with a macro. Given the pervasiveness of the need, introduce a header file
with the requisite #undef directives.
master
Nat Goodspeed 2012-11-16 18:08:40 -05:00
parent 4d1b62f46b
commit aaf96507a1
10 changed files with 34 additions and 8 deletions

View File

@ -116,6 +116,7 @@ set(llcommon_HEADER_FILES
bitpack.h
ctype_workaround.h
doublelinkedlist.h
fix_macros.h
imageids.h
indra_constants.h
linden_common.h

View File

@ -0,0 +1,25 @@
/**
* @file fix_macros.h
* @author Nat Goodspeed
* @date 2012-11-16
* @brief The Mac system headers seem to #define macros with obnoxiously
* generic names, preventing any library from using those names. We've
* had to fix these in so many places that it's worth making a header
* file to handle it.
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Copyright (c) 2012, Linden Research, Inc.
* $/LicenseInfo$
*/
// DON'T use an #include guard: every time we encounter this header, #undef
// these macros all over again.
// who injects MACROS with such generic names?! Grr.
#ifdef equivalent
#undef equivalent
#endif
#ifdef check
#undef check
#endif

View File

@ -30,6 +30,7 @@
#include "linden_common.h"
#include "fix_macros.h"
#include <boost/thread.hpp>
#include "llapr.h"

View File

@ -26,6 +26,7 @@
#include "lldiriterator.h"
#include "fix_macros.h"
#include <boost/filesystem.hpp>
#include <boost/regex.hpp>

View File

@ -36,8 +36,8 @@
#include <AGL/agl.h>
// AssertMacros.h does bad things.
#include "fix_macros.h"
#undef verify
#undef check
#undef require

View File

@ -41,8 +41,8 @@
#endif
// AssertMacros.h does bad things.
#include "fix_macros.h"
#undef verify
#undef check
#undef require

View File

@ -37,8 +37,8 @@
#include <Carbon/Carbon.h>
// AssertMacros.h does bad things.
#include "fix_macros.h"
#undef verify
#undef check
#undef require
#include <vector>

View File

@ -39,8 +39,8 @@
#include <Carbon/Carbon.h>
// AssertMacros.h does bad things.
#include "fix_macros.h"
#undef verify
#undef check
#undef require
#include <vector>

View File

@ -32,9 +32,7 @@
#include "lllocalbitmaps.h"
/* boost: will not compile unless equivalent is undef'd, beware. */
#ifdef equivalent
#undef equivalent
#endif
#include "fix_macros.h"
#include <boost/filesystem.hpp>
/* image compression headers. */

View File

@ -33,7 +33,7 @@
*/
#include <Carbon/Carbon.h>
#include "fix_macros.h"
#undef check
#undef verify
#undef require