I'm trying to disable some disturbing warnings (the generated code is fine; don't worry) but the only I find is the warninglevels (0, 1 or 2).
Is there any directive to disable a specific Warning in the C51 compiler?
(the generated code is fine; don't worry) If you go by "the code is fine" I pity you. The warnings are 'warnings' because they refer to a potential problem, where the errors refer to an absolute problem.
Go ahead, ignore the warnings and wait a month or two for the reports of 'strange intermittent problems'
Yes, I get warnings that 'are not a problem' such as 'unused variable', but I still remove them because they may (maybe later) be trouble. Continuing with the example, the 'irrelevant' "unused variable" means one less slot for the stack and maybe with some strange combination of interrupts and where they happen a stack overflow may occur because of just that one space missing.
If an employee of mine suppressed warning reporting by ANY means, he would be very close to entering the unemployment line.
It is unfortunate that Keil, for purely business reasons - I'm sure, have to make 'warning suppression' even possible.
Erik
Hi Erik, thanks for your reply.
When I say the code is fine I was referring that the generated assembler code is correct.
I see your point, and this is way I have spent 4 hours revising the generated assembler for each line with warnings, but as you said "warnings are not always errors".
And the problem is that this f***** warning, which I clearly have under control, generates so many output that it could easily hide some other more important warnings simply because you are not going revise 200 warnings each time that you compile.
The feature I talk is quite common in most compilers I have use, but I'm not able to find it in the C51 compiler. Is this compiler missing this feature?
Note This message was edited because of rude or abusive language.
What warning(s) are you actually talking about ?
Hi Christoph, thanks for your interest.
Warning C259: pointer different mspace.
It could be a really dangerous warning ... or not ...
The device is a 80x51 using the Dallas 390 Linear Addressing. It seems the compiler casts from xdata to far correctly (adding the third byte to the pointer), but in any case, it also add a warning.
In the other direction, it simply uses the offset (lower 2 bytes) and ignores the high byte, what it is a really dangerous cast (the cast should not be done automatically, and this should be an error and not a warning!!)
It's classified as Error/Warning. I would take that even more seriously than just a regular warning.
It seems the compiler casts from xdata to far correctly (adding the third byte to the pointer), but in any case, it also add a warning.
Are you using implicit or explicit casting ? If the former, does the warning go away if you cast explicitly ?
Anyway - casting from a pointer to xdata to a pointer to code memory is a fairly odd operation (I'd really have to think hard to find any operation that requires such casts), and not at all covered by any standard C rule. A different compiler (version) might handle this type of cast entirely differently.
View all questions in Keil forum