From 0f3a32b23c90a36f67683e7215d5b7e503eed2c5 Mon Sep 17 00:00:00 2001 From: Christian Vogel Date: Sun, 24 May 2015 12:07:13 +0200 Subject: [PATCH] Search/replace of extern inline -> static inline. Inline functions in header files are declared as 'extern inline' which makes the compiler also emit a externally visible version of the function. This gives us "multiple definition of..." errors during compile. --- newqpsk/complex.h | 14 +++++++------- newqpsk/fec.h | 4 ++-- newqpsk/filter-i386.h | 2 +- newqpsk/filter.h | 2 +- newqpsk/genfilt.c | 2 +- newqpsk/misc.h | 18 +++++++++--------- p3dmodem/genp3dtbl.c | 2 +- pammodem/genpamtbl.c | 2 +- pammodem/meas.c | 2 +- pammodem/pammodem.c | 4 ++-- pskmodem/genpsktbl.c | 2 +- pskmodem/measpsk.c | 2 +- pskmodem/pskmlse.c | 4 ++-- pskmodem/pskmodem.c | 2 +- soundcard/modem.h | 2 +- soundcard/simd.h | 18 +++++++++--------- 16 files changed, 41 insertions(+), 41 deletions(-) diff --git a/newqpsk/complex.h b/newqpsk/complex.h index 2353865..586572c 100644 --- a/newqpsk/complex.h +++ b/newqpsk/complex.h @@ -13,7 +13,7 @@ typedef struct { /* * Complex multiplication. */ -extern __inline__ complex cmul(complex x, complex y) +static inline complex cmul(complex x, complex y) { complex z; @@ -27,7 +27,7 @@ extern __inline__ complex cmul(complex x, complex y) * Complex ... yeah, what??? Returns a complex number that has the * properties: |z| = |x| * |y| and arg(z) = arg(y) - arg(x) */ -extern __inline__ complex ccor(complex x, complex y) +static inline complex ccor(complex x, complex y) { complex z; @@ -40,7 +40,7 @@ extern __inline__ complex ccor(complex x, complex y) /* * Real part of the complex ??? */ -extern __inline__ float ccorI(complex x, complex y) +static inline float ccorI(complex x, complex y) { return x.re * y.re + x.im * y.im; } @@ -48,7 +48,7 @@ extern __inline__ float ccorI(complex x, complex y) /* * Imaginary part of the complex ??? */ -extern __inline__ float ccorQ(complex x, complex y) +static inline float ccorQ(complex x, complex y) { return x.re * y.im - x.im * y.re; } @@ -56,7 +56,7 @@ extern __inline__ float ccorQ(complex x, complex y) /* * Modulo (absolute value) of a complex number. */ -extern __inline__ float cmod(complex x) +static inline float cmod(complex x) { return sqrt(x.re * x.re + x.im * x.im); } @@ -64,7 +64,7 @@ extern __inline__ float cmod(complex x) /* * Square of the absolute value (power). */ -extern __inline__ float cpwr(complex x) +static inline float cpwr(complex x) { return (x.re * x.re + x.im * x.im); } @@ -72,7 +72,7 @@ extern __inline__ float cpwr(complex x) /* * Argument of a complex number. */ -extern __inline__ float carg(complex x) +static inline float carg(complex x) { return atan2(x.im, x.re); } diff --git a/newqpsk/fec.h b/newqpsk/fec.h index 109ad51..409daf1 100644 --- a/newqpsk/fec.h +++ b/newqpsk/fec.h @@ -13,7 +13,7 @@ struct fecstate { /* --------------------------------------------------------------------- */ -extern inline void init_fec(struct fecstate *f) +static inline void init_fec(struct fecstate *f) { switch (f->feclevel) { case 0: @@ -33,7 +33,7 @@ extern inline void init_fec(struct fecstate *f) /* --------------------------------------------------------------------- */ -extern inline void init_inlv(struct fecstate *f) +static inline void init_inlv(struct fecstate *f) { int i; diff --git a/newqpsk/filter-i386.h b/newqpsk/filter-i386.h index 01b3f5d..d881b2c 100644 --- a/newqpsk/filter-i386.h +++ b/newqpsk/filter-i386.h @@ -1,7 +1,7 @@ #ifndef _FILTER_I386_H #define _FILTER_I386_H #define __HAVE_ARCH_MAC -extern inline float mac(const float *a, const float *b, unsigned int size) +static inline float mac(const float *a, const float *b, unsigned int size) { float f; asm volatile ( diff --git a/newqpsk/filter.h b/newqpsk/filter.h index ae789fc..754811e 100644 --- a/newqpsk/filter.h +++ b/newqpsk/filter.h @@ -12,7 +12,7 @@ /* ---------------------------------------------------------------------- */ #ifndef __HAVE_ARCH_MAC -extern inline float mac(const float *a, const float *b, unsigned int size) +static inline float mac(const float *a, const float *b, unsigned int size) { float sum = 0; unsigned int i; diff --git a/newqpsk/genfilt.c b/newqpsk/genfilt.c index a2eb077..5aec7bf 100644 --- a/newqpsk/genfilt.c +++ b/newqpsk/genfilt.c @@ -18,7 +18,7 @@ int main(int argc, char **argv) puts("#define _FILTER_I386_H"); puts("#define __HAVE_ARCH_MAC"); - puts("extern inline float mac(const float *a, const float *b, unsigned int size)"); + puts("static inline float mac(const float *a, const float *b, unsigned int size)"); puts("{"); puts("\tfloat f;"); puts("\tasm volatile ("); diff --git a/newqpsk/misc.h b/newqpsk/misc.h index aa3dfc5..e80301d 100644 --- a/newqpsk/misc.h +++ b/newqpsk/misc.h @@ -10,7 +10,7 @@ /* * Hamming weight (number of bits that are ones). */ -extern inline unsigned int hweight32(unsigned int w) +static inline unsigned int hweight32(unsigned int w) { w = (w & 0x55555555) + ((w >> 1) & 0x55555555); w = (w & 0x33333333) + ((w >> 2) & 0x33333333); @@ -20,7 +20,7 @@ extern inline unsigned int hweight32(unsigned int w) return w; } -extern inline unsigned int hweight16(unsigned short w) +static inline unsigned int hweight16(unsigned short w) { w = (w & 0x5555) + ((w >> 1) & 0x5555); w = (w & 0x3333) + ((w >> 2) & 0x3333); @@ -29,7 +29,7 @@ extern inline unsigned int hweight16(unsigned short w) return w; } -extern inline unsigned int hweight8(unsigned char w) +static inline unsigned int hweight8(unsigned char w) { w = (w & 0x55) + ((w >> 1) & 0x55); w = (w & 0x33) + ((w >> 2) & 0x33); @@ -42,7 +42,7 @@ extern inline unsigned int hweight8(unsigned char w) /* * Reverse order of bits. */ -extern inline unsigned int rbits32(unsigned int w) +static inline unsigned int rbits32(unsigned int w) { w = ((w >> 1) & 0x55555555) | ((w << 1) & 0xaaaaaaaa); w = ((w >> 2) & 0x33333333) | ((w << 2) & 0xcccccccc); @@ -52,7 +52,7 @@ extern inline unsigned int rbits32(unsigned int w) return w; } -extern inline unsigned short rbits16(unsigned short w) +static inline unsigned short rbits16(unsigned short w) { w = ((w >> 1) & 0x5555) | ((w << 1) & 0xaaaa); w = ((w >> 2) & 0x3333) | ((w << 2) & 0xcccc); @@ -61,7 +61,7 @@ extern inline unsigned short rbits16(unsigned short w) return w; } -extern inline unsigned char rbits8(unsigned char w) +static inline unsigned char rbits8(unsigned char w) { w = ((w >> 1) & 0x55) | ((w << 1) & 0xaa); w = ((w >> 2) & 0x33) | ((w << 2) & 0xcc); @@ -71,7 +71,7 @@ extern inline unsigned char rbits8(unsigned char w) /* ---------------------------------------------------------------------- */ -extern inline float avg(float average, float input, int scale) +static inline float avg(float average, float input, int scale) { int i; @@ -82,12 +82,12 @@ extern inline float avg(float average, float input, int scale) return (average + input); } -extern inline float avg2(float average, float input, float weight) +static inline float avg2(float average, float input, float weight) { return input * weight + average * (1.0 - weight); } -extern inline float phaseavg(float *data, int len) +static inline float phaseavg(float *data, int len) { float sum = 0.0; float min = M_PI; diff --git a/p3dmodem/genp3dtbl.c b/p3dmodem/genp3dtbl.c index 4d8fbd5..2360995 100644 --- a/p3dmodem/genp3dtbl.c +++ b/p3dmodem/genp3dtbl.c @@ -41,7 +41,7 @@ /* ---------------------------------------------------------------------- */ -extern inline unsigned int hweight32(unsigned int w) +static inline unsigned int hweight32(unsigned int w) { unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); res = (res & 0x33333333) + ((res >> 2) & 0x33333333); diff --git a/pammodem/genpamtbl.c b/pammodem/genpamtbl.c index a466f4d..2b00253 100644 --- a/pammodem/genpamtbl.c +++ b/pammodem/genpamtbl.c @@ -104,7 +104,7 @@ /* ---------------------------------------------------------------------- */ -extern __inline__ unsigned int hweight32(unsigned int w) +static inline unsigned int hweight32(unsigned int w) { unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); res = (res & 0x33333333) + ((res >> 2) & 0x33333333); diff --git a/pammodem/meas.c b/pammodem/meas.c index 5c2b61a..609e681 100644 --- a/pammodem/meas.c +++ b/pammodem/meas.c @@ -240,7 +240,7 @@ int sound_init(int sample_rate, int *sr) /* ---------------------------------------------------------------------- */ -extern __inline__ unsigned int hweight32(unsigned int w) +static inline unsigned int hweight32(unsigned int w) { unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); res = (res & 0x33333333) + ((res >> 2) & 0x33333333); diff --git a/pammodem/pammodem.c b/pammodem/pammodem.c index 92077a3..c4afc40 100644 --- a/pammodem/pammodem.c +++ b/pammodem/pammodem.c @@ -160,7 +160,7 @@ struct rxstate { unsigned int rxptr; }; -extern inline int rxgsfir(const int16_t *buf, const int *coeff) +static inline int rxgsfir(const int16_t *buf, const int *coeff) { unsigned int i; int s; @@ -207,7 +207,7 @@ static void rxrewindsamples(struct rxstate *rx, unsigned int nr, unsigned int ts rx->rxphase -= ph; } -extern inline int calcsync(int *toten, int *corren, int16_t *samples) +static inline int calcsync(int *toten, int *corren, int16_t *samples) { const int *tr = trainsyms; unsigned int i; diff --git a/pskmodem/genpsktbl.c b/pskmodem/genpsktbl.c index 9612bc9..e8dd07d 100644 --- a/pskmodem/genpsktbl.c +++ b/pskmodem/genpsktbl.c @@ -106,7 +106,7 @@ /* ---------------------------------------------------------------------- */ -extern __inline__ unsigned int hweight32(unsigned int w) +static inline unsigned int hweight32(unsigned int w) { unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); res = (res & 0x33333333) + ((res >> 2) & 0x33333333); diff --git a/pskmodem/measpsk.c b/pskmodem/measpsk.c index 88e0e36..d0a23de 100644 --- a/pskmodem/measpsk.c +++ b/pskmodem/measpsk.c @@ -271,7 +271,7 @@ int sound_init(int sample_rate, int *sr) /* ---------------------------------------------------------------------- */ -extern __inline__ unsigned int hweight32(unsigned int w) +static inline unsigned int hweight32(unsigned int w) { unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); res = (res & 0x33333333) + ((res >> 2) & 0x33333333); diff --git a/pskmodem/pskmlse.c b/pskmodem/pskmlse.c index 6fd1561..1649467 100644 --- a/pskmodem/pskmlse.c +++ b/pskmodem/pskmlse.c @@ -493,7 +493,7 @@ static void simdtrellis(unsigned int *nodemetric1, unsigned int *nodemetric2, un #else -extern inline void simdtrellis(unsigned int *nodemetric1, unsigned int *nodemetric2, unsigned int *metrictab, unsigned short *backptr, int vr, int vi) +static inline void simdtrellis(unsigned int *nodemetric1, unsigned int *nodemetric2, unsigned int *metrictab, unsigned short *backptr, int vr, int vi) { } @@ -582,7 +582,7 @@ static void simdinitmetric(const cplxshort_t *channel, metrictab_t *metrictab) #else -extern inline void simdinitmetric(const cplxshort_t *channel, metrictab_t *metrictab) +static inline void simdinitmetric(const cplxshort_t *channel, metrictab_t *metrictab) { } diff --git a/pskmodem/pskmodem.c b/pskmodem/pskmodem.c index ffb1668..4161bc2 100644 --- a/pskmodem/pskmodem.c +++ b/pskmodem/pskmodem.c @@ -262,7 +262,7 @@ static void rxrotate(cplxshort_t *ptr, unsigned int nr, unsigned int carphase, u } } -extern inline int calcsync(int *toten, int *corren, cplxshort_t *samples) +static inline int calcsync(int *toten, int *corren, cplxshort_t *samples) { const cplxshort_t *tr = traincorrrotated; unsigned int i; diff --git a/soundcard/modem.h b/soundcard/modem.h index b8c3a5f..375d07d 100644 --- a/soundcard/modem.h +++ b/soundcard/modem.h @@ -103,7 +103,7 @@ extern void logvprintf(unsigned int level, const char *fmt, va_list args); extern void logprintf(unsigned int level, const char *fmt, ...); extern void logerr(unsigned int level, const char *st); extern unsigned int log_verblevel; -extern inline int logcheck(unsigned int vl) +static inline int logcheck(unsigned int vl) { return vl <= log_verblevel; } diff --git a/soundcard/simd.h b/soundcard/simd.h index 6b6ab3b..e49bdd7 100644 --- a/soundcard/simd.h +++ b/soundcard/simd.h @@ -54,16 +54,16 @@ #if !defined(USEMMX) && !defined(USEVIS) -extern inline void initsimd(int enable) +static inline void initsimd(int enable) { } -extern inline int checksimd(void) +static inline int checksimd(void) { return 0; } -extern inline int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int nr) +static inline int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int nr) { int s = 0; @@ -72,7 +72,7 @@ extern inline int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int n return s; } -extern inline void simdpreparefpu(void) +static inline void simdpreparefpu(void) { } @@ -82,7 +82,7 @@ extern unsigned int simd_enabled; extern void initsimd(int enable); -extern inline int checksimd(void) +static inline int checksimd(void) { return simd_enabled; } @@ -91,7 +91,7 @@ extern inline int checksimd(void) #define MMXCLOBBER "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)" -extern inline int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int nr) +static inline int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int nr) { unsigned int i, j; int s = 0; @@ -114,7 +114,7 @@ extern inline int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int n return s; } -extern inline void simdpreparefpu(void) +static inline void simdpreparefpu(void) { if (checksimd()) asm volatile("emms"); @@ -122,7 +122,7 @@ extern inline void simdpreparefpu(void) #elif defined(USEVIS) -/*extern inline*/static int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int nr) +/*static inline*/static int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int nr) { double dsum1, dsum2, dsum3, dsum4, arg1, arg2, arg3, arg4; float sum, sum1, sum2; @@ -157,7 +157,7 @@ extern inline void simdpreparefpu(void) return s; } -extern inline void simdpreparefpu(void) +static inline void simdpreparefpu(void) { } -- 2.4.1