nat_linden avatar nat_linden committed 4ab7023

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.

Comments (0)

Files changed (10)

indra/llcommon/CMakeLists.txt

     bitpack.h
     ctype_workaround.h
     doublelinkedlist.h
+    fix_macros.h
     imageids.h
     indra_constants.h
     linden_common.h

indra/llcommon/fix_macros.h

+/**
+ * @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

indra/llcorehttp/_refcounted.h

 
 #include "linden_common.h"
 
+#include "fix_macros.h"
 #include <boost/thread.hpp>
 
 #include "llapr.h"

indra/llvfs/lldiriterator.cpp

 
 #include "lldiriterator.h"
 
+#include "fix_macros.h"
 #include <boost/filesystem.hpp>
 #include <boost/regex.hpp>
 

indra/llwindow/llwindowmacosx.h

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

indra/llwindow/llwindowsdl.h

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

indra/newview/lldirpicker.h

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

indra/newview/llfilepicker.h

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

indra/newview/lllocalbitmaps.cpp

 #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. */

indra/newview/macutil_Prefix.h

  */
 
 #include <Carbon/Carbon.h>
+#include "fix_macros.h"
 
-#undef check
 #undef verify
 #undef require
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.