warning 553

Post a reply

This question is a means of preventing automated form submissions by spambots.

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is OFF
Smilies are OFF

Topic review

Expand view Topic review: warning 553

Re: warning 553

by Wahrscheinlichkeit » Wed Aug 14, 2019 7:47 pm

Perhaps the definition might go with more ease to ++d with dP0OutImmed instead of uint8_t.

Re: warning 553

by DanielLi » Mon Aug 12, 2019 8:34 am

I have used ++d option like this: "++duint8_t="
The macro #define dP0OutImmed (uint8_t)( 0 | 0 ) will be expanded to ( )( 0 | 0 ) ,
but the "error 5446: expected value in expression" is issued!

Is there any other idea to clear the error 5546 but the source code will not be changed ?

Because We have many precompile check that is necessary in our project defined like below.

#if ( ((uint8_t)( (A) / (B) + 0.5 )) > 100u )
#warning "my warning msg!!!"

PS: A, B are predefined const values.

Re: warning 553

by DanielLi » Sat Aug 03, 2019 5:25 am

Hi Adiuvo,
Could you please show me an example by ++d option in this issue?
Thank you very much.

Re: warning 553

by Adiuvo » Fri Aug 02, 2019 3:57 pm

A preproccessor expression cannot use a cast to a typedef as typedefs don't exist until after preprocessing is already complete. If you want to use the value of this macro in a #if directive it will need to be defined in a way that does not require that cast. If you don't want to change the code then you can use a ++d option to define the macro differently just when analyzing your code.

Re: warning 553

by DanielLi » Fri Aug 02, 2019 12:58 am

Exactly,there is a #if #endif involved.

the detailed information shown below:

#if ((dP0Output) & (dP0OutImmed | dP0OutCross | dP0OutRandom))
#define _czP0 /* create port P0 shadow register */

and the dP0Output is defined as:
#define dP0Output (uint8_t)( 0 | bmP00 )
#define dP0OutImmed (uint8_t)( 0 | 0 )
#define dP0OutCross (uint8_t)( 0 | 0 )
#define dP0OutRandom (uint8_t)( 0 | 0 )

How can I fix this warning 553?

Re: warning 553

by Adiuvo » Thu Aug 01, 2019 1:27 pm

I tried putting:

#define dP14Output (uint8_t)( 0 | 0 )

in the online demo but message 553 wasn't issued.

Is there more to the example? The description for message 553 suggests there must be a #if or #elif involved.

Re: warning 553

by DanielLi » Thu Aug 01, 2019 2:40 am

I have included the stdint.h in my source code.
the line being reported is shown below:
#define dP14Output (uint8_t)( 0 | 0 )

In stdint.h, the definition of uint8_t is like below:
#ifdef __INT8_T_TYPE__
typedef __INT8_T_TYPE__ int8_t;
typedef __UINT8_T_TYPE__ uint8_t;
#endif /* __INT8_T_TYPE__ */

And before running static code check, we have generated co-iar-rl78.h, the macro __INT8_T_TYPE__ defined in it like this,
#define __INT8_T_TYPE__ signed char

Additionally, I wonder why the PC-Lint9 that we used before doesn't report this warning with the same source code?

Re: warning 553

by Adiuvo » Tue Jul 30, 2019 8:01 pm

Using uint8_t in a preprocessor directive looks suspicious because it's supposed to be a typedef not a macro. Can you show what the line being reported is doing? Did you include stdint.h? Does your stdint.h define it as a macro or a typedef?

warning 553

by DanielLi » Tue Jul 30, 2019 5:28 am

I now encounter an warning 553:
" warning 553: undefined preprocessor variable 'uint8_t', assumed 0 [MISRA 2004 Rule 19.11, required]"
But I have include directory of the compiler lib file in lint file like below:

I can't find why, could please tell me what's the root cause?