lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



Roberto Ierusalimschy <roberto@inf.puc-rio.br>于2018年1月3日 周三下午8:22写道:
> for some reason, I'm compiling lua as a single cpp code (unity builds), that is, supply a `cpp` file that include all `*.c` files of lua source code
>
>
> everything's fine until the recently lua 5.3.4, the `goto condjump` (e.g. lvm.c at line 1475) cause these issue
>
>
> ```
> lvm.c:1475:9: error: cannot jump from this goto statement to its label
>     goto condjump;
> lvm.c:1402:17: note: jump bypasses variable initialization
>     TValue *rb = vRB(i);
> ```

This is probably a bug in your compiler. C does not have this restriction.
(That kind of restriction only applies to variables with a variable length
array.)

  ISO/IEC 9899:1999 (E)

  6.8.6.1 The goto statement

  Constraints

  1 The identifier in a goto statement shall name a label located
  somewhere in the enclosing function. A goto statement shall not jump
  from outside the scope of an identifier having a variably modified
  type to inside the scope of that identifier.

(Anyway, I recognize that that code is ugly; the compiler had the right
to give a warning there.)

-- Roberto


Maybe he compiled the code in C++ mode (include codes in a cop file)? Perhaps C++ cannot do that.  A check to C++ standard possibility be needed.
--
regards,
Xavier Wang.