lua-users home
lua-l archive

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


Hi all,

Mike Pall wrote:
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?

Thanks, the fix below works. To answer my own question (above), 302 is correct; gcc 3.2.2 on RH9 compiles without warnings. I was misled by these two particular Mingw and Cygwin gcc versions having slightly different 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__)
[snip]

I'm not sure which is better. There might be other gcc targets that are non-ELF. gcc documentation on attributes mentions cygwin, mingw and arm-pe.

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia