Skip to content

Commit

Permalink
Fix inline functions to use 'static inline'
Browse files Browse the repository at this point in the history
With just 'inline', if the compiler decides not to inline them, it isn't
required to emit them at all. For some targets with -Os that is causing
build failures, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86360.

Perhaps we might consider using '__attribute__((always_inline))' for
GCC builds, but 'static inline' is a good start.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
  • Loading branch information
dwmw2 authored and steve-m committed Jul 3, 2018
1 parent 8a26aba commit 9047eef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/rtl_adsb.c
Expand Up @@ -183,7 +183,7 @@ int magnitute(uint8_t *buf, int len)
return len/2;
}

inline uint16_t single_manchester(uint16_t a, uint16_t b, uint16_t c, uint16_t d)
static inline uint16_t single_manchester(uint16_t a, uint16_t b, uint16_t c, uint16_t d)
/* takes 4 consecutive real samples, return 0 or 1, BADSAMPLE on error */
{
int bit, bit_p;
Expand Down Expand Up @@ -224,17 +224,17 @@ inline uint16_t single_manchester(uint16_t a, uint16_t b, uint16_t c, uint16_t d
return BADSAMPLE;
}

inline uint16_t min16(uint16_t a, uint16_t b)
static inline uint16_t min16(uint16_t a, uint16_t b)
{
return a<b ? a : b;
}

inline uint16_t max16(uint16_t a, uint16_t b)
static inline uint16_t max16(uint16_t a, uint16_t b)
{
return a>b ? a : b;
}

inline int preamble(uint16_t *buf, int i)
static inline int preamble(uint16_t *buf, int i)
/* returns 0/1 for preamble at index i */
{
int i2;
Expand Down
2 changes: 1 addition & 1 deletion src/rtl_power.c
Expand Up @@ -250,7 +250,7 @@ void sine_table(int size)
}
}

inline int16_t FIX_MPY(int16_t a, int16_t b)
static inline int16_t FIX_MPY(int16_t a, int16_t b)
/* fixed point multiply and scale */
{
int c = ((int)a * (int)b) >> 14;
Expand Down

0 comments on commit 9047eef

Please sign in to comment.