Apple's (mis)use of the check macro

Chris Sherlock chris.sherlock79 at gmail.com
Mon Mar 20 14:36:40 UTC 2017


Hi all, 

We have had to undef the check macro in include/vcl/builder.hxx because Apple defined check in previous versions of AssertMacros.h

I found the same issue when I used osl/conditn.hxx - the build log shows the following failure:

In file included from /Users/tdf/lode/jenkins/workspace/lo_gerrit/Config/macosx_clang_dbgutil/vcl/quartz/ctfonts.cxx:32:
In file included from /Users/tdf/lode/jenkins/workspace/lo_gerrit/Config/macosx_clang_dbgutil/vcl/inc/osx/salinst.h:27:
/Users/tdf/lode/jenkins/workspace/lo_gerrit/Config/macosx_clang_dbgutil/include/osl/conditn.hxx:103:9: error: expected member name or ';' after declaration specifiers
        {
        ^
Now basically this is caused by Apple’s decision, many moons ago, to define a non-underscored macro “check” in AssertMacros.h

Later on they realised their grave mistake, and so they allow programmers to define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES as 0, which prevents the definition of a variety of macro names that tend to collide with function names commonly used in code. 

Unfortunately, it appears that AssertMacros.h is used in one header, which is in the CarbonCore framework - Debugging.h

This is in term used in CarbonCore.h, which is in turn included in the CoreServices framework, via the header CoreServices.h

CoreServices.h is used by the ApplicationServices framework, in (you guessed it…) ApplicationServices.h and probably a lot of other important framework services besides. 

The point is, by the time I get to defining __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES it’s far too late. 

Given the “viral” nature of this header, can we just bite the bullet and define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES as zero somewhere in the source? 

If others are agreeable, I’d love to do this - the only question is: where and how to do I do this?

Any help on this one gratefully accepted and appreciated :-)

Chris Sherlock
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20170321/caf68fd9/attachment.html>


More information about the LibreOffice mailing list