I've cast everything I can think of and it's still all over my code.
Where is the conversion?
What is the Error number so I can disable it?
If I change it to, uint8_t addr = (PORTC & 7)*2; then no warning is given - even though it's going from 9 bit to 8 bit (I know it isn't really).
It seems to occur whenever << is used such as uint8_t temp=1<<pin;
I like to have my code error free so I can instantly see if a new error (or warning) has appeared.
However, XC8 is now warning me about stuff in library calls,
Code:
/opt/microchip/xc8/v2.41/pic/sources/c99/common/Umul8.c:4:: advisory: (1510) non-reentrant function "___bmul" appears in multiple call graphs and has been duplicated by the compiler
This is only an Advisory and I have a number, 1510 so I can use #pragma warning disable 1510 - yes, it's a warning.
The older versions of XC8 didn't do this - maybe I need to look for an archive. I'm using a new install on Linux hence the newer XC8.
Considering MicroChips own code, as generated by the MCC, and also in their application notes, commonly produces warnings, then it's hardly a major concern.
I hate and try to get rid of any warnings in my code so I instantly see if a new one appears - you never know I may have inadvertently put if(x=1) etc. and I want those warnings. I can of course instantly fix it by changing to if(x==1). However, warnings like addr=(PORTC&7)<<1; are just wrong. And no amount of casting gets rid of them.
JUST WRONG, WRONG, WRONG.
And, microchip should be fixing these obvious bugs - which they don't.
It might not be a major concern but when I can't see the wood (real errors) for the trees (Microchip imagined errors) then it is a concern.
I hate and try to get rid of any warnings in my code so I instantly see if a new one appears - you never know I may have inadvertently put if(x=1) etc. and I want those warnings.
And, where is that list of error levels?
Do you get a warning for that?, I don't recall ever seeing one? - it's a perfectly valid and correct statement, it just doesn't do what you intended - apparently it's better to use (1==x) as if you put (1=x) by mistake, it gives an error. However, I must admit, I never do
I can't remember where I got the list of warnings from?, other than it involved google
It might even have been one warning at a time?, rather than a list.
This is the warning you get if you accidentally put if(x=1) etc.
Code:
main.c:91:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if(CCP2IF=1){
~~~~~~^~
Again, no warning number but it does tell you how to silence the warning,
main.c:91:14: note: place parentheses around the assignment to silence this warning
This is the warning you get if you accidentally put if(x=1) etc.
Code:
main.c:91:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if(CCP2IF=1){
~~~~~~^~
Again, no warning number but it does tell you how to silence the warning,
main.c:91:14: note: place parentheses around the assignment to silence this warning