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

OESS-168: Remove clang warnings. #1127

Merged
merged 2 commits into from
Nov 2, 2021

Conversation

hyoklee
Copy link
Member

@hyoklee hyoklee commented Oct 21, 2021

This will remove warning: implicit conversion turns floating-point number into integer: 'float' to 'size_t' (aka 'unsigned long') [-Wfloat-conversion] warnings.

H5FD_CORE_WRITE_TRACKING_PAGE_SIZE};
static const H5FD_core_fapl_t H5FD_core_default_paged_config_g = {H5_MB, TRUE, TRUE, (size_t)4096};
static const H5FD_core_fapl_t H5FD_core_default_paged_config_g = {(size_t)H5_MB, TRUE, TRUE, (size_t)4096};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, I guess, but I would probably create a const int H5_CORE_DEFAULT_ALLOC_SIZE or something like that and make it 1024 * 1024 instead. That's more in the spirit of what's intended and doesn't torture the floating-point H5_MB into a new use.

Also, the size_t cast for 4096 is probably superfluous.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that already and it generated more warnings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compilers are weird

@lrknox
Copy link
Collaborator

lrknox commented Oct 27, 2021

clang-format check failed, identifying the changes below for lines 193 and 955. Usually it commits the changes, but this time did not. If the changes look reasonable, maybe change them manually, commit the changes and see what happens?

--- ./src/H5FDcore.c (original)
+++ ./src/H5FDcore.c (reformatted)
@@ -190,8 +190,8 @@
};

/* Default configurations, if none provided */
-static const H5FD_core_fapl_t H5FD_core_default_config_g = {(size_t)H5_MB, TRUE, H5FD_CORE_WRITE_TRACKING_FLAG,

  •                                                        H5FD_CORE_WRITE_TRACKING_PAGE_SIZE};
    

+static const H5FD_core_fapl_t H5FD_core_default_config_g = {

  • (size_t)H5_MB, TRUE, H5FD_CORE_WRITE_TRACKING_FLAG, H5FD_CORE_WRITE_TRACKING_PAGE_SIZE};
    static const H5FD_core_fapl_t H5FD_core_default_paged_config_g = {(size_t)H5_MB, TRUE, TRUE, (size_t)4096};

/* Define a free list to manage the region type */
@@ -952,8 +952,8 @@
"file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, "
"error message = '%s', file->mem = %p, total read size = %llu, bytes this "
"sub-read = %llu, bytes actually read = %llu, offset = %llu",

  •                        HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), (void *)file->mem,
    
  •                        (unsigned long long)size, (unsigned long long)bytes_in,
    
  •                        HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno),
    
  •                        (void *)file->mem, (unsigned long long)size, (unsigned long long)bytes_in,
                           (unsigned long long)bytes_read, (unsigned long long)offset);
                   } /* end if */
    

@lrknox lrknox merged commit 4aad0fe into HDFGroup:develop Nov 2, 2021
hyoklee added a commit to hyoklee/hdf5 that referenced this pull request Nov 13, 2021
lrknox pushed a commit that referenced this pull request Nov 13, 2021
* TRILAB-266: Remove clang warnings in src/H5Zscaleoffset.c. (PR #1105)

* Committing clang-format changes

* TRILAB-266: Remove clang warnings in H5private.h and uthash.h. (PR #1124)

* TRILAB-266: Remove clang warnings in H5FDcore.c. (PR #1127)

* Committing clang-format changes

* TRILAB-266: Remove clang warnings in test/testmeta.c. (PR #1135)

* TRILAB-266: Remove clang warnings in test/swmr.c. (PR #1136)

* TRILAB-266: Remove clang warnings in test/cork.c. (PR #1137)

* Committing clang-format changes

* TRILAB-266: Remove clang warnings in test/cork.c. (PR #1146)

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
@hyoklee hyoklee deleted the OESS-168-H5FDcore.c branch July 14, 2022 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants