Assignment in condition

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Assignment in condition

1,487 次查看
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 回复数

886 次查看
lhotse
Contributor I

Same problem here. Using CodeWarrior 10.6 for HCS08.

Any advice?

0 项奖励
回复

886 次查看
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 项奖励
回复

886 次查看
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 项奖励
回复

886 次查看
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 项奖励
回复

886 次查看
Darryl
Contributor II

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

0 项奖励
回复