diff options
author | David Young <dyoung@hdfgroup.org> | 2019-11-27 19:58:43 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-07-07 15:49:55 (GMT) |
commit | 307cb5da4863b3d29fc5d1b97bc01034fc5161dd (patch) | |
tree | 96b5af3113c27f46fc24a929ac074dda752b5283 /tools/src/h5stat | |
parent | d52b27ad1d8142945a92310b79ab79171e76a3c3 (diff) | |
download | hdf5-307cb5da4863b3d29fc5d1b97bc01034fc5161dd.zip hdf5-307cb5da4863b3d29fc5d1b97bc01034fc5161dd.tar.gz hdf5-307cb5da4863b3d29fc5d1b97bc01034fc5161dd.tar.bz2 |
Squash my changes on branch `fprintf-experiment` into one commit for
reapplication to my new warnings branch, `warnings-again`. These
changes are included:
commit 915551b7bf64e777dd2007386ec77b1d117770da
Merge: 63858c2 a8892bb
Author: David Young <dyoung@hdfgroup.org>
Date: Mon Nov 25 17:39:49 2019 -0600
Merge remote-tracking branch 'hdf5/develop' into fprintf-experiment
commit a8892bb42d6f6e4fbc30fae0eb2b957f81c938b9
Merge: 5c911d8 f907b51
Author: David Young <dyoung@hdfgroup.org>
Date: Mon Nov 25 17:33:54 2019 -0600
Merge pull request #2055 in HDFFV/hdf5 from ~DYOUNG/vchoi_fork:add-werror-and-squash-some to develop
* commit 'f907b511d06612dafc7814a7c30f2f3d2b76d52b':
Oops, remove more C99 designated initializers for VS 2010 compatibility.
commit 63858c22e168acaec0af8ced6641f26102cc6bb0
Merge: 20ae787 5c911d8
Author: David Young <dyoung@hdfgroup.org>
Date: Mon Nov 25 17:04:42 2019 -0600
Merge remote-tracking branch 'hdf5/develop' into fprintf-experiment
commit 5c911d8baf3ee7fe654269088eebdf07f59a8192
Merge: b8a5671 62208b0
Author: David Young <dyoung@hdfgroup.org>
Date: Mon Nov 25 16:58:27 2019 -0600
Merge pull request #2030 in HDFFV/hdf5 from ~DYOUNG/vchoi_fork:add-werror-and-squash-some to develop
* commit '62208b056a09c01855fbac7f75146be58ad6bfe5': (44 commits)
Add an #include to get a function declaration.
Don't use C99 designated initializers, they're not compatible with Visual Studio 2010.
Quiet some more maybe-uninitialized warnings---each is a false positive, *sigh*. This is more code that may not compile with VS2010, *sigh sigh*.
Always warn on maybe-uninitialized. -Wincompatible-pointer-types was not available until GCC 5, so enable it only if that's the GCC version we're using.
Only promote maybe-uninitialized warnings to errors on GCC 8. Even on GCC 8, there may be false positives at low optimization levels? I need to check.
Only use -Werror=cast-function-type with GCC 8 and later.
Put all of the -W options back into the order I found them in so that it's easier to compare old and new config/gnu-flags.
Add new source files to CMakeLists.txt.
Mention the -Werror= flags in libhdf5.settings.in.
free -> HDfree
Promote decleration-after-statement warnings to errors.
Quiet decleration-after-statement warnings.
Move a statement under some declarations since some vintages of Visual Studio don't like declarations after statements.
Document H5D__chunk_mem_xfree_wrapper().
Undo accidental test deletion.
Oops, delete a debug printf that snuck in here.
Undo my changes to the HD macros, hadn't really intended those to be on this branch....
Make errors of some more warnings. Move disabled warnings to DEVELOPER_WARNING_CFLAGS. Put just one warning option on a line, and sort some of the options.
Cast to the parameter type, H5VL_token_t *, instead of to unsigned char *.
Change hdset_reg_ref_t and H5R_ref_t from arrays of unsigned char to structs containing those arrays. Encapsulating the arrays in this way makes it easier to write and think about pointers to these types, casts to/from these types, etc.
...
commit 20ae7877e33931b95e8c3502b027d6c3fe94a11f
Merge: 46f8c61 edd5297
Author: David Young <dyoung@hdfgroup.org>
Date: Fri Nov 22 15:34:09 2019 -0600
Merge remote-tracking branch 'origin/add-werror-and-squash-some' into fprintf-experiment
commit 46f8c613d5117a8be5bc8385a072daa0b4262f06
Author: David Young <dyoung@hdfgroup.org>
Date: Fri Nov 22 15:29:00 2019 -0600
GCC really wants us to use `ll` to format `long long`, so try to make that work
before any other format modifier. Seems like we're not compiling the autoconf
test program with -Werror=format ? Probably should.
commit eee35b8ef3759c391327cd48a9b3c56b6f8abc99
Author: David Young <dyoung@hdfgroup.org>
Date: Fri Nov 22 15:28:05 2019 -0600
It's hard to know just how wide an HDoff_t will be, and I don't think POSIX or
C standards provide a PRI macro for it, so cast to intmax_t and format using
PRIdMAX.
commit 86eab12df7a89b546a38e99f8178dd2adbcb3433
Author: David Young <dyoung@hdfgroup.org>
Date: Fri Nov 22 15:26:25 2019 -0600
URemove some casts.se the right format string for the argument. Here and there
stop casting a printf argument.
commit f722f7cbecbaa99449941484b014426f62f1bed5
Merge: 58e3743 6d5ec83
Author: David Young <dyoung@hdfgroup.org>
Date: Fri Nov 22 14:44:16 2019 -0600
Merge branch 'add-werror-and-squash-some' into fprintf-experiment
commit 58e3743b7faa9836606ee91798fe80dfc0040da7
Author: David Young <dyoung@hdfgroup.org>
Date: Wed Nov 20 21:07:21 2019 -0600
Remove custom HDfprintf implementation, using the standard library's,
instead. Take a swipe at repairing fprintf format strings, mainly
replacing "%Hu" with "%" PRIuHSIZE, "%a" with "%" PRIuHADDR, "%Zu" with
"%zu".
Here and there remove an awkward cast of a printf argument to `long
long` and use PRI[doux]8, PRI[doux]32, or PRI[doux]64, instead.
Change occurrences of "%t" to "%s" and perform a suitable change of
argument, `cond` -> `cond ? "TRUE" : "FALSE"`.
Some occurrences of %Hu, %a, and %t remain, they just weren't flagged by
the compiler because of #ifdef'age.
commit d4366909293fa970c23512ac80e5d865d76cddbf
Author: David Young <dyoung@hdfgroup.org>
Date: Wed Nov 20 20:54:32 2019 -0600
Promote format-string warnigns to errors.
Diffstat (limited to 'tools/src/h5stat')
-rw-r--r-- | tools/src/h5stat/h5stat.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index fb3d50d7..f94ab65 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -1208,7 +1208,7 @@ print_file_info(const iter_t *iter) HDprintf("\t# of unique links: %lu\n", iter->uniq_links); HDprintf("\t# of unique other: %lu\n", iter->uniq_others); HDprintf("\tMax. # of links to object: %lu\n", iter->max_links); - HDfprintf(stdout, "\tMax. # of objects in group: %Hu\n", iter->max_fanout); + HDfprintf(stdout, "\tMax. # of objects in group: %" PRIuHSIZE "\n", iter->max_fanout); return 0; } /* print_file_info() */ @@ -1232,40 +1232,40 @@ static herr_t print_file_metadata(const iter_t *iter) { HDfprintf(stdout, "File space information for file metadata (in bytes):\n"); - HDfprintf(stdout, "\tSuperblock: %Hu\n", iter->super_size); - HDfprintf(stdout, "\tSuperblock extension: %Hu\n", iter->super_ext_size); - HDfprintf(stdout, "\tUser block: %Hu\n", iter->ublk_size); + HDfprintf(stdout, "\tSuperblock: %" PRIuHSIZE "\n", iter->super_size); + HDfprintf(stdout, "\tSuperblock extension: %" PRIuHSIZE "\n", iter->super_ext_size); + HDfprintf(stdout, "\tUser block: %" PRIuHSIZE "\n", iter->ublk_size); HDfprintf(stdout, "\tObject headers: (total/unused)\n"); - HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size, + HDfprintf(stdout, "\t\tGroups: %" PRIuHSIZE "/%" PRIuHSIZE "\n", iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size); - HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n", + HDfprintf(stdout, "\t\tDatasets(exclude compact data): %" PRIuHSIZE "/%" PRIuHSIZE "\n", iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); - HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n", iter->dtype_ohdr_info.total_size, + HDfprintf(stdout, "\t\tDatatypes: %" PRIuHSIZE "/%" PRIuHSIZE "\n", iter->dtype_ohdr_info.total_size, iter->dtype_ohdr_info.free_size); HDfprintf(stdout, "\tGroups:\n"); - HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->groups_btree_storage_size); - HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->groups_heap_storage_size); + HDfprintf(stdout, "\t\tB-tree/List: %" PRIuHSIZE "\n", iter->groups_btree_storage_size); + HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->groups_heap_storage_size); HDfprintf(stdout, "\tAttributes:\n"); - HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->attrs_btree_storage_size); - HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->attrs_heap_storage_size); + HDfprintf(stdout, "\t\tB-tree/List: %" PRIuHSIZE "\n", iter->attrs_btree_storage_size); + HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->attrs_heap_storage_size); HDfprintf(stdout, "\tChunked datasets:\n"); - HDfprintf(stdout, "\t\tIndex: %Hu\n", iter->datasets_index_storage_size); + HDfprintf(stdout, "\t\tIndex: %" PRIuHSIZE "\n", iter->datasets_index_storage_size); HDfprintf(stdout, "\tDatasets:\n"); - HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->datasets_heap_storage_size); + HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->datasets_heap_storage_size); HDfprintf(stdout, "\tShared Messages:\n"); - HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->SM_hdr_storage_size); - HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->SM_index_storage_size); - HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->SM_heap_storage_size); + HDfprintf(stdout, "\t\tHeader: %" PRIuHSIZE "\n", iter->SM_hdr_storage_size); + HDfprintf(stdout, "\t\tB-tree/List: %" PRIuHSIZE "\n", iter->SM_index_storage_size); + HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->SM_heap_storage_size); HDfprintf(stdout, "\tFree-space managers:\n"); - HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->free_hdr); - HDfprintf(stdout, "\t\tAmount of free space: %Hu\n", iter->free_space); + HDfprintf(stdout, "\t\tHeader: %" PRIuHSIZE "\n", iter->free_hdr); + HDfprintf(stdout, "\t\tAmount of free space: %" PRIuHSIZE "\n", iter->free_space); return 0; } /* print_file_metadata() */ @@ -1345,11 +1345,11 @@ print_group_metadata(const iter_t *iter) { HDprintf("File space information for groups' metadata (in bytes):\n"); - HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", + HDfprintf(stdout, "\tObject headers (total/unused): %" PRIuHSIZE "/%" PRIuHSIZE "\n", iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size); - HDfprintf(stdout, "\tB-tree/List: %Hu\n", iter->groups_btree_storage_size); - HDfprintf(stdout, "\tHeap: %Hu\n", iter->groups_heap_storage_size); + HDfprintf(stdout, "\tB-tree/List: %" PRIuHSIZE "\n", iter->groups_btree_storage_size); + HDfprintf(stdout, "\tHeap: %" PRIuHSIZE "\n", iter->groups_heap_storage_size); return 0; } /* print_group_metadata() */ @@ -1384,7 +1384,7 @@ print_dataset_info(const iter_t *iter) HDprintf("\t\t# of dataset with rank %u: %lu\n", u, iter->dset_rank_count[u]); HDprintf("1-D Dataset information:\n"); - HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %Hu\n", iter->max_dset_dims); + HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %" PRIuHSIZE "\n", iter->max_dset_dims); HDprintf("\tSmall 1-D datasets (with dimension sizes 0 to %u):\n", sdsets_threshold - 1); total = 0; for(u = 0; u < (unsigned)sdsets_threshold; u++) { @@ -1417,8 +1417,8 @@ print_dataset_info(const iter_t *iter) } /* end if */ HDprintf("Dataset storage information:\n"); - HDfprintf(stdout, "\tTotal raw data size: %Hu\n", iter->dset_storage_size); - HDfprintf(stdout, "\tTotal external raw data size: %Hu\n", iter->dset_external_storage_size); + HDfprintf(stdout, "\tTotal raw data size: %" PRIuHSIZE "\n", iter->dset_storage_size); + HDfprintf(stdout, "\tTotal external raw data size: %" PRIuHSIZE "\n", iter->dset_external_storage_size); HDprintf("Dataset layout information:\n"); for(u = 0; u < H5D_NLAYOUTS; u++) @@ -1460,12 +1460,12 @@ print_dset_metadata(const iter_t *iter) { HDprintf("File space information for datasets' metadata (in bytes):\n"); - HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", + HDfprintf(stdout, "\tObject headers (total/unused): %" PRIuHSIZE "/%" PRIuHSIZE "\n", iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); - HDfprintf(stdout, "\tIndex for Chunked datasets: %Hu\n", + HDfprintf(stdout, "\tIndex for Chunked datasets: %" PRIuHSIZE "\n", iter->datasets_index_storage_size); - HDfprintf(stdout, "\tHeap: %Hu\n", iter->datasets_heap_storage_size); + HDfprintf(stdout, "\tHeap: %" PRIuHSIZE "\n", iter->datasets_heap_storage_size); return 0; } /* print_dset_metadata() */ @@ -1582,7 +1582,7 @@ print_freespace_info(const iter_t *iter) unsigned u; /* Local index variable */ HDfprintf(stdout, "Free-space persist: %s\n", iter->fs_persist ? "TRUE" : "FALSE"); - HDfprintf(stdout, "Free-space section threshold: %Hu bytes\n", iter->fs_threshold); + HDfprintf(stdout, "Free-space section threshold: %" PRIuHSIZE " bytes\n", iter->fs_threshold); HDprintf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS); total = 0; for(u = 0; u < SIZE_SMALL_SECTS; u++) { @@ -1632,7 +1632,7 @@ print_storage_summary(const iter_t *iter) double percent = 0.0f; HDfprintf(stdout, "File space management strategy: %s\n", FS_STRATEGY_NAME[iter->fs_strategy]); - HDfprintf(stdout, "File space page size: %Hu bytes\n", iter->fsp_size); + HDfprintf(stdout, "File space page size: %" PRIuHSIZE " bytes\n", iter->fsp_size); HDprintf("Summary of file space information:\n"); total_meta = iter->super_size + iter->super_ext_size + iter->ublk_size + @@ -1650,26 +1650,26 @@ print_storage_summary(const iter_t *iter) iter->SM_heap_storage_size + iter->free_hdr; - HDfprintf(stdout, " File metadata: %Hu bytes\n", total_meta); - HDfprintf(stdout, " Raw data: %Hu bytes\n", iter->dset_storage_size); + HDfprintf(stdout, " File metadata: %" PRIuHSIZE " bytes\n", total_meta); + HDfprintf(stdout, " Raw data: %" PRIuHSIZE " bytes\n", iter->dset_storage_size); percent = ((double)iter->free_space / (double)iter->filesize) * (double)100.0f; - HDfprintf(stdout, " Amount/Percent of tracked free space: %Hu bytes/%3.1f%\n", + HDfprintf(stdout, " Amount/Percent of tracked free space: %" PRIuHSIZE " bytes/%3.1f\n", iter->free_space, percent); if(iter->filesize < (total_meta + iter->dset_storage_size + iter->free_space)) { unaccount = (total_meta + iter->dset_storage_size + iter->free_space) - iter->filesize; - HDfprintf(stdout, " ??? File has %Hu more bytes accounted for than its size! ???\n", unaccount); + HDfprintf(stdout, " ??? File has %" PRIuHSIZE " more bytes accounted for than its size! ???\n", unaccount); } else { unaccount = iter->filesize - (total_meta + iter->dset_storage_size + iter->free_space); - HDfprintf(stdout, " Unaccounted space: %Hu bytes\n", unaccount); + HDfprintf(stdout, " Unaccounted space: %" PRIuHSIZE " bytes\n", unaccount); } - HDfprintf(stdout, "Total space: %Hu bytes\n", total_meta + iter->dset_storage_size + iter->free_space + unaccount); + HDfprintf(stdout, "Total space: %" PRIuHSIZE " bytes\n", total_meta + iter->dset_storage_size + iter->free_space + unaccount); if(iter->nexternal) - HDfprintf(stdout, "External raw data: %Hu bytes\n", iter->dset_external_storage_size); + HDfprintf(stdout, "External raw data: %" PRIuHSIZE " bytes\n", iter->dset_external_storage_size); return 0; } /* print_storage_summary() */ |