summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-03-17 14:28:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-03-17 14:28:40 (GMT)
commitf2aa62ec76993c04c807c27e7a577a1ac3b0da3f (patch)
tree8bfa87fd91e47b88afc4c98e2ba0c2c97e3a10f1 /src
parent4ffe2f78c524e8edfc4be77117187870a5fd5a7a (diff)
downloadhdf5-f2aa62ec76993c04c807c27e7a577a1ac3b0da3f.zip
hdf5-f2aa62ec76993c04c807c27e7a577a1ac3b0da3f.tar.gz
hdf5-f2aa62ec76993c04c807c27e7a577a1ac3b0da3f.tar.bz2
[svn-r24810] Description:
Bring r24803 & r24804 from trunk to 1.8 branch: r24804: Brought changes from Coverity branch back to trunk, and cleaned up misc. other warnings & formatting issues: r20833: Fixed Coverity 667 and 668 with real integer overflow tests this time. r20834: Use HDstrncpy and HDstrncat. --gh r20835: Change to use strncpy - use base_len + 1 for line 156, use HDstrlen(path) + 1 for line 159 r20836: Fixed coverity 585 by casting output of fgetc() to a char. r20837: Changed sprintf calls to snprintf with size 1 less than the allocated buffer to address coverity issue #967. r24803: Rename GCC_DIAG_OFF/ON macros to H5_GCC_DIAG_OFF/ON and move from src/H5private.h to src/H5public.h. Wrap typedef of hsize_t and hssize_t in DIAG_OFF(long-long) macros. Clean up a bunch of "macro '-' is unused" warnings. Tested on: Mac OSX/64 10.9.2 (amazon) w/C++, FORTRAN & parallel (too minor to require h5committest)
Diffstat (limited to 'src')
-rw-r--r--src/H5Tconv.c108
-rw-r--r--src/H5private.h19
-rw-r--r--src/H5public.h21
3 files changed, 75 insertions, 73 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 50e9dc5..72da1bd 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -8039,9 +8039,9 @@ H5T__conv_float_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8066,9 +8066,9 @@ H5T__conv_float_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8093,9 +8093,9 @@ H5T__conv_double_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8120,9 +8120,9 @@ H5T__conv_double_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8148,9 +8148,9 @@ H5T__conv_ldouble_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8177,9 +8177,9 @@ H5T__conv_ldouble_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8205,9 +8205,9 @@ H5T__conv_float_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8232,9 +8232,9 @@ H5T__conv_float_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8259,9 +8259,9 @@ H5T__conv_double_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8286,9 +8286,9 @@ H5T__conv_double_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8314,9 +8314,9 @@ H5T__conv_ldouble_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/
@@ -8343,9 +8343,9 @@ H5T__conv_ldouble_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8371,9 +8371,9 @@ H5T__conv_float_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8398,9 +8398,9 @@ H5T__conv_float_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8425,9 +8425,9 @@ H5T__conv_double_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8452,9 +8452,9 @@ H5T__conv_double_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8480,9 +8480,9 @@ H5T__conv_ldouble_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8509,9 +8509,9 @@ H5T__conv_ldouble_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_UINT */
@@ -8537,9 +8537,9 @@ H5T__conv_float_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8564,9 +8564,9 @@ H5T__conv_float_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8591,9 +8591,9 @@ H5T__conv_double_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8618,9 +8618,9 @@ H5T__conv_double_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
@@ -8646,9 +8646,9 @@ H5T__conv_ldouble_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/
@@ -8675,9 +8675,9 @@ H5T__conv_ldouble_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8704,9 +8704,9 @@ H5T__conv_float_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_FP_LLONG */
@@ -8760,9 +8760,9 @@ H5T__conv_double_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_FP_LLONG*/
@@ -8816,9 +8816,9 @@ H5T__conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
-GCC_DIAG_OFF(float-equal)
+H5_GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX);
-GCC_DIAG_ON(float-equal)
+H5_GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/
diff --git a/src/H5private.h b/src/H5private.h
index 7462eda..f8ede63 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -2062,25 +2062,6 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
#define HDcompile_assert(e) do { typedef struct { unsigned int b: (e); } x; } while(0)
*/
-/* Macros for enabling/disabling particular GCC warnings */
-/* (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 GCC_DIAG_STR(s) #s
- #define GCC_DIAG_JOINSTR(x,y) GCC_DIAG_STR(x ## y)
- #define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
- #define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
-
- #define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x))
- #define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop)
-#else
- #define GCC_DIAG_OFF(x)
- #define GCC_DIAG_ON(x)
-#endif
-
/* Private functions, not part of the publicly documented API */
H5_DLL herr_t H5_init_library(void);
H5_DLL void H5_term_library(void);
diff --git a/src/H5public.h b/src/H5public.h
index 5db8deb..c92a18d 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -72,6 +72,25 @@
extern "C" {
#endif
+/* Macros for enabling/disabling particular GCC warnings */
+/* (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_GCC_DIAG_STR(s) #s
+ #define H5_GCC_DIAG_JOINSTR(x,y) H5_GCC_DIAG_STR(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)
+#else
+ #define H5_GCC_DIAG_OFF(x)
+ #define H5_GCC_DIAG_ON(x)
+#endif
+
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 8 /* For minor interface/format changes */
@@ -148,8 +167,10 @@ typedef long long ssize_t;
* type.
*/
#if H5_SIZEOF_LONG_LONG >= 8
+H5_GCC_DIAG_OFF(long-long)
typedef unsigned long long hsize_t;
typedef signed long long hssize_t;
+H5_GCC_DIAG_ON(long-long)
# define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG
# define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG
#else