summaryrefslogtreecommitdiffstats
path: root/src/H5private.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2013-09-05 20:44:14 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2013-09-05 20:44:14 (GMT)
commit5b876c929f79003c85585570827452f5d8052d01 (patch)
tree89a1fa7bb8221a8679f180868467464e331c18ce /src/H5private.h
parenta1fe10691cf7ce1737aa420191efb996f7fe5657 (diff)
downloadhdf5-5b876c929f79003c85585570827452f5d8052d01.zip
hdf5-5b876c929f79003c85585570827452f5d8052d01.tar.gz
hdf5-5b876c929f79003c85585570827452f5d8052d01.tar.bz2
[svn-r24101] Description:
Clean up warnings, enable new compiler warning flag(s) and bring back changes from Coverity branch: r20813: Remove the dead code as listed for coverity bug #1722. h5committested. r20814: Issue 69: Check return value and throw error if negative return. Also free datatype id on error r20815: Use HDstrncpy. --gh r20816: Replaced one last HDstrcat call with HDstrncat to resolve coverity issue 832. r20817: Use HDstrncpy and HDstrncat. --gh r20818: Purpose: Fix valgrind issues with h5jam Description: Modified h5jam to free strings strdup'd in parse_command_line before exit. Note that they may still not be freed in case of error, due to the widespread use of exit(). r20819: Issue 80: change loop to use int as loop index. r20820: Maintenance: Fixed the bug found by coverity CID 788 There were two problems with this function: 1) it tried to unnecessary free NULL pointer 2) it tried to allocate c_name buffer that is done by H5Pget_class_name Tested on: Mac OSX 10.8.4 (amazon) w/gcc 4.8.1, C++ & FORTRAN (too minor to require h5committest)
Diffstat (limited to 'src/H5private.h')
-rw-r--r--src/H5private.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/H5private.h b/src/H5private.h
index 2701c63..c376789 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -2354,6 +2354,30 @@ func_init_failed: \
#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 in gcc 4.2+ */
+#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
+ #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)
+ /* These pragmas are only implemented in gcc 4.6+ */
+ #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
+ #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) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x))
+ #define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning GCC_DIAG_JOINSTR(-W,x))
+ #endif
+#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);