[nem-en] On unreachable code inside macro generated code

Alexey Borzenkov snaury at gmail.com
Thu Aug 31 06:41:41 CEST 2006


On 8/31/06, Kamil Skalski <kamil.skalski at gmail.com> wrote:
> My guess is that compiler warns that  ()  expression is unreachable,
> which should be somehow prevented, since () is an empty expression
> (though it might load null on the stack if some conversions are
> happening).

Ooops, baka me. I thought it was about looping code. x_x
You're absolutely right, it's about ()...
But isn't getting rid of it extremely easy then?
I'm commiting this patch:

Index: ncc/generation/ILEmitter.n
===================================================================
--- ncc/generation/ILEmitter.n	(revision 6595)
+++ ncc/generation/ILEmitter.n	(working copy)
@@ -440,7 +440,7 @@

     static skipped (expr : TExpr) : void
     {
-      unless (expr is TExpr.Goto) {
+      unless (expr is TExpr.Goto || expr is TExpr.Literal (Literal.Void)) {
         Message.Warning (expr.loc,
                          "this expression has been skipped in code "
                          "generation because of unreachable code");



More information about the devel-en mailing list