Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
samtools: Enable -O0 compilation with C99
Browse files Browse the repository at this point in the history
Compiling samtools with -O0 with gcc might generate an error because of
undefined functions. With C99 an inline function which is neither
declated static nor extern generates no callable function body. However
the compiler if free to use the inline variant or the function body
variant, which is undefined. -O0 forbids inline, so we get a link error.

Add static keyword to inline functions, so that we can compile and link
with -O0 for debugging.
donald committed Oct 8, 2017
1 parent 491a683 commit 3461e63
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions samtools/bgzf.c
Original file line number Diff line number Diff line change
@@ -73,22 +73,22 @@ static const int GZIP_WINDOW_BITS = -15; // no zlib header
static const int Z_DEFAULT_MEM_LEVEL = 8;


inline
static inline
void
packInt16(uint8_t* buffer, uint16_t value)
{
buffer[0] = value;
buffer[1] = value >> 8;
}

inline
static inline
int
unpackInt16(const uint8_t* buffer)
{
return (buffer[0] | (buffer[1] << 8));
}

inline
static inline
void
packInt32(uint8_t* buffer, uint32_t value)
{

0 comments on commit 3461e63

Please sign in to comment.