drop INLINE macro from the tree
cover drop INLINE macro from the tree
This series fixes the following build breakage:
"""
In file included from /usr/include/spice-server/spice.h:25:0,
from /home/lcapitulino/work/src/upstream/qemu/include/ui/qemu-spice.h:25,
from /home/lcapitulino/work/src/upstream/qemu/qemu-char.c:84:/usr/include/spice-1/spice/macros.h:105:0: error: "INLINE" redefined [-Werror]
#define INLINE inline
^
In file included from /home/lcapitulino/work/src/upstream/qemu/include/qemu/bswap.h:8:0,
from /home/lcapitulino/work/src/upstream/qemu/include/qemu-common.h:112,
from /home/lcapitulino/work/src/upstream/qemu/qemu-char.c:24:/home/lcapitulino/work/src/upstream/qemu/include/fpu/softfloat.h:66:0: note: this is the location of the previous definition
#define INLINE static inline
^
cc1: all warnings being treated as errors
make: *** [qemu-char.o] Error 1
"""
Yes, yes, I know. Libspice is to blame. But if this happened to libspice it can happen with other external libs too. Besides, renaming keywords doesn't look like a good practice to me. Let's just do it.
Luiz Capitulino (2):
fpu: softfloat: drop INLINE macro
audio: fmopl: drop INLINE macro
fpu/softfloat-macros.h | 38 +++++++++---------- fpu/softfloat.c | 48 ++++++++++++------------ hw/audio/fmopl.c | 31 ++++++++-------- include/fpu/softfloat.h | 99 ++++++++++++++++++++++++------------------------- 4 files changed, 107 insertions(+), 109 deletions(-)
Signature · 1 line
1.9.3
PATCH 1/2 fpu: softfloat: drop INLINE macro
This commit expands all uses of the INLINE macro and drop it.
The reason for this is to avoid clashes with external libraries with bad name conventions and also because renaming keywords is not a good practice.
--- fpu/softfloat-macros.h | 38 +++++++++---------- fpu/softfloat.c | 48 ++++++++++++------------ include/fpu/softfloat.h | 99 ++++++++++++++++++++++++------------------------- 3 files changed, 92 insertions(+), 93 deletions(-)
fpu/softfloat-macros.h +19 -19
@@ -55,7 +55,7 @@ these four paragraphs for those parts of this code that are retained.| The result is stored in the location pointed to by `zPtr'. *----------------------------------------------------------------------------*/ -INLINE void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr) +static inline void shift32RightJamming (uint32_t a,int_fast16_t count,uint32_t *zPtr) {uint32_t z;
@@ -81,7 +81,7 @@ INLINE void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)| The result is stored in the location pointed to by `zPtr'. *----------------------------------------------------------------------------*/ -INLINE void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr) +static inline void shift64RightJamming (uint64_t a,int_fast16_t count,uint64_t *zPtr) {uint64_t z;
@@ -115,7 +115,7 @@ INLINE void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)| described above, and is returned at the location pointed to by `z1Ptr'.) *----------------------------------------------------------------------------*/ -INLINE void +static inline void shift64ExtraRightJamming (uint64_t a0,uint64_t a1,int_fast16_t count,uint64_t *z0Ptr,uint64_t *z1Ptr) {
@@ -152,7 +152,7 @@ INLINE void| which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'. *----------------------------------------------------------------------------*/ -INLINE void +static inline void shift128Right (uint64_t a0,uint64_t a1,int_fast16_t count,uint64_t *z0Ptr,uint64_t *z1Ptr) {
@@ -187,7 +187,7 @@ INLINE void| the locations pointed to by `z0Ptr' and `z1Ptr'. *----------------------------------------------------------------------------*/ -INLINE void +static inline void shift128RightJamming (uint64_t a0,uint64_t a1,int_fast16_t count,uint64_t *z0Ptr,uint64_t *z1Ptr) {
@@ -238,7 +238,7 @@ INLINE void| `z2Ptr'.) *----------------------------------------------------------------------------*/ -INLINE void +static inline void shift128ExtraRightJamming( uint64_t a0, uint64_t a1,
@@ -296,7 +296,7 @@ INLINE void| pieces which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'. *----------------------------------------------------------------------------*/ -INLINE void +static inline void shortShift128Left (uint64_t a0,uint64_t a1,int_fast16_t count,uint64_t *z0Ptr,uint64_t *z1Ptr) {
@@ -315,7 +315,7 @@ INLINE void| `z1Ptr', and `z2Ptr'. *----------------------------------------------------------------------------*/ -INLINE void +static inline void shortShift192Left( uint64_t a0, uint64_t a1,
@@ -350,7 +350,7 @@ INLINE void| are stored at the locations pointed to by `z0Ptr' and `z1Ptr'. *----------------------------------------------------------------------------*/ -INLINE void +static inline void add128 (uint64_t a0,uint64_t a1,uint64_t b0,uint64_t b1,uint64_t *z0Ptr,uint64_t *z1Ptr ) {
@@ -370,7 +370,7 @@ INLINE void| `z1Ptr', and `z2Ptr'. *----------------------------------------------------------------------------*/ -INLINE void +static inline void add192( uint64_t a0, uint64_t a1,
@@ -408,7 +408,7 @@ INLINE void| `z1Ptr'. *----------------------------------------------------------------------------*/ -INLINE void +static inline void sub128 (uint64_t a0,uint64_t a1,uint64_t b0,uint64_t b1,uint64_t *z0Ptr,uint64_t *z1Ptr ) {
@@ -426,7 +426,7 @@ INLINE void| pointed to by `z0Ptr', `z1Ptr', and `z2Ptr'. *----------------------------------------------------------------------------*/ -INLINE void +static inline void sub192( uint64_t a0, uint64_t a1,
@@ -462,7 +462,7 @@ INLINE void| `z0Ptr' and `z1Ptr'. *----------------------------------------------------------------------------*/ -INLINE void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr ) +static inline void mul64To128 (uint64_t a,uint64_t b,uint64_t *z0Ptr,uint64_t *z1Ptr ) {uint32_t aHigh, aLow, bHigh, bLow;uint64_t z0, zMiddleA, zMiddleB, z1;
@@ -492,7 +492,7 @@ INLINE void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr| `z2Ptr'. *----------------------------------------------------------------------------*/ -INLINE void +static inline void mul128By64To192( uint64_t a0, uint64_t a1,
@@ -520,7 +520,7 @@ INLINE void| the locations pointed to by `z0Ptr', `z1Ptr', `z2Ptr', and `z3Ptr'. *----------------------------------------------------------------------------*/ -INLINE void +static inline void mul128To256( uint64_t a0, uint64_t a1,
@@ -702,7 +702,7 @@ static int8 countLeadingZeros64( uint64_t a )| Otherwise, returns 0. *----------------------------------------------------------------------------*/ -INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) +static inline flag eq128 (uint64_t a0,uint64_t a1,uint64_t b0,uint64_t b1 ) {return ( a0 == b0 ) && ( a1 == b1 );
@@ -715,7 +715,7 @@ INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )| Otherwise, returns 0. *----------------------------------------------------------------------------*/ -INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) +static inline flag le128 (uint64_t a0,uint64_t a1,uint64_t b0,uint64_t b1 ) {return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) );
@@ -728,7 +728,7 @@ INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )| returns 0. *----------------------------------------------------------------------------*/ -INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) +static inline flag lt128 (uint64_t a0,uint64_t a1,uint64_t b0,uint64_t b1 ) {return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) );
@@ -741,7 +741,7 @@ INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )| Otherwise, returns 0. *----------------------------------------------------------------------------*/ -INLINE flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) +static inline flag ne128 (uint64_t a0,uint64_t a1,uint64_t b0,uint64_t b1 ) {return ( a0 != b0 ) || ( a1 != b1 );
fpu/softfloat.c +24 -24
192 lines not on this page · raw message
include/fpu/softfloat.h +49 -50
314 lines not on this page · raw message
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 1/2] fpu: softfloat: drop INLINE macro
Quoted 6 lines · Luiz Capitulino
This commit expands all uses of the INLINE macro and drop it.
The reason for this is to avoid clashes with external libraries with bad name conventions and also because renaming keywords is not a good practice.
Quoted 6 lines
Signed-off-by Luiz Capitulino <[email protected]>--- fpu/softfloat-macros.h | 38 +++++++++---------- fpu/softfloat.c | 48 ++++++++++++------------ include/fpu/softfloat.h | 99 ++++++++++++++++++++++++------------------------- 3 files changed, 92 insertions(+), 93 deletions(-)
I need a statement that you're happy for this change to be licensed under either the softfloat-2a or softfloat-2b licenses before we can apply it. (We're still hoping to make that licensing change...)
thanks
-- PMM
Re: [Qemu-devel] [PATCH 1/2] fpu: softfloat: drop INLINE macro
Quoted 14 lines · On Thu, 19 Jun 2014 15:59:35 +0100 Peter Maydell <[email protected]>…
Quoted 6 lines · Luiz Capitulino
This commit expands all uses of the INLINE macro and drop it.
The reason for this is to avoid clashes with external libraries with bad name conventions and also because renaming keywords is not a good practice.
Quoted 6 lines
Signed-off-by Luiz Capitulino <[email protected]>--- fpu/softfloat-macros.h | 38 +++++++++---------- fpu/softfloat.c | 48 ++++++++++++------------ include/fpu/softfloat.h | 99 ++++++++++++++++++++++++------------------------- 3 files changed, 92 insertions(+), 93 deletions(-)
Quoted 4 lines
I need a statement that you're happy for this change to be licensed under either the softfloat-2a or softfloat-2b licenses before we can apply it. (We're still hoping to make that licensing change...)
I'm fine with softfloat-2a.
PATCH 2/2 audio: fmopl: drop INLINE macro
In reply to Luiz CapitulinoThis commit expands all uses of the INLINE macro and drop it.
The reason for this is to avoid clashes with external libraries with bad name conventions and also because renaming keywords is not a good practice.
--- hw/audio/fmopl.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
hw/audio/fmopl.c +15 -16
@@ -30,7 +30,6 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#define INLINE static inline#define HAS_YM3812 1#include <stdio.h>
@@ -247,7 +246,7 @@ static INT32 feedback2; /* connect for SLOT 2 *//* --------------------- subroutines --------------------- */ -INLINE int Limit( int val, int max, int min ) { +static inline int Limit (int val,int max,int min ) {if ( val > max ) val = max;else if ( val < min )
@@ -257,7 +256,7 @@ INLINE int Limit( int val, int max, int min ) { }/* status set and IRQ handling */ -INLINE void OPL_STATUS_SET(FM_OPL *OPL,int flag) +static inline void OPL_STATUS_SET (FM_OPL *OPL ,int flag) {/* set status flag */ OPL ->status |= flag;
@@ -273,7 +272,7 @@ INLINE void OPL_STATUS_SET(FM_OPL *OPL,int flag) }/* status reset and IRQ handling */ -INLINE void OPL_STATUS_RESET(FM_OPL *OPL,int flag) +static inline void OPL_STATUS_RESET (FM_OPL *OPL ,int flag) {/* reset status flag */ OPL ->status &=~flag;
@@ -289,7 +288,7 @@ INLINE void OPL_STATUS_RESET(FM_OPL *OPL,int flag) }/* IRQ mask set */ -INLINE void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag) +static inline void OPL_STATUSMASK_SET (FM_OPL *OPL ,int flag) {OPL ->statusmask = flag;/* IRQ handling check */
@@ -298,7 +297,7 @@ INLINE void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag) }/* ----- key on ----- */ -INLINE void OPL_KEYON(OPL_SLOT *SLOT) +static inline void OPL_KEYON (OPL_SLOT *SLOT ) {/* sin wave restart */ SLOT ->Cnt =0 ;
@@ -309,7 +308,7 @@ INLINE void OPL_KEYON(OPL_SLOT *SLOT)SLOT ->eve =EG_AED ; }/* ----- key off ----- */ -INLINE void OPL_KEYOFF(OPL_SLOT *SLOT) +static inline void OPL_KEYOFF (OPL_SLOT *SLOT ) {if (SLOT ->evm >ENV_MOD_RR ) {
@@ -325,7 +324,7 @@ INLINE void OPL_KEYOFF(OPL_SLOT *SLOT)/* ---------- calcrate Envelope Generator & Phase Generator ---------- */ /* return : envelope output */ -INLINE UINT32 OPL_CALC_SLOT( OPL_SLOT *SLOT ) +static inline UINT32 OPL_CALC_SLOT (OPL_SLOT *SLOT ) {/* calcrate envelope generator */ if ( (SLOT ->evc+=SLOT ->evs) >=SLOT ->eve )
@@ -371,7 +370,7 @@ static void set_algorithm( OPL_CH *CH) }/* ---------- frequency counter for operater update ---------- */ -INLINE void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT) +static inline void CALC_FCSLOT (OPL_CH *CH ,OPL_SLOT *SLOT ) {int ksr;
@@ -391,7 +390,7 @@ INLINE void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT) }/* set multi,am,vib,EG-TYP,KSR,mul */ -INLINE void set_mul(FM_OPL *OPL,int slot,int v) +static inline void set_mul (FM_OPL *OPL ,int slot,int v) {OPL_CH *CH = &OPL ->P_CH[slot/2 ];OPL_SLOT *SLOT = &CH ->SLOT[slot&1 ];
@@ -405,7 +404,7 @@ INLINE void set_mul(FM_OPL *OPL,int slot,int v) }/* set ksl & tl */ -INLINE void set_ksl_tl(FM_OPL *OPL,int slot,int v) +static inline void set_ksl_tl (FM_OPL *OPL ,int slot,int v) {OPL_CH *CH = &OPL ->P_CH[slot/2 ];OPL_SLOT *SLOT = &CH ->SLOT[slot&1 ];
@@ -421,7 +420,7 @@ INLINE void set_ksl_tl(FM_OPL *OPL,int slot,int v) }/* set attack rate & decay rate */ -INLINE void set_ar_dr(FM_OPL *OPL,int slot,int v) +static inline void set_ar_dr (FM_OPL *OPL ,int slot,int v) {OPL_CH *CH = &OPL ->P_CH[slot/2 ];OPL_SLOT *SLOT = &CH ->SLOT[slot&1 ];
@@ -438,7 +437,7 @@ INLINE void set_ar_dr(FM_OPL *OPL,int slot,int v) }/* set sustain level & release rate */ -INLINE void set_sl_rr(FM_OPL *OPL,int slot,int v) +static inline void set_sl_rr (FM_OPL *OPL ,int slot,int v) {OPL_CH *CH = &OPL ->P_CH[slot/2 ];OPL_SLOT *SLOT = &CH ->SLOT[slot&1 ];
@@ -455,7 +454,7 @@ INLINE void set_sl_rr(FM_OPL *OPL,int slot,int v)/* operator output calcrator */ #define OP_OUT (slot,env,con) slot->wavetable[((slot->Cnt+con)/(0x1000000/SIN_ENT))&(SIN_ENT-1)][env]/* ---------- calcrate one of channel ---------- */ -INLINE void OPL_CALC_CH( OPL_CH *CH ) +static inline void OPL_CALC_CH (OPL_CH *CH ) {UINT32 env_out;OPL_SLOT *SLOT ;
@@ -500,7 +499,7 @@ INLINE void OPL_CALC_CH( OPL_CH *CH )/* ---------- calcrate rhythm block ---------- */ #define WHITE_NOISE_db 6.0 -INLINE void OPL_CALC_RH( OPL_CH *CH ) +static inline void OPL_CALC_RH (OPL_CH *CH ) {UINT32 env_tam,env_sd,env_top,env_hh;int whitenoise = (rand ()&1 )*(WHITE_NOISE_db/EG_STEP );
@@ -716,7 +715,7 @@ static void OPLCloseTable( void ) }/* CSM Key Control */ -INLINE void CSMKeyControll(OPL_CH *CH) +static inline void CSMKeyControll (OPL_CH *CH ) {OPL_SLOT *slot1 = &CH ->SLOT[SLOT1 ];OPL_SLOT *slot2 = &CH ->SLOT[SLOT2 ];
Signature · 1 line
1.9.3
Quoted 2 lines · Luiz Capitulino
Besides, renaming keywords doesn't
look like a good practice to me. Let's just do it.
It's actually fairly common as a portability thing from back when you might have to deal with compilers that didn't support 'inline' or which had differing ideas about how inline functions should be marked, when it wasn't yet part of the C standard. INLINE was the macro name used a lot for this.
However since QEMU has no intention of trying to deal with ancient compilers which don't know about inline, we gain nothing from the macro, so expanding it away is the right thing.
thanks
-- PMM