Skip to content

Compiler pedantry#2043

Merged
daviesrob merged 2 commits into
samtools:developfrom
jkbonfield:compiler-pedantry
Apr 30, 2024
Merged

Compiler pedantry#2043
daviesrob merged 2 commits into
samtools:developfrom
jkbonfield:compiler-pedantry

Conversation

@jkbonfield

Copy link
Copy Markdown
Contributor

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 as strdup)

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.)
@daviesrob daviesrob merged commit 1592334 into samtools:develop Apr 30, 2024
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.

2 participants