lua-users home
lua-l archive

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


I tested ...

---8X ---------------
f=io.popen("dir)
print(f:read("a"))
---8X ---------------

... and got a directory listing, so it seems io.popen works using -std=gnu99.

(I remember the same problems compiling wxWidgets. I dont know exactly why, but gcc seems to produce less errors using -std=gnu99)

Ulrich.


Am 03.01.2015 um 19:20 schrieb Ulrich Schmidt:

Am 03.01.2015 um 18:01 schrieb Roberto Ierusalimschy:
Am 03.01.2015 um 15:23 schröbte Lorenzo Donati:

Compiled with TDM-GCC 4.8.1-32bit under Windows-7 64bit (yes 32 bit
compiler in a 64bit machine) and got some warnings:

[...]
lua.c: In function 'pmain':
lua.c:584:5: warning: implicit declaration of function '_fileno'
[-Wimplicit-function-declaration]
      if (lua_stdin_is_tty()) {  /* running in interactive mode? */
      ^
liolib.c: In function 'io_pclose':
liolib.c:260:3: warning: implicit declaration of function '_pclose'
[-Wimplicit-function-declaration]
    return luaL_execresult(L, l_pclose(L, p->f));
    ^
liolib.c: In function 'io_popen':
liolib.c:268:3: warning: implicit declaration of function '_popen'
[-Wimplicit-function-declaration]
    p->f = l_popen(L, filename, mode);
    ^
liolib.c:268:8: warning: assignment makes pointer from integer
without a
cast [enabled by default]
    p->f = l_popen(L, filename, mode);
         ^

Those are probably the result of the new `-std=c99` flag in the
makefile: `-std=c99` implies `__STRICT_ANSI__`, and the above
mentioned functions are not declared if `__STRICT_ANSI__` is in
effect.

We could replace `-std=c99` with `-std=gnu99` for all architectures,
or just append `-std=gnu99` to the compiler command line (after the
`-std=c99`) for the mingw target only.

Can someone check whether adding "CC=gcc -std=gnu99" to the call to
'make' solve these warnings (and define a working version of 'io.popen')?
Many thanks,

-- Roberto

I changed "CC=gcc -std=gnu99" in src/Makefile and got no errors.
I used gcc (tdm-1) 4.9.2 (32bit) but 4.8.1.

Ulrich.