From 568887fdc0a137bc3a94a6cb775b33d39926143f Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sun, 8 Oct 2017 18:57:34 +0200 Subject: [PATCH] samtools: Enable -O0 compilation with C99 Compiling samtools with -O0 with gcc might generate an error because of undefined functions. With C99 an inline function which is neither declared static nor extern generates no callable function body. However the compiler is 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. --- samtools/bgzf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samtools/bgzf.c b/samtools/bgzf.c index 216cd04..f7a4349 100644 --- a/samtools/bgzf.c +++ b/samtools/bgzf.c @@ -73,7 +73,7 @@ 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) { @@ -81,14 +81,14 @@ packInt16(uint8_t* buffer, uint16_t 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) {