diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-06-07 12:51:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-07 12:51:19 (GMT) |
commit | 2ceccedc54ed9f822fd0da71f2f7c5c73bcb2728 (patch) | |
tree | df866eda91afc1a9929cf57da3b52e3d6f77d6ea /src/H5public.h | |
parent | 2ea39d926a481769ee54a561bf6b754adb8fa0a6 (diff) | |
download | hdf5-2ceccedc54ed9f822fd0da71f2f7c5c73bcb2728.zip hdf5-2ceccedc54ed9f822fd0da71f2f7c5c73bcb2728.tar.gz hdf5-2ceccedc54ed9f822fd0da71f2f7c5c73bcb2728.tar.bz2 |
Bring gcc/clang attribute and warning macros over (#3063)
Diffstat (limited to 'src/H5public.h')
-rw-r--r-- | src/H5public.h | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/H5public.h b/src/H5public.h index 303a133..7fc36f5 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,19 +75,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_OFF(x) H5_GCC_DIAG_PRAGMA(push) H5_GCC_DIAG_PRAGMA(ignored H5_GCC_DIAG_JOINSTR("-W", x)) +#define H5_DIAG_ON(x) H5_GCC_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 + /* Version numbers */ /** * For major interface/format changes |