Assignment in condition

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Assignment in condition

1,554 Views
Darryl
Contributor II

I have the following definitions in my code:

 

typedef struct {

    volatile uint8_t*   RB_Port;

    uint8_t             RB_Mask;

} NFlash_Accesss_Def_t;

 

#pragma INLINE
static bool_t MT29f_Busy( const NFlash_Accesss_Def_t* pPort ){
    return ( *pPort->RB_Port & pPort->RB_Mask ) == 0;
}

 

Using these definitions why does the following give me the warning "C5909: Assignment in condition"?

 

    while( MT29f_Busy( pChip_Ctrl) ) {

    }

 

It works fine, I just get the warning...  If I don't make it inline, I don't get the warning.

 

Thanks!

 

Labels (1)
0 Kudos
Reply
5 Replies

953 Views
lhotse
Contributor I

Same problem here. Using CodeWarrior 10.6 for HCS08.

Any advice?

0 Kudos
Reply

953 Views
BlackNight
NXP Employee
NXP Employee

I believe the compiler is doint an internal assignment for the inlined code (return value).

To get rid of that warning, you could disable that warning for that file or function?

Would that work for you?

Erich

0 Kudos
Reply

953 Views
lhotse
Contributor I

Hi Erich,

thanks for the reply. Indeed, that's what it looks like. I would rather avoid disabling the warning for the sake of code safety. The real solution would be to release a patch or to include a fix in the next release of CodeWarrior. Is there a bug tracking/reporting platform available for CodeWarrior?

Cheers

0 Kudos
Reply

953 Views
BlackNight
NXP Employee
NXP Employee

Which version of the toolchain/S08 compiler are you using?

I tried your example with the S08 compiler in CodeWarrior for MCU10.3, and I do not get that warning?

0 Kudos
Reply

953 Views
Darryl
Contributor II

I'm using CodeWarrior Development Studio for the S12(X), V5.1 Release.  Version 5.9.0.

0 Kudos
Reply