diff --git a/src/pugixml.cpp b/src/pugixml.cpp index d14042528f2be961e0798b29caea323a5341c510..0b9651a76907321273dc2950eaae0f512626944e 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -106,8 +106,8 @@ # define PUGI__DMC_VOLATILE #endif -// Integer sanitizer workaround -#ifdef __has_attribute +// Integer sanitizer workaround; we only apply this for clang since gcc8 has no_sanitize but not unsigned-integer-overflow and produces "attribute directive ignored" warnings +#if defined(__clang__) && defined(__has_attribute) # if __has_attribute(no_sanitize) # define PUGI__UNSIGNED_OVERFLOW __attribute__((no_sanitize("unsigned-integer-overflow"))) # else