Compiler pedantry#2043
Merged
Merged
Conversation
We move this to gcc instead.
This warning appears with c90 and disappears again in c23. It's
harmless, but we do build htslib with ultra-pedantry so applying the
same logic here. (Although I would also agree with the camp that says
"if it hurts when you do that, then don't do that!")
Also fixed a couple other minor issues. The code now builds with
-D_XOPEN_SOURCE=600 -std=c99 -pedantic
Note the strnlen to strlen changes are OK as we can guarantee all uses
are using nul-terminated strings, either because we wrote them
ourselves with snprintf or because they're declared as such in the
htslib API (header "target_name" array). Potentially it changes
behaviour for specifying 48-character prefix matches of references
with names over 48 characters long, but don't do that! Use a sensible
reference. (If we really care we could just increase TV_MAX_GOTO with
some care to the visual sizing.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the ubuntu Clang address sanitizer issue which appeared recently due to Cirrus-CI upgrading.
Also copy the htslib policy of our code passing
-stdc=c99 -pedantic. We haven't previously enforced this for Samtools, but it was deemed to be valuable so it's now here too. (With XOPEN_SOURCE so we also allow posix things such asstrdup)