-
Notifications
You must be signed in to change notification settings - Fork 13
Warnings in dead-code #9
Comments
On Fri, Aug 23, 2013 at 05:39:10AM -0700, Matthieu Boutier wrote:
It will be very hard to fix in general. CIL translates this loop to:
and then decides that it falls-through because it contains a break |
Yes and no : runtime/cpc_io.cpc: cpc_write() /* windows version*/ In the repository version, the macros don't use the "do {…} while(0)" construct, but just "{…}" instead. I tried with "do {…} while()" when trying to fix a syntax error (for an unknown type), and remark that Warning. I can let the "{…}", or add "return 0;". If the second case, am I right to think it will not create more functions after the CPS ? I think that after the goto translation, the "break" will be a "goto" in dead code, and so discarded. You confirm ? Anyway, don't build a ugly hack to catch "do {…} while" cases as you proposed. |
I would advice you to just keep the former, as long as your are careful and do
It will not be discarded, but it will never be called in practice (and might However, the while(1) loop introduced by CIL will still be goto converted, at
So it's best to avoid such fake loops if they contain cps calls. Otherwise, it
It wouldn't be that ugly, in fact it might even make real-world programs cleaner |
Dead code may lead to that kind of Warning :
dead-code.cpc:3: Warning: Body of function ret falls-through. Adding a return statement
Example of code :
(checked on Windows -- cygwin)
The text was updated successfully, but these errors were encountered: