Fix MSVC 2019 warnings
[alexxy/gromacs.git] / src / gromacs / utility / basedefinitions.h
index dd0bb86b00e7c4f5a3a4bc372a89b8f6a1ee65d7..d1ae0c6ce71f26f60b9398f866daf8008be71ff3 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -151,12 +151,22 @@ index ssize(const T& t)
 #    define DO_PRAGMA(x) _Pragma(#    x)
 #    define CLANG_DIAGNOSTIC_IGNORE(warning) \
         _Pragma("clang diagnostic push") DO_PRAGMA(clang diagnostic ignored #warning)
-#    define DIAGNOSTIC_RESET _Pragma("clang diagnostic pop")
+#    define CLANG_DIAGNOSTIC_RESET _Pragma("clang diagnostic pop")
 #else
-//! Ignore specified clang warning until DIAGNOSTIC_RESET
+//! Ignore specified clang warning until CLANG_DIAGNOSTIC_RESET
 #    define CLANG_DIAGNOSTIC_IGNORE(warning)
 //! Reset all diagnostics to default
-#    define DIAGNOSTIC_RESET
+#    define CLANG_DIAGNOSTIC_RESET
+#endif
+
+#ifdef _MSC_VER
+#    define MSVC_DIAGNOSTIC_IGNORE(id) __pragma(warning(push)) __pragma(warning(disable : id))
+#    define MSVC_DIAGNOSTIC_RESET __pragma(warning(pop))
+#else
+//! Ignore specified MSVC warning until MSVC_DIAGNOSTIC_RESET
+#    define MSVC_DIAGNOSTIC_IGNORE(warning)
+//! Reset all diagnostics to default
+#    define MSVC_DIAGNOSTIC_RESET
 #endif
 
 namespace gmx