Skip to content

Commit

Permalink
Silence -Wzero-as-null-pointer-constant for clang
Browse files Browse the repository at this point in the history
clang does not handle NULL the same way as gcc, so for now we silence
the warning.
  • Loading branch information
zeux committed Oct 16, 2023
1 parent 6699559 commit 76dec41
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/pugixml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
# pragma warning(disable: 4996) // this function or variable may be unsafe
#endif

#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // NULL as null pointer constant
#endif

#if defined(_MSC_VER) && defined(__c2__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated" // this function or variable may be unsafe
Expand Down Expand Up @@ -13157,16 +13162,20 @@ namespace pugi
# pragma option pop
#endif

#if defined(_MSC_VER) && defined(__c2__)
# pragma clang diagnostic pop
#endif

#if defined(__clang__)
# pragma clang diagnostic pop
#endif

// Intel C++ does not properly keep warning state for function templates,
// so popping warning state at the end of translation unit leads to warnings in the middle.
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
# 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_IMPL_NO_INLINE
#undef PUGI_IMPL_UNLIKELY
Expand Down

0 comments on commit 76dec41

Please sign in to comment.