printf icon indicating copy to clipboard operation
printf copied to clipboard

Variable "va" is used before its value is set

Open nacansino opened this issue 5 years ago • 1 comments

I'm getting a weird build warning when building on CCRH compiler (for Renesas RH850). Compiler is using C99 standard.

Anyone here encountering the same thing?

.\..\..\src\drivers\common\printf.c(864):W0520549:Variable "va" is used before its value is set
..\..\..\src\drivers\common\printf.c(875):W0520549:Variable "va" is used before its value is set
..\..\..\src\drivers\common\printf.c(885):W0520549:Variable "va" is used before its value is set
..\..\..\src\drivers\common\printf.c(908):W0520549:Variable "va" is used before its value is set

nacansino avatar Jul 21 '20 01:07 nacansino

There is nothing wrong with the code flagged by your compiler, and there is not much that can be done to "improve" the code.

Compiling the module as C instead of C++ might help fix this. Otherwise you might need to disable this warning specifically.

If the compiler comes with its standard library source code, you could look at their implementation of sprintf to see how they avoid this warning. It is possible that the standard library be compiled with fewer warnings enabled or that they ignore such warnings in the library build process.

chqrlie avatar Jul 25 '20 14:07 chqrlie