lua-users home
lua-l archive

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


Hi,

Kein-Hong Man wrote:
> On Mingw (gcc version 3.2.3 (mingw special 20030504-1)):
> lundump.h:14: warning: `visibility' attribute directive ignored
> lundump.h:17: warning: `visibility' attribute directive ignored
> [...]
> On Cygwin (gcc version 3.3.3 (cygwin special)):
> lundump.c:288: warning: visibility attribute not supported in this 
> configuration; ignored

It seems gcc warns about the visibility attribute when the
target format (in this case WIN32 executable images) does not
support it, even though the compiler recognizes the attribute.

> The URL http://www.ohse.de/uwe/articles/gcc-attributes.html
> claims 'visibility' is found in >=3.3, so I wonder if someone can 
> confirm whether ((__GNUC__*100 + __GNUC_MINOR__) >= 302) should be 
> 303 instead in luaconf.h. Does anyone have advice on what to do 
> with the Cygwin warning messages?

The main point was that the compiler produces better code for calls
to functions with hidden visibility inside PIC shared libraries.
This is not relevant for Windows (DLLs do not contain PIC) and can
be disabled there.

So one probably needs to modify luaconf.h line 127 to include only
ELF targets (but I'm not sure if __ELF__ is defined everywhere):

#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
      defined(__ELF__)

... or to explicitly exclude the WIN32 gcc ports (since _WIN32 is
not defined for Cygwin):

#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
      !defined(__CYGWIN__) && !defined(__MINGW32__)


Umm ... while we are at it: some non-function symbols still spill
into the dynamic namespace: luaH_dummynode, luaO_nilobject,
luaP_opmodes, luaP_opnames, luaT_typenames and luaX_tokens.
Tagging them with LUAI_FUNC works, but that makes the macro a bit
of a misnomer.

Bye,
     Mike