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

Update htscodecs and add more warnings #1828

Merged
merged 5 commits into from
Aug 29, 2024

Conversation

jkbonfield
Copy link
Contributor

The extra warnings do spot a few buglets, such as in hts_parse_format().

Also resurrect -Werror which was absent from some builds. (It's still absent from the configure-less macos builds, but the recommended configure route has it which is sufficient.)

These find an old bug-let in hts_parse_format():
The buffer size is 8, but it includes \0 so the string would have been
truncated, causing the strcmp to fail for "fastq.gz".

Curiously gcc 10 and 11 spot this, but not gcc 12 or 13, nor clang.

Some builds didn't have -Werror enabled, such as those without
./configure and on Windows.
@@ -179,6 +179,7 @@ int main(int argc, char *argv[])
break;
case 'h':
usage(EXIT_SUCCESS);
// fall-through
Copy link
Member

Choose a reason for hiding this comment

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

This isn't really a fall-through situation. usage() (and error()) wants HTS_NORETURN.

Change hts_close() to hts_close_abruptly() in bgzip, to fix an
empty body warning, allowing removal of -Wno-empty-body in CI
tests.

Fix signed compare in htslib/bgzf.h, which caused a warning in
the maintainer-check usepublic.cpp check.  It appears that -Wall
does not allow signed-compare in c++.

Make CFLAGS settings more consistent in .cirrus.yml, and ensure
$MAKE_OPTS is consistently applied in all make invocations.  The
latter is necessary because "make cc-version" and
"make maintainer-check" can trigger production of some .mk files,
and we want them to be made in the same way as if we ran the full
build.

Switch MacOS build to Sonoma as Ventura is no longer supported
by Cirrus.
It's already in $(LIBS) and the MacOS linker complains if it
appears more than once
@daviesrob
Copy link
Member

I've pushed a few adjustments:

  • Fixed the only instance of an empty body, so -Wno-empty-body can be removed.
  • Fixed a signed compare in htslib/bgzf.h which triggered a warning from g++.
  • Adjust setting of CFLAGS in .cirrus.yml so they're applied more consistently.
  • Add HTS_NORETURN to test-bcf-sr usage and error functions, as suggested by @jmarshall
  • Remove -lz from the link lines of some test programs, as it was already in $(LIBS) and the duplication annoyed the MacOS linker.

Additionally, the MacOS builds were getting a banner saying "Only ghcr.io/cirruslabs/macos-runner:sonoma is allowed. Automatically upgraded." so the MacOS image has been changed to the Sonoma one.

@whitwham whitwham merged commit c12496f into samtools:develop Aug 29, 2024
9 checks passed
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.

4 participants