diff --git a/src/utils/PastisAssert.hpp b/src/utils/PastisAssert.hpp
index d260ce25f293e955c0bbfbaa66861345658f9995..6bcab320db2daad8624407f8a4741395df1d9600 100644
--- a/src/utils/PastisAssert.hpp
+++ b/src/utils/PastisAssert.hpp
@@ -1,6 +1,8 @@
 #ifndef PASTIS_ASSERT_HPP
 #define PASTIS_ASSERT_HPP
 
+#include <PastisMacros.hpp>
+
 #include <rang.hpp>
 #include <iostream>
 #include <string>
@@ -45,14 +47,14 @@ class AssertError
   ~AssertError() = default;
 };
 
-#pragma GCC diagnostic ignored "-Wattributes"
+PRAGMA_DIAGNOSTIC_IGNORED_WATTRIBUTES
 inline bool
 __attribute__((analyzer_noreturn))
 _pastis_assert(const bool& assert)
 {
   return assert;
 }
-#pragma GCC diagnostic pop
+PRAGMA_DIAGNOSTIC_POP
 
 #ifdef NDEBUG
 
diff --git a/src/utils/PastisMacros.hpp b/src/utils/PastisMacros.hpp
index 59d2a579512a67a637f8c47f5745db89efea0a24..27f686688d90fd9ac640e2f73fba25258e56cd4c 100644
--- a/src/utils/PastisMacros.hpp
+++ b/src/utils/PastisMacros.hpp
@@ -10,4 +10,20 @@
 
 #define PASTIS_LAMBDA KOKKOS_LAMBDA
 
+// Sets macro to ignore unknown pragma
+
+#if !defined(__clang__) and defined(__GNUC__)
+
+#define PRAGMA_DIAGNOSTIC_IGNORED_WATTRIBUTES           \
+  _Pragma ("GCC diagnostic ignored \"-Wattributes\"")
+#define PRAGMA_DIAGNOSTIC_POP                   \
+  _Pragma ("GCC diagnostic pop")
+
+#else // !defined(__clang__) and defined(__GNUC__)
+
+#define PRAGMA_DIAGNOSTIC_IGNORED_WATTRIBUTES
+#define PRAGMA_DIAGNOSTIC_POP
+
+#endif
+
 #endif // PASTIS_MACROS_HPP