Re: MSVC and GCC compilation warnings
Roberto Ierusalimschy <[email protected]> Thu, 30 Apr 2026 12:24:07 -0300
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
> > Now, when the 'l_noret' is set as void, clang compiler emits no warnings.
> > However, both gcc and msvc emit one warning each.
> >
> > gcc:
> >
> > ldo.c:121:9: warning: infinite recursion detected [-Winfinite-recursion]
> > 121 | l_noret luaD_throw (lua_State *L, TStatus errcode) {
> > ldo.c:132:7: note: recursive call
> > 132 | luaD_throw(mainth, errcode); /* re-throw in main thread */
Can anyone explain this warning? The recursive call is guarded by two
if's, and it calls the function with a different argument (L in the
original call, mainth in the recursive call). How can the compiler decide
that the recursion is infinite?
More exactly: the recursive call only happens if L->errorJmp is nil.
But then it is done with a new L (mainth) which errorJmp field is not
nil. So, it seems quite easy to prove that the recursive call happens at
most once. Or am I missing something?
-- Roberto
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/20260430152407.GA28928%40arraial.inf.puc-rio.br.