diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-06-13 04:55:44 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-06-13 04:55:44 (GMT) |
commit | 970fcd54e0693dafa78f567639a99cf059fa1425 (patch) | |
tree | e9edcd76f9840357d95663630431727f4e8873b3 | |
parent | c7ad57374b5a3633e32a6675a8ca8345d626aaba (diff) | |
download | hdf5-970fcd54e0693dafa78f567639a99cf059fa1425.zip hdf5-970fcd54e0693dafa78f567639a99cf059fa1425.tar.gz hdf5-970fcd54e0693dafa78f567639a99cf059fa1425.tar.bz2 |
[svn-r15212] Description:
Bring back revision 15211 from trunk:
Update the gcc flags for version 4.3
Clean up warnings
Tested on:
Mac OS X/32 10.5.3 (amazon)
-rw-r--r-- | config/gnu-flags | 81 | ||||
-rw-r--r-- | src/H5.c | 14 | ||||
-rw-r--r-- | src/H5A.c | 15 | ||||
-rw-r--r-- | src/H5AC.c | 8 | ||||
-rw-r--r-- | src/H5ACpkg.h | 9 | ||||
-rw-r--r-- | src/H5Adense.c | 9 | ||||
-rw-r--r-- | src/H5Aint.c | 13 | ||||
-rw-r--r-- | src/H5B2.c | 4 | ||||
-rw-r--r-- | src/H5B2cache.c | 10 | ||||
-rw-r--r-- | src/H5Fprivate.h | 2 | ||||
-rw-r--r-- | src/H5Vprivate.h | 10 | ||||
-rw-r--r-- | src/H5checksum.c | 10 | ||||
-rw-r--r-- | src/H5system.c | 8 | ||||
-rw-r--r-- | src/H5trace.c | 44 |
14 files changed, 174 insertions, 63 deletions
diff --git a/config/gnu-flags b/config/gnu-flags index 401bafe..bb8d27c 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -138,7 +138,7 @@ case "$cc_vendor-$cc_version" in esac # General - H5_CFLAGS="$H5_CFLAGS $arch -ansi -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline" + H5_CFLAGS="$H5_CFLAGS $arch -ansi -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline" # Production case "$cc_vendor-$cc_version" in @@ -187,7 +187,7 @@ case "$cc_vendor-$cc_version" in # Closer to the gcc 4.4 release, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK - gcc-4.[123]*) + gcc-4.[3]*) # Replace -ansi flag with -std=c99 flag H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-ansi/-std=c99/g'`" @@ -202,13 +202,13 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute" # Append warning flags from gcc-3.2* case - H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization -Wmultichar" + H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - # Enable mort format checking flags, beyond the basic -Wformat included + # Enable more format checking flags, beyond the basic -Wformat included # in -Wall - H5_CFLAGS="$H5_CFLAGS -Wformat-nonliteral -Wformat-security -Wformat-y2k" + H5_CFLAGS="$H5_CFLAGS -Wformat=2" - # The "unreachable code" warning does not appear to be reliable yet... + # The "unreachable code" warning appears to be reliable now... H5_CFLAGS="$H5_CFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case @@ -221,10 +221,61 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" # Append more extra warning flags that only gcc4.0+ know about - H5_CFLAGS="$H5_CFLAGS -Wmissing-field-initializers -Wvariadic-macros" + H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat -Wstrict-overflow -Wvolatile-register-var" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wvla" + + # Try out the new "stack protector" feature in gcc 4.1 + # (Strictly speaking this isn't really a "warning" flag, so it's added to + # the debugging flags) + #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" + ;; + + gcc-4.[12]*) + # Replace -ansi flag with -std=c99 flag + H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-ansi/-std=c99/g'`" + + # Disable warnings about using 'long long' type + H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CFLAGS="$H5_CFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + H5_CFLAGS="$H5_CFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CFLAGS="$H5_CFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch" - # Append more extra warning flags that only gcc4.1+ know about - H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat -Wvolatile-register-var" + # Replace old -W flag with new -Wextra flag + H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat -Wstrict-overflow -Wvolatile-register-var" # Try out the new "stack protector" feature in gcc 4.1 # (Strictly speaking this isn't really a "warning" flag, so it's added to @@ -247,7 +298,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute" # Append warning flags from gcc-3.2* case - H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization -Wmultichar" + H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" # The "format=2" warning generates too many warnings about valid # usage in the library. @@ -265,8 +316,8 @@ case "$cc_vendor-$cc_version" in # Replace old -W flag with new -Wextra flag H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - # Append more extra warning flags that only gcc4.0+ know about - H5_CFLAGS="$H5_CFLAGS -Wmissing-field-initializers -Wvariadic-macros" + # Append more extra warning flags that only gcc 4.0+ know about + H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" ;; gcc-3.4*) @@ -284,7 +335,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute" # Append warning flags from gcc-3.2* case - H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization -Wmultichar" + H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" # The "format=2" warning generates too many warnings about valid # usage in the library. @@ -318,7 +369,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute" # Append warning flags from gcc-3.2* case - H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization -Wmultichar" + H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" # The "format=2" warning generates too many warnings about valid # usage in the library. @@ -346,7 +397,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute" # Append more extra warning flags that only gcc3.2+ know about - H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization -Wmultichar" + H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" # The "format=2" warning generates too many warnings about valid # usage in the library. @@ -206,7 +206,7 @@ void H5_term_library(void) { int pending, ntries = 0, n; - unsigned at = 0; + size_t at = 0; char loop[1024]; H5E_auto2_t func; @@ -476,7 +476,7 @@ H5_debug_mask(const char *s) FILE *stream = stderr; char pkg_name[32], *rest; size_t i; - int clear; + hbool_t clear; while (s && *s) { if (HDisalpha(*s) || '-'==*s || '+'==*s) { @@ -499,20 +499,20 @@ H5_debug_mask(const char *s) /* Trace, all, or one? */ if (!HDstrcmp(pkg_name, "trace")) { - H5_debug_g.trace = clear?NULL:stream; + H5_debug_g.trace = clear ? NULL : stream; } else if (!HDstrcmp(pkg_name, "ttop")) { H5_debug_g.trace = stream; - H5_debug_g.ttop = !clear; + H5_debug_g.ttop = (hbool_t)!clear; } else if (!HDstrcmp(pkg_name, "ttimes")) { H5_debug_g.trace = stream; - H5_debug_g.ttimes = !clear; + H5_debug_g.ttimes = (hbool_t)!clear; } else if (!HDstrcmp(pkg_name, "all")) { for (i=0; i<(size_t)H5_NPKGS; i++) - H5_debug_g.pkg[i].stream = clear?NULL:stream; + H5_debug_g.pkg[i].stream = clear ? NULL : stream; } else { for (i=0; i<(size_t)H5_NPKGS; i++) { if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) { - H5_debug_g.pkg[i].stream = clear?NULL:stream; + H5_debug_g.pkg[i].stream = clear ? NULL : stream; break; } } @@ -360,9 +360,11 @@ hid_t H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id) { - H5A_t *attr = NULL; - htri_t tri_ret; /* htri_t return value */ - hid_t ret_value; /* Return value */ + H5A_t *attr = NULL; + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute */ + htri_t tri_ret; /* htri_t return value */ + hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5A_create) @@ -463,9 +465,14 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, attr->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_DTYPE_ID, FALSE, attr->dt); attr->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SDSPACE_ID, FALSE, attr->ds); + /* Get # of elements for attribute's dataspace */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->ds)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + H5_ASSIGN_OVERFLOW(nelmts, snelmts, hssize_t, size_t); + HDassert(attr->dt_size > 0); HDassert(attr->ds_size > 0); - H5_ASSIGN_OVERFLOW(attr->data_size, H5S_GET_EXTENT_NPOINTS(attr->ds) * H5T_get_size(attr->dt), hssize_t, size_t); + attr->data_size = nelmts * H5T_get_size(attr->dt); /* Hold the symbol table entry (and file) open */ if(H5O_open(&(attr->oloc)) < 0) @@ -43,8 +43,8 @@ *------------------------------------------------------------------------- */ -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ #define H5AC_PACKAGE /*suppress error about including H5ACpkg */ +#define H5C_PACKAGE /*suppress error about including H5Cpkg */ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ /* Interface initialization */ @@ -2319,7 +2319,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, } #endif /* H5AC__TRACE_FILE_ENABLED */ - dirtied = ( ( (flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG ) || + dirtied = (hbool_t)( ( (flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG ) || ( ((H5AC_info_t *)thing)->dirtied ) ); if ( dirtied ) { @@ -3064,7 +3064,7 @@ H5AC_validate_config(H5AC_cache_config_t * config_ptr) { herr_t result; herr_t ret_value = SUCCEED; /* Return value */ - int name_len; + size_t name_len; H5C_auto_size_ctl_t internal_config; FUNC_ENTER_NOAPI(H5AC_validate_config, FAIL) @@ -3109,7 +3109,7 @@ H5AC_validate_config(H5AC_cache_config_t * config_ptr) */ name_len = HDstrlen(config_ptr->trace_file_name); - if ( name_len <= 0 ) { + if ( name_len == 0 ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ "config_ptr->trace_file_name is empty.") diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index 973f988..5f226ed 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -34,14 +34,12 @@ #ifndef _H5ACpkg_H #define _H5ACpkg_H -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ - /* Get package's private header */ -#include "H5Cprivate.h" +#include "H5ACprivate.h" /* Get needed headers */ -#include "H5Cpkg.h" /* Cache */ +#include "H5Cprivate.h" /* Cache */ #include "H5SLprivate.h" /* Skip lists */ @@ -323,4 +321,5 @@ typedef struct H5AC_aux_t #endif /* H5_HAVE_PARALLEL */ -#endif /* _H5Cpkg_H */ +#endif /* _H5ACpkg_H */ + diff --git a/src/H5Adense.c b/src/H5Adense.c index de6bc8c..45537be 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -504,7 +504,7 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr) udata.common.shared_fheap = shared_fheap; udata.common.name = attr->name; udata.common.name_hash = H5_checksum_lookup3(attr->name, HDstrlen(attr->name), 0); - udata.common.flags = mesg_flags; + H5_ASSIGN_OVERFLOW(udata.common.flags, mesg_flags, unsigned, uint8_t); udata.common.corder = attr->crt_idx; udata.common.found_op = NULL; udata.common.found_op_data = NULL; @@ -1034,6 +1034,13 @@ H5A_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) case H5A_ATTR_OP_LIB: /* Call the library's callback */ ret_value = (bt2_udata->attr_op->u.lib_op)(fh_udata.attr, bt2_udata->op_data); + break; + + default: + HDassert("unknown attribute op type" && 0); +#ifdef NDEBUG + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unsupported attribute op type") +#endif /* NDEBUG */ } /* end switch */ /* Release the space allocated for the attribute */ diff --git a/src/H5Aint.c b/src/H5Aint.c index c08c6cf..71b6689 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -197,8 +197,8 @@ H5A_compact_build_table(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_index_t idx_type, udata.dxpl_id = dxpl_id; udata.atable = atable; udata.curr_attr = 0; - udata.bogus_crt_idx = (oh->version == H5O_VERSION_1 || - !(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) ? TRUE : FALSE; + udata.bogus_crt_idx = (hbool_t)((oh->version == H5O_VERSION_1 || + !(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) ? TRUE : FALSE); /* Iterate over existing attributes, checking for attribute with same name */ op.op_type = H5O_MESG_OP_LIB; @@ -564,6 +564,13 @@ H5A_attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, case H5A_ATTR_OP_LIB: /* Call the library's callback */ ret_value = (attr_op->u.lib_op)(&(atable->attrs[u]), op_data); + break; + + default: + HDassert("unknown attribute op type" && 0); +#ifdef NDEBUG + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unsupported attribute op type") +#endif /* NDEBUG */ } /* end switch */ /* Increment the number of entries passed through */ @@ -649,7 +656,7 @@ H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo) HDassert(oh); /* Retrieve the "attribute info" structure */ - if((ret_value = H5O_msg_read_real(f, dxpl_id, oh, H5O_AINFO_ID, ainfo))) { + if((ret_value = (H5O_ainfo_t *)H5O_msg_read_real(f, dxpl_id, oh, H5O_AINFO_ID, ainfo))) { /* Check if we don't know how many attributes there are */ if(ret_value->nattrs == HSIZET_MAX) { /* Check if we are using "dense" attribute storage */ @@ -1222,7 +1222,7 @@ H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t add HDassert(btree_size); /* Look up the B-tree header */ - if(NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ))) + if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header") /* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */ @@ -1231,7 +1231,7 @@ H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t add incr_rc = TRUE; /* Get the pointer to the shared B-tree info */ - shared = H5RC_GET_OBJ(bt2->shared); + shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared); HDassert(shared); /* Add size of header to B-tree metadata total */ diff --git a/src/H5B2cache.c b/src/H5B2cache.c index d8679aa..686bea6 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -177,7 +177,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo size = H5B2_HEADER_SIZE(f); /* Get a pointer to a buffer that's large enough for header */ - if(NULL == (hdr = H5WB_actual(wb, size))) + if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "can't get actual buffer") /* Read header from disk */ @@ -300,7 +300,7 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B size = H5B2_HEADER_SIZE(f); /* Get a pointer to a buffer that's large enough for header */ - if(NULL == (hdr = H5WB_actual(wb, size))) + if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Get temporary pointer to serialized header */ @@ -326,8 +326,10 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B UINT16ENCODE(p, shared->depth); /* Split & merge %s */ - *p++ = shared->split_percent; - *p++ = shared->merge_percent; + H5_CHECK_OVERFLOW(shared->split_percent, /* From: */ unsigned, /* To: */ uint8_t); + *p++ = (uint8_t)shared->split_percent; + H5_CHECK_OVERFLOW(shared->merge_percent, /* From: */ unsigned, /* To: */ uint8_t); + *p++ = (uint8_t)shared->merge_percent; /* Root node pointer */ H5F_addr_encode(f, &p, bt2->root.addr); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 27b45f2..432cf12 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -309,12 +309,14 @@ typedef struct H5F_t H5F_t; case 4: UINT32ENCODE(p,l); break; \ case 8: UINT64ENCODE(p,l); break; \ case 2: UINT16ENCODE(p,l); break; \ + default: HDassert("bad sizeof size" && 0); \ } #define H5F_DECODE_LENGTH(f,p,l) switch(H5F_SIZEOF_SIZE(f)) { \ case 4: UINT32DECODE(p,l); break; \ case 8: UINT64DECODE(p,l); break; \ case 2: UINT16DECODE(p,l); break; \ + default: HDassert("bad sizeof size" && 0); \ } /* diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index e562880..2390584 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -302,7 +302,7 @@ H5V_vector_inc(int n, hsize_t *v1, const hsize_t *v2) } /* Lookup table for general log2(n) routine */ -static const char LogTable256[] = +static const unsigned char LogTable256[] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, @@ -356,15 +356,15 @@ H5V_log2_gen(uint64_t n) #endif /* H5_BAD_LOG2_CODE_GENERATED */ if((ttt = (unsigned)(n >> 32))) if((tt = (unsigned)(n >> 48))) - r = (t = (unsigned)(n >> 56)) ? 56 + LogTable256[t] : 48 + LogTable256[tt & 0xFF]; + r = (t = (unsigned)(n >> 56)) ? 56 + (unsigned)LogTable256[t] : 48 + (unsigned)LogTable256[tt & 0xFF]; else - r = (t = (unsigned)(n >> 40)) ? 40 + LogTable256[t] : 32 + LogTable256[ttt & 0xFF]; + r = (t = (unsigned)(n >> 40)) ? 40 + (unsigned)LogTable256[t] : 32 + (unsigned)LogTable256[ttt & 0xFF]; else if((tt = (unsigned)(n >> 16))) - r = (t = (unsigned)(n >> 24)) ? 24 + LogTable256[t] : 16 + LogTable256[tt & 0xFF]; + r = (t = (unsigned)(n >> 24)) ? 24 + (unsigned)LogTable256[t] : 16 + (unsigned)LogTable256[tt & 0xFF]; else /* Added 'uint8_t' cast to pacify PGCC compiler */ - r = (t = (unsigned)(n >> 8)) ? 8 + LogTable256[t] : LogTable256[(uint8_t)n]; + r = (t = (unsigned)(n >> 8)) ? 8 + (unsigned)LogTable256[t] : (unsigned)LogTable256[(uint8_t)n]; #ifdef H5_BAD_LOG2_CODE_GENERATED } /* end else */ #endif /* H5_BAD_LOG2_CODE_GENERATED */ diff --git a/src/H5checksum.c b/src/H5checksum.c index e42f152..3359722 100644 --- a/src/H5checksum.c +++ b/src/H5checksum.c @@ -126,10 +126,10 @@ H5_checksum_fletcher32(const void *_data, size_t _len) * performed without numeric overflow) */ while (len) { - unsigned tlen = len > 360 ? 360 : len; + size_t tlen = len > 360 ? 360 : len; len -= tlen; do { - sum1 += (((uint16_t)data[0]) << 8) | ((uint16_t)data[1]); + sum1 += (uint32_t)(((uint16_t)data[0]) << 8) | ((uint16_t)data[1]); data += 2; sum2 += sum1; } while (--tlen); @@ -139,7 +139,7 @@ H5_checksum_fletcher32(const void *_data, size_t _len) /* Check for odd # of bytes */ if(_len % 2) { - sum1 += ((uint16_t)*data) << 8; + sum1 += (uint32_t)(((uint16_t)*data) << 8); sum2 += sum1; sum1 = (sum1 & 0xffff) + (sum1 >> 16); sum2 = (sum2 & 0xffff) + (sum2 >> 16); @@ -486,8 +486,8 @@ H5_hash_string(const char *str) /* Sanity check */ HDassert(str); - while(c = *str++) - hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + while((c = *str++)) + hash = ((hash << 5) + hash) + (uint32_t)c; /* hash * 33 + c */ FUNC_LEAVE_NOAPI(hash) } /* end H5_hash_string() */ diff --git a/src/H5system.c b/src/H5system.c index 4a49d71..6a8a91a 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -497,7 +497,7 @@ HDstrtoll(const char *s, const char **rest, int base) if (sign>0) { acc = ((uint64_t)1<<(8*sizeof(int64_t)-1))-1; } else { - acc = (uint64_t)1<<(8*sizeof(int64_t)-1); + acc = (int64_t)((uint64_t)1<<(8*sizeof(int64_t)-1)); } errno = ERANGE; } @@ -622,9 +622,9 @@ H5_build_extpath(const char *name, char **extpath/*out*/) if ((full_path=H5MM_strdup(name)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } else { /* relative pathname */ - if ((cwdpath=H5MM_malloc(MAX_PATH_LEN)) == NULL) + if (NULL == (cwdpath = (char *)H5MM_malloc(MAX_PATH_LEN))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - if ((new_name=H5MM_strdup(name)) == NULL) + if (NULL == (new_name = (char *)H5MM_strdup(name))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* @@ -652,7 +652,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/) cwdlen = HDstrlen(cwdpath); HDassert(cwdlen); path_len = cwdlen + HDstrlen(new_name) + 2; - if ((full_path=H5MM_malloc(path_len)) == NULL) + if (NULL == (full_path = (char *)H5MM_malloc(path_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") HDstrcpy(full_path, cwdpath); diff --git a/src/H5trace.c b/src/H5trace.c index 926a590..4a42f0b 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -319,6 +319,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5D_ALLOC_TIME_INCR: fprintf (out, "H5D_ALLOC_TIME_INCR"); break; + default: + fprintf (out, "%ld", (long)alloc_time); + break; } } break; @@ -368,6 +371,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5D_FILL_TIME_IFSET: fprintf (out, "H5D_FILL_TIME_IFSET"); break; + default: + fprintf (out, "%ld", (long)fill_time); + break; } } break; @@ -394,6 +400,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5D_FILL_VALUE_USER_DEFINED: fprintf (out, "H5D_FILL_VALUE_USER_DEFINED"); break; + default: + fprintf (out, "%ld", (long)fill_value); + break; } } break; @@ -619,6 +628,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5F_CLOSE_STRONG: fprintf(out, "H5F_CLOSE_STRONG"); break; + default: + fprintf(out, "%ld", (long)degree); + break; } } break; @@ -643,6 +655,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "H5F_SCOPE_DOWN " "/*FOR INTERNAL USE ONLY!*/"); break; + default: + fprintf(out, "%ld", (long)scope); + break; } } break; @@ -663,6 +678,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5F_LIBVER_LATEST: fprintf(out, "H5F_LIBVER_LATEST"); break; + default: + fprintf(out, "%ld", (long)libver_vers); + break; } } break; @@ -928,7 +946,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) /* Save the rank of simple data spaces for arrays */ /* This may generate recursive call to the library... -QAK */ { - H5S_t *space = H5I_object(obj); + H5S_t *space = (H5S_t *)H5I_object(obj); if (H5S_SIMPLE==H5S_GET_EXTENT_TYPE(space)) { asize[argno] = H5S_GET_EXTENT_NDIMS(space); } @@ -997,6 +1015,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5_INDEX_N: fprintf(out, "H5_INDEX_N"); break; + default: + fprintf(out, "%ld", (long)idx_type); + break; } /* end switch */ } /* end else */ break; @@ -1026,6 +1047,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5_ITER_N: fprintf(out, "H5_ITER_N"); break; + default: + fprintf(out, "%ld", (long)order); + break; } /* end switch */ } /* end else */ break; @@ -1169,6 +1193,12 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5L_TYPE_SOFT: fprintf(out, "H5L_TYPE_SOFT"); break; + case H5L_TYPE_EXTERNAL: + fprintf(out, "H5L_TYPE_EXTERNAL"); + break; + case H5L_TYPE_MAX: + fprintf(out, "H5L_TYPE_MAX"); + break; default: fprintf(out, "%ld", (long)link_type); break; @@ -1286,6 +1316,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) else { H5O_type_t objtype = va_arg(ap, H5O_type_t); /*lint !e64 Type mismatch not really occuring */ switch(objtype) { + case H5O_TYPE_UNKNOWN: + fprintf(out, "H5O_TYPE_UNKNOWN"); + break; case H5O_TYPE_GROUP: fprintf(out, "H5O_TYPE_GROUP"); break; @@ -1295,6 +1328,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5O_TYPE_NAMED_DATATYPE: fprintf(out, "H5O_TYPE_NAMED_DATATYPE"); break; + case H5O_TYPE_NTYPES: + fprintf(out, "H5O_TYPE_TYPES"); + break; default: fprintf(out, "BADTYPE(%ld)", (long)objtype); break; @@ -1317,13 +1353,13 @@ H5_trace (const double *returning, const char *func, const char *type, ...) } } else { hid_t pclass_id = va_arg (ap, hid_t); - char *class_name=NULL; + char *class_name = NULL; H5P_genclass_t *pclass; /* Get the class name and print it */ /* This may generate recursive call to the library... -QAK */ - if(NULL != (pclass = H5I_object(pclass_id)) && - (class_name=H5P_get_class_name(pclass))!=NULL) { + if(NULL != (pclass = (H5P_genclass_t *)H5I_object(pclass_id)) && + (class_name = H5P_get_class_name(pclass))!=NULL) { fprintf (out, class_name); H5MM_xfree(class_name); } /* end if */ |