summaryrefslogtreecommitdiffstats
path: root/src/H5private.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5private.h')
-rw-r--r--src/H5private.h56
1 files changed, 42 insertions, 14 deletions
diff --git a/src/H5private.h b/src/H5private.h
index bb416ef..761ad17 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -44,7 +44,9 @@
#include <sys/time.h>
#endif
#ifdef H5_HAVE_UNISTD_H
+#ifdef H5_HAVE_PWD_H
#include <pwd.h>
+#endif
#include <unistd.h>
#include <sys/wait.h>
#endif
@@ -257,10 +259,10 @@
#define H5_ATTR_NORETURN __attribute__((noreturn))
#define H5_ATTR_CONST __attribute__((const))
#define H5_ATTR_PURE __attribute__((pure))
-#if defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
+#if defined(__clang__) || defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
#define H5_ATTR_FALLTHROUGH __attribute__((fallthrough));
#else
-#define H5_ATTR_FALLTHROUGH /*void*/
+#define H5_ATTR_FALLTHROUGH /* FALLTHROUGH */
#endif
#else
#define H5_ATTR_FORMAT(X, Y, Z) /*void*/
@@ -456,7 +458,7 @@
#define LOCK_UN 0x08
#endif /* H5_HAVE_FLOCK */
-/* Macros for enabling/disabling particular GCC warnings
+/* Macros for enabling/disabling particular GCC / clang warnings
*
* These are duplicated in H5FDmulti.c (we don't want to put them in the
* public header and the multi VFD can't use private headers). If you make
@@ -466,19 +468,45 @@
* http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
* http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
*/
-/* These pragmas are only implemented usefully in gcc 4.6+ */
-#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
-#define H5_GCC_DIAG_JOINSTR(x, y) x y
-#define H5_GCC_DIAG_DO_PRAGMA(x) _Pragma(#x)
-#define H5_GCC_DIAG_PRAGMA(x) H5_GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
-
-#define H5_GCC_DIAG_OFF(x) H5_GCC_DIAG_PRAGMA(push) H5_GCC_DIAG_PRAGMA(ignored H5_GCC_DIAG_JOINSTR("-W", x))
-#define H5_GCC_DIAG_ON(x) H5_GCC_DIAG_PRAGMA(pop)
+#define H5_DIAG_JOINSTR(x, y) x y
+#define H5_DIAG_DO_PRAGMA(x) _Pragma(#x)
+#define H5_DIAG_PRAGMA(x) H5_DIAG_DO_PRAGMA(GCC diagnostic x)
+
+#define H5_DIAG_OFF(x) H5_DIAG_PRAGMA(push) H5_DIAG_PRAGMA(ignored H5_DIAG_JOINSTR("-W", x))
+#define H5_DIAG_ON(x) H5_DIAG_PRAGMA(pop)
+
+/* Macros for enabling/disabling particular GCC-only warnings.
+ * These pragmas are only implemented usefully in gcc 4.6+
+ */
+#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
+#define H5_GCC_DIAG_OFF(x) H5_DIAG_OFF(x)
+#define H5_GCC_DIAG_ON(x) H5_DIAG_ON(x)
#else
#define H5_GCC_DIAG_OFF(x)
#define H5_GCC_DIAG_ON(x)
#endif
+/* Macros for enabling/disabling particular clang-only warnings.
+ */
+#if defined(__clang__)
+#define H5_CLANG_DIAG_OFF(x) H5_DIAG_OFF(x)
+#define H5_CLANG_DIAG_ON(x) H5_DIAG_ON(x)
+#else
+#define H5_CLANG_DIAG_OFF(x)
+#define H5_CLANG_DIAG_ON(x)
+#endif
+
+/* Macros for enabling/disabling particular GCC / clang warnings.
+ * These macros should be used for warnings supported by both gcc and clang.
+ */
+#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__)
+#define H5_GCC_CLANG_DIAG_OFF(x) H5_DIAG_OFF(x)
+#define H5_GCC_CLANG_DIAG_ON(x) H5_DIAG_ON(x)
+#else
+#define H5_GCC_CLANG_DIAG_OFF(x)
+#define H5_GCC_CLANG_DIAG_ON(x)
+#endif
+
/* Typedefs and functions for timing certain parts of the library. */
/* A set of elapsed/user/system times emitted as a time point by the
@@ -2227,7 +2255,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
* Use this macro for API functions that shouldn't perform _any_ initialization
* of the library or an interface, or push themselves on the function
* stack, or perform tracing, etc. This macro _only_ sanity checks the
- * API name itself. Examples are: H5TSmutex_acquire,
+ * API name itself. Examples are: H5TSmutex_acquire,
*
*/
#define FUNC_ENTER_API_NAMECHECK_ONLY \
@@ -2323,7 +2351,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
* Use this macro for non-API functions that shouldn't perform _any_ initialization
* of the library or an interface, or push themselves on the function
* stack, or perform tracing, etc. This macro _only_ sanity checks the
- * API name itself. Examples are private routines in the H5TS package.
+ * API name itself. Examples are private routines in the H5TS package.
*
*/
#define FUNC_ENTER_NOAPI_NAMECHECK_ONLY \
@@ -2401,7 +2429,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
* Use this macro for non-API functions that shouldn't perform _any_ initialization
* of the library or an interface, or push themselves on the function
* stack, or perform tracing, etc. This macro _only_ sanity checks the
- * API name itself. Examples are static routines in the H5TS package.
+ * API name itself. Examples are static routines in the H5TS package.
*
*/
#define FUNC_ENTER_STATIC_NAMECHECK_ONLY \