[MacPorts] #60325: icu 65.1: platform.h has macro clash with cpprestsdk (and possibly other libraries)
MacPorts
noreply at macports.org
Mon Apr 6 01:55:37 UTC 2020
#60325: icu 65.1: platform.h has macro clash with cpprestsdk (and possibly other
libraries)
-------------------------------------------------+-------------------------
Reporter: Lord-Kamina | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.6.2
Keywords: declspec clang dllimport dllexport | Port: icu
cpprestsdk |
-------------------------------------------------+-------------------------
I'll soon make a PR for this because it appears to be a simple fix;
nonetheless, I figured it would be a good idea to make a ticket here also
so we can track when it gets fixed upstream (I've already reported it at
https://unicode-org.atlassian.net/browse/ICU-21064
In short, in ICU65.1, they introduced macros around Clang's
`__has_attribute` features. In a few places they use those calls with
`dllexport`and `dllimport`as parameters, which clashes with macro
definitions in CppRestSdk. In my case, I noticed this compiling an app
that uses both CppRestSdk and ICU, which failed with the following error:
{{{
In file included from /Users/Koji/performous/game/unicode.hh:6:
In file included from /opt/local/include/libxml2/unicode/tblcoll.h:65:
In file included from /opt/local/include/libxml2/unicode/utypes.h:38:
In file included from /opt/local/include/libxml2/unicode/umachine.h:46:
In file included from /opt/local/include/libxml2/unicode/ptypes.h:52:
/opt/local/include/libxml2/unicode/platform.h:818:29: error: too few
arguments provided to function-like macro invocation
UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport))
^
/opt/local/include/libxml2/unicode/platform.h:438:69: note: expanded from
macro 'UPRV_HAS_DECLSPEC_ATTRIBUTE'
# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x)
^
/opt/local/include/libxml2/unicode/platform.h:843:29: error: too few
arguments provided to function-like macro invocation
UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport))
^
/opt/local/include/libxml2/unicode/platform.h:438:69: note: expanded from
macro 'UPRV_HAS_DECLSPEC_ATTRIBUTE'
# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x)
}}}
I'm not entirely sure whose at fault here, ICU or CppRestSdk, but as per
https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-
attribute, enclosing the attributes in double underscores will prevent the
clash (I tested it, and the error went away, at least)
--
Ticket URL: <https://trac.macports.org/ticket/60325>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list