summaryrefslogtreecommitdiffstats
path: root/src/H5FDmulti.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FDmulti.c')
-rw-r--r--src/H5FDmulti.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 5f161aa..7849060 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -46,25 +46,30 @@
/* Macros for enabling/disabling particular GCC / clang warnings
*
- * These are (renamed) duplicates of macros in H5private.h. If you make changes
- * here, be sure to update those as well.
+ * These are duplicated in H5private.h. If you make changes here, be sure to
+ * update those as well.
*
* (see the following web-sites for more info:
* 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_MULTI_GCC_DIAG_JOINSTR(x, y) x y
-#define H5_MULTI_GCC_DIAG_DO_PRAGMA(x) _Pragma(#x)
-#define H5_MULTI_GCC_DIAG_PRAGMA(x) H5_MULTI_GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
-
-#define H5_MULTI_GCC_DIAG_OFF(x) \
- H5_MULTI_GCC_DIAG_PRAGMA(push) H5_MULTI_GCC_DIAG_PRAGMA(ignored H5_MULTI_GCC_DIAG_JOINSTR("-W", x))
-#define H5_MULTI_GCC_DIAG_ON(x) H5_MULTI_GCC_DIAG_PRAGMA(pop)
+#define H5_MULTI_DIAG_JOINSTR(x, y) x y
+#define H5_MULTI_DIAG_DO_PRAGMA(x) _Pragma(#x)
+#define H5_MULTI_DIAG_PRAGMA(x) H5_MULTI_DIAG_DO_PRAGMA(GCC diagnostic x)
+
+#define H5_MULTI_DIAG_OFF(x) \
+ H5_MULTI_DIAG_PRAGMA(push) H5_MULTI_DIAG_PRAGMA(ignored H5_MULTI_DIAG_JOINSTR("-W", x))
+#define H5_MULTI_DIAG_ON(x) H5_MULTI_DIAG_PRAGMA(pop)
+
+/* 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_MULTI_GCC_CLANG_DIAG_OFF(x) H5_MULTI_DIAG_OFF(x)
+#define H5_MULTI_GCC_CLANG_DIAG_ON(x) H5_MULTI_DIAG_ON(x)
#else
-#define H5_MULTI_GCC_DIAG_OFF(x)
-#define H5_MULTI_GCC_DIAG_ON(x)
+#define H5_MULTI_GCC_CLANG_DIAG_OFF(x)
+#define H5_MULTI_GCC_CLANG_DIAG_ON(x)
#endif
/* Loop through all mapped files */
@@ -2125,7 +2130,7 @@ compute_next(H5FD_multi_t *file)
* tmp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_MULTI_GCC_DIAG_OFF("format-nonliteral")
+H5_MULTI_GCC_CLANG_DIAG_OFF("format-nonliteral")
static int
open_members(H5FD_multi_t *file)
{
@@ -2163,7 +2168,7 @@ open_members(H5FD_multi_t *file)
return 0;
}
-H5_MULTI_GCC_DIAG_ON("format-nonliteral")
+H5_MULTI_GCC_CLANG_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
* Function: H5FD_multi_delete
@@ -2174,7 +2179,7 @@ H5_MULTI_GCC_DIAG_ON("format-nonliteral")
*
*-------------------------------------------------------------------------
*/
-H5_MULTI_GCC_DIAG_OFF("format-nonliteral")
+H5_MULTI_GCC_CLANG_DIAG_OFF("format-nonliteral")
static herr_t
H5FD_multi_delete(const char *filename, hid_t fapl_id)
{
@@ -2228,7 +2233,7 @@ H5FD_multi_delete(const char *filename, hid_t fapl_id)
return 0;
} /* end H5FD_multi_delete() */
-H5_MULTI_GCC_DIAG_ON("format-nonliteral")
+H5_MULTI_GCC_CLANG_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
* Function: H5FD_multi_ctl