Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang warnings and ASan fixes #3

Closed
wants to merge 8 commits into from
2 changes: 1 addition & 1 deletion c++/test/tvlstr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static void test_vlstring_dataset()
// Test scalar type dataset with 1 value.
dset1 = root.createDataSet("test_scalar_small", vlst, ds_space);

dynstring_ds_write = (char*)HDcalloc(1, sizeof(char));
dynstring_ds_write = (char*)HDcalloc(2, sizeof(char));
HDmemset(dynstring_ds_write, 'A', 1);

// Write data to the dataset, then read it back.
Expand Down
4 changes: 2 additions & 2 deletions config/cmake/HDF5_Process_Flex_Files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (FILE_PARSE)
# will simply ignore them, but we want to avoid those warnings.
file (READ ${FILE_PARSE}.c TEST_STREAM)
file (WRITE ${FILE_PARSE}.c "
#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2\n
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))\n
#pragma GCC diagnostic ignored \"-Wconversion\"\n
#pragma GCC diagnostic ignored \"-Wimplicit-function-declaration\"\n
#pragma GCC diagnostic ignored \"-Wlarger-than=\"\n
Expand Down Expand Up @@ -69,7 +69,7 @@ if (FILE_ANALYZE)
# will simply ignore them, but we want to avoid those warnings.
file (READ ${GEN_DIR}/${FILE_ANALYZE} TEST_STREAM)
file (WRITE ${FILE_ANALYZE} "
#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2\n
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))\n
#pragma GCC diagnostic ignored \"-Wconversion\"\n
#pragma GCC diagnostic ignored \"-Wimplicit-function-declaration\"\n
#pragma GCC diagnostic ignored \"-Wlarger-than=\"\n
Expand Down
4 changes: 2 additions & 2 deletions examples/h5_extlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ static void extlink_prefix_example(void)
* that a path was supplied in the udata.
*/
static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group,
const void *udata, size_t udata_size, hid_t lapl_id);
const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id);

static void soft_link_example(void)
{
Expand Down Expand Up @@ -277,7 +277,7 @@ static void soft_link_example(void)
*/

static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group,
const void *udata, size_t udata_size, hid_t lapl_id)
const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id)
{
const char *target = (const char *) udata;
hid_t ret_value;
Expand Down
2 changes: 1 addition & 1 deletion hl/c++/examples/ptExampleFL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int main(void)
if(err < 0)
fprintf(stderr, "Error getting packet count.");

printf("Number of packets in packet table after five appends: %d\n", count);
printf("Number of packets in packet table after five appends: %llu\n", count);

/* Initialize packet table's "current record" */
ptable.ResetIndex();
Expand Down
10 changes: 8 additions & 2 deletions hl/src/H5LTanalyze.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wlarger-than="
#endif
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wnested-externs"
#pragma GCC diagnostic ignored "-Wold-style-definition"
Expand All @@ -10,7 +12,9 @@
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wstrict-overflow"
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
#endif
#pragma GCC diagnostic ignored "-Wswitch-default"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-macros"
Expand Down Expand Up @@ -900,8 +904,10 @@ char *H5LTyytext;
#include "H5LTparse.h"

/* Turn off suggest const attribute warning in gcc */
#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
#endif
#endif

int my_yyinput(char *, int);
Expand Down
4 changes: 3 additions & 1 deletion hl/src/H5LTanalyze.l
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
#include "H5LTparse.h"

/* Turn off suggest const attribute warning in gcc */
#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
#endif
#endif

int my_yyinput(char *, int);
Expand Down
6 changes: 5 additions & 1 deletion hl/src/H5LTparse.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wlarger-than="
#endif
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wnested-externs"
#pragma GCC diagnostic ignored "-Wold-style-definition"
Expand All @@ -10,7 +12,9 @@
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wstrict-overflow"
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
#endif
#pragma GCC diagnostic ignored "-Wswitch-default"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-macros"
Expand Down
2 changes: 1 addition & 1 deletion hl/test/test_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ static int test_table(hid_t fid, int do_write)
/* write the new longitude and latitude information to all the records */
nfields = 2;
start = 0;
nrecords = NRECORDS;
nrecords = NRECORDS_ADD;
if ( H5TBwrite_fields_index(fid, "table12", nfields, field_index_pos, start, nrecords,
sizeof( position_t ), field_offset_pos, field_sizes_pos, position_in ) < 0 )
goto out;
Expand Down
1 change: 1 addition & 0 deletions src/H5Fsuper.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
/********************/
static herr_t H5F__super_ext_create(H5F_t *f, H5O_loc_t *ext_ptr);
static herr_t H5F__update_super_ext_driver_msg(H5F_t *f);
static herr_t H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo);


/*********************/
Expand Down
1 change: 1 addition & 0 deletions src/H5Odeprec.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h"
#include "H5Eprivate.h" /* Error handling */
#include "H5Opkg.h" /* Object headers */

Expand Down
1 change: 1 addition & 0 deletions src/H5Oint.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#endif /* H5O_ENABLE_BOGUS */
#include "H5Opkg.h" /* Object headers */
#include "H5SMprivate.h" /* Shared object header messages */
#include "H5CXprivate.h"


/****************/
Expand Down
1 change: 1 addition & 0 deletions src/H5Rint.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "H5Rpkg.h" /* References */
#include "H5Sprivate.h" /* Dataspaces */
#include "H5Tprivate.h" /* Datatypes */
#include "H5CXprivate.h"


/****************/
Expand Down
2 changes: 1 addition & 1 deletion test/trefer.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
hssize_t hssize_ret; /* hssize_t return value */
htri_t tri_ret; /* htri_t return value */
herr_t ret; /* Generic return value */
haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
haddr_t addr[2] = {HADDR_UNDEF, 0}; /* test for undefined reference */
hid_t dset_NA; /* Dataset id for undefined reference */
hid_t space_NA; /* Dataspace id for undefined reference */
hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
Expand Down