Assignment in condition

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Assignment in condition

1,553件の閲覧回数
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!

 

ラベル(1)
0 件の賞賛
返信
5 返答(返信)

952件の閲覧回数
lhotse
Contributor I

Same problem here. Using CodeWarrior 10.6 for HCS08.

Any advice?

0 件の賞賛
返信

952件の閲覧回数
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 件の賞賛
返信

952件の閲覧回数
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 件の賞賛
返信

952件の閲覧回数
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 件の賞賛
返信

952件の閲覧回数
Darryl
Contributor II

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

0 件の賞賛
返信