*/
#define gmx_restrict __restrict
+/*! \def gmx_cxx_const
+ * \brief
+ * Keyword to work around C/C++ differences in possible const keyword usage.
+ *
+ * Some functions that do not modify their input parameters cannot declare
+ * those parameters as `const` and compile warning/error-free on both C and C++
+ * compilers because of differences in `const` semantics. This macro can be
+ * used in cases where C++ allows `const`, but C does not like it, to make the
+ * same declaration work for both.
+ */
+#ifdef __cplusplus
+#define gmx_cxx_const const
+#else
+#define gmx_cxx_const
+#endif
+
/*! \def gmx_unused
* \brief
- * Attribute to suppres compiler warnings about unused function parameters.
+ * Attribute to suppress compiler warnings about unused function parameters.
*
* This attribute suppresses compiler warnings about unused function arguments
* by marking them as possibly unused. Some arguments are unused but
#elif (defined(__INTEL_COMPILER) || defined(__ECC)) && !defined(_MSC_VER)
/* ICC on *nix */
# define gmx_unused __attribute__ ((unused))
+#elif defined(__PGI)
+/* Portland group compilers */
+# define gmx_unused __attribute__ ((unused))
#elif defined _MSC_VER
/* MSVC */
# define gmx_unused /*@unused@*/
#endif
#endif
+#ifndef __has_feature
+/** For compatibility with non-clang compilers. */
+#define __has_feature(x) 0
+#endif
+
+/*! \def gmx_noreturn
+ * \brief
+ * Indicate that a function is not expected to return.
+ *
+ */
+#ifndef gmx_noreturn
+#if defined(__GNUC__) || __has_feature(attribute_analyzer_noreturn)
+#define gmx_noreturn __attribute__((noreturn))
+#elif defined (_MSC_VER)
+#define gmx_noreturn __declspec(noreturn)
+#else
+#define gmx_noreturn
+#endif
+#endif
+
+
#endif