lua-users home
lua-l archive

Re: compile lvm.c as cpp code fails at 'goto condjump'

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


> 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

AltStyle によって変換されたページ (->オリジナル) /