[Mesa-dev] [PATCH 2/2] Don't use -fvisibilty=hidden on cygwin

Jon TURNEY jon.turney at dronecode.org.uk
Tue Apr 26 05:00:58 PDT 2011


Using -fvisibility=hidden makes the current cygwin gcc emit a warning
"warning: visibility attribute not supported in this configuration; ignored"
for every single non-static symbol

$ make clean && make 2>&1 | grep "ignored" | wc -l
6457

This is pretty annoying and makes it hard to spot other errors and warnings
in the compiler output.

It's not clear how to fix this.  Possibly the correct solution is explicitly
decorate all symbols with macros which annotate the expected visibility and
evaluate to attribute(hidden/default) or dllexport depending on the target,
as suggested at [1], but this would be a lot of work and misses the main
advantage of -fvisibility=hidden (that you don't have to explicitly annotate
everything :-)), so I guess we are supposed to know when -fvisibility isn't
going to be useful and not use it.

[1] http://gcc.gnu.org/wiki/Visibility

Alternatively, the configuration check could be made more complex to avoid
using this flag is the target isn't ELF or using the flag generates a warning

For the moment, I've gone for the crude solution of explicitly disabling
the use of this flag for the cygwin target

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 configure.ac |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 37ea5e7..b1e1de1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,15 @@ if test "x$GXX" = xyes; then
     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
 fi
 
+dnl even if the compiler appears to support it, using visibility attributes isn't
+dnl going to do anything useful currently on cygwin apart from emit lots of warnings
+case "$host_os" in
+cygwin*)
+    VISIBILITY_CFLAGS=""
+    VISIBILITY_CXXFLAGS=""
+    ;;
+esac
+
 AC_SUBST([VISIBILITY_CFLAGS])
 AC_SUBST([VISIBILITY_CXXFLAGS])
 
-- 
1.7.4



More information about the mesa-dev mailing list