Apple's (mis)use of the check macro

classic Classic list List threaded Threaded
2 messages Options
Chris Sherlock Chris Sherlock
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Apple's (mis)use of the check macro

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

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
David Tardon David Tardon
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Apple's (mis)use of the check macro

Hi,

On Tue, Mar 21, 2017 at 01:36:40AM +1100, Chris Sherlock wrote:

> 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 :-)

So it looks like it should be defined globally, right? You can add the
definition to gb_OSDEFS in solenv/gbuild/platform/macosx.mk . Another
possibility that should work (which might be a bit cleaner) would be to
add it to gb_LinkTarget_use_system_darwin_frameworks in the same
makefile, like this:

$(call gb_LinkTarget_add_defs,$(1),-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0)

D.
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Loading...