Make use of '#pragma clang diagnostic' only with __clang__.
authorMartin Liska <mliska@suse.cz>
Wed, 19 Apr 2023 09:47:43 +0000 (11:47 +0200)
committerMartin Liska <mliska@suse.cz>
Wed, 19 Apr 2023 09:47:43 +0000 (11:47 +0200)
Otherwise one gets the following warning with GCC:
warning: ignoring â€˜#pragma clang diagnostic’ [-Wunknown-pragmas]

Differential Revision: https://reviews.llvm.org/D148695

compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h

index 18940c5..bf3c2c2 100644 (file)
@@ -84,10 +84,14 @@ class MemoryMappingLayout : public MemoryMappingLayoutBase {
 // This destructor cannot be virtual, as it would cause an operator new() linking
 // failures in hwasan test cases. However non-virtual destructors emit warnings
 // in macOS build, hence disabling those
+#ifdef __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
   ~MemoryMappingLayout();
+#ifdef __clang__
 #pragma clang diagnostic pop
+#endif
 
   virtual bool Next(MemoryMappedSegment *segment) override;
   virtual bool Error() const override;