From 77d7e603792756da519ae2b7b3de1131fd0e6819 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 17 Jul 2017 22:15:35 -0700 Subject: Fix Clang/C2 compatibility Clang/C2 does not implement __builtin_expect; additionally we need to work around deprecation warnings for fopen by disabling them. --- src/pugixml.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index da4ecf9..b9e54fe 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -48,6 +48,11 @@ # pragma warning(disable: 4996) // this function or variable may be unsafe #endif +#if defined(_MSC_VER) && defined(__c2__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated" // this function or variable may be unsafe +#endif + #ifdef __INTEL_COMPILER # pragma warning(disable: 177) // function was declared but never referenced # pragma warning(disable: 279) // controlling expression is constant @@ -81,7 +86,7 @@ #endif // Branch weight controls -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(__c2__) # define PUGI__UNLIKELY(cond) __builtin_expect(cond, 0) #else # define PUGI__UNLIKELY(cond) (cond) @@ -12594,6 +12599,10 @@ namespace pugi # pragma warning(pop) #endif +#if defined(_MSC_VER) && defined(__c2__) +# pragma clang diagnostic pop +#endif + // Undefine all local macros (makes sure we're not leaking macros in header-only mode) #undef PUGI__NO_INLINE #undef PUGI__UNLIKELY -- cgit v1.2.3