[compiler-rt] ad42ea3 - Make use of '#pragma clang diagnostic' only with __clang__.

Martin Liska via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 02:48:10 PDT 2023


Author: Martin Liska
Date: 2023-04-19T11:47:43+02:00
New Revision: ad42ea33bb39cfe4b82943e464382943962eb47c

URL: https://github.com/llvm/llvm-project/commit/ad42ea33bb39cfe4b82943e464382943962eb47c
DIFF: https://github.com/llvm/llvm-project/commit/ad42ea33bb39cfe4b82943e464382943962eb47c.diff

LOG: Make use of '#pragma clang diagnostic' only with __clang__.

Otherwise one gets the following warning with GCC:
warning: ignoring ‘#pragma clang diagnostic’ [-Wunknown-pragmas]

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

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
index 18940c5b5b2ec..bf3c2c28e32e3 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
@@ -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;


        


More information about the llvm-commits mailing list