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

Silence conversion warnings from malloc arguments #2809

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

ZedThree
Copy link
Contributor

Mostly just add an explicit cast when calling malloc and its variants. Sometimes instead change the type of a local variable if this would silence multiple warnings.

Silences more than 300 warnings on GCC.

Mostly just add an explicit cast when calling `malloc` and its
variants. Sometimes instead change the type of a local variable if
this would silence multiple warnings.
Copy link
Collaborator

@DennisHeimbigner DennisHeimbigner left a comment

Choose a reason for hiding this comment

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

Are the castings of c/malloc necessary?
I thought that assigning a void* value to an arbitrary pointer was ok
in C.

@ZedThree
Copy link
Contributor Author

Yes, implicit conversions between void* and other pointers are valid in C and don't generate warnings, so I've not touched the return value, this is just casting the argument(s) which should be size_t. Apologies if that wasn't clear from the description.

@WardF WardF merged commit c1fb4b0 into Unidata:main Dec 22, 2023
99 checks passed
@ZedThree ZedThree deleted the silence-malloc-warnings branch January 3, 2024 17:30
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.

3 participants