Skip to content

Commit

Permalink
Add HTS_NORETURN to test-bcf-sr usage and error functions
Browse files Browse the repository at this point in the history
Hat-tip to John Marshall
  • Loading branch information
daviesrob committed Aug 23, 2024
1 parent 444dc05 commit 97b1543
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/test-bcf-sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@
#include <strings.h>
#include <errno.h>

#include "../htslib/hts_defs.h"
#include "../htslib/synced_bcf_reader.h"
#include "../htslib/hts.h"
#include "../htslib/vcf.h"

void HTS_FORMAT(HTS_PRINTF_FMT, 1, 2) error(const char *format, ...)
void HTS_FORMAT(HTS_PRINTF_FMT, 1, 2) HTS_NORETURN
error(const char *format, ...)
{
va_list ap;
va_start(ap, format);
Expand All @@ -49,7 +51,7 @@ void HTS_FORMAT(HTS_PRINTF_FMT, 1, 2) error(const char *format, ...)
exit(EXIT_FAILURE);
}

void usage(int exit_code)
void HTS_NORETURN usage(int exit_code)
{
fprintf(stderr, "Usage: test-bcf-sr [OPTIONS] vcf-list.txt\n");
fprintf(stderr, " test-bcf-sr [OPTIONS] -args file1.bcf [...]\n");
Expand Down Expand Up @@ -179,7 +181,6 @@ int main(int argc, char *argv[])
break;
case 'h':
usage(EXIT_SUCCESS);
// fall-through
default: usage(EXIT_FAILURE);
}
}
Expand Down

0 comments on commit 97b1543

Please sign in to comment.