Re: MSVC and GCC compilation warnings

Jure Bagić <[email protected]> Thu, 30 Apr 2026 13:57:41 +0200
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
I am compiling from the latest commit on the mirror repository hosted on 
github.

I think this is just MSVC being ridiculous. I did browse a bit about 
this warning and stumbled upon this:
https://developercommunity.visualstudio.com/t/warning-c6001c4701-false-positive/1580097

The response the user got is that "it is too complex" to solve this.
Example provided by the user still fails 4 years later on the latest 
MSVC (https://godbolt.org/z/3bMb5Y5vT).

But then I can't possibly understand how it doesn't emit warning here 
for 'flim':

     ...
     lua_Number flim;  /* try to convert to float */
     if (!tonumber(lim, &flim)) /* cannot convert to float? */
       luaG_forerror(L, lim, "limit");
     /* else 'flim' is a float out of integer bounds */
     if (luai_numlt(0, flim)) {  /* if it is positive, it is too large */
       if (step < 0) return 1;  /* initial value must be less than it */
       *p = LUA_MAXINTEGER;  /* truncate */
     }
     ...

Anyways the only legit warning from MSVC here is I think for 'args' when 
'l_noret' is void:

   ...
   expdesc args;
   int base, nparams;
   int line = ls->linenumber;
   switch (ls->t.token) {
     case '(': {  /* funcargs -> '(' [ explist ] ')' */
       luaX_next(ls);
       if (ls->t.token == ')')  /* arg list is empty? */
         args.k = VVOID;
       else {
         explist(ls, &args);
         if (hasmultret(args.k))
           luaK_setmultret(fs, &args);
       }
       check_match(ls, ')', '(', line);
       break;
     }
     case '{' /*}*/: {  /* funcargs -> constructor */
       constructor(ls, &args);
       break;
     }
     case TK_STRING: {  /* funcargs -> STRING */
       codestring(&args, ls->t.seminfo.ts);
       luaX_next(ls);  /* must use 'seminfo' before 'next' */
       break;
     }
     default: {
       luaX_syntaxerror(ls, "function arguments expected");
     }
   }
   lua_assert(f->k == VNONRELOC);
   base = f->u.info;  /* base register for call */
   if (hasmultret(args.k))
   ...


On 4/30/26 12:16 PM, 'Scott Morgan' via lua-l wrote:
> On 30/04/2026 04:35, Jure Bagić wrote:
>> Does anyone see this initial email?
>> I think it somehow got discarded, well, there it is.
>
> Didn't see that initial mail. Looks like there's something wrong with 
> your copy of the sources tonumberns macro.
>
> Are you using a clean copy of the release tarball? Might be worth 
> re-downloading and re-extracting that.
>
> Scott
>

-- 
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/4777461c-a0f1-433f-9fa6-71aa5f6705ea%40gmail.com.