Closed FractalU closed 1 month ago
@hishamhm Do you prefer a pull request here as well. This bug report is standing for more than a year now. The solution is really simple. Add static to these three functions lfs_win32_pusherror
, windowsToUnixTime
, lfs_win32_lstat
in order to fix the missing prototypes warnings under windows.
I think it would be good to add to CI first, showing the failures. Here's some prior art; https://github.com/lunarmodules/luasystem/blob/master/.github/workflows/build.yml
It uses both MSVC as well as the MinGW/gcc toolchains (for PuC and LuaJIT Lua's respectively)
Don't really know whether MSVC shows a -Wmissing-prototypes
warning or similar as well. If it doesn't then this issue can easily be overlooked. According to workflows/build.yml
MinGW/gcc toolchain is only being used for the Luajit build.
But looking from a logical perspective. All functions in lfs.c
which aren't being declared with LFS_EXPORT
are being declared as static with the exception of the following three windows specific functions,
lfs_win32_pusherror
windowsToUnixTime
lfs_win32_lstat
Yet, all these three functions are fully local in lfs.c
and don't have a prototype in lfs.h
. So why not declare them as static, so that every function in lfs.c
which isn't being declared with LFS_EXPORT
is being declared as static. Then, only the functions which are being declared with LFS_EXPORT
have a prototype in lfs.h
.
@hishamhm Do you prefer a pull request here as well.
@FractalU yes please, especially since I don't have a way to test on Windows locally.
According to workflows/build.yml MinGW/gcc toolchain is only being used for the Luajit build.
What the comments there mean is that the only combinations tested are Windows+Lua 5.4+MSVC and Windows+LuaJIT+MinGW/gcc, but then luarocks make
runs with whatever compiler is being used. So I think that latter combination would still trigger the warnings you're referring to.
But looking from a logical perspective...
Yes, it does make sense!
Alright, made a pull request here as well.
I've manually built
luafilesystem
on window using msys2, a unix like environment on windows similar to cygwin. Fromgcc
I get the following warnings.I guess all the functions mentioned in the warnings should be declared as static. Below is the proposed change.
In
lfs.c
at line 169Declare all these functions as static.