[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: visibility.m4
From: |
Simon Josefsson |
Subject: |
Re: visibility.m4 |
Date: |
Tue, 12 Jan 2010 15:06:58 +0100 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) |
Mike Gran <address@hidden> writes:
> Hello-
>
> If I use visibility.m4 on a platform with a recent GCC (4.x) on
> Cygwin, the visibility.m4 correctly discovers that gcc can compile with
> -fvisibility="hidden". But, on Cygwin (and probably most non-ELF) gcc does
> not actualy implement the visibility and emits the warning "visibility
> attribute not supported in this configuration" instead. Even so, the tests
> in visibility.m4 pass, and HAVE_VISIBILITY is set in the affirmative.
>
> In my humble opinion, it would be a good idea to add a "-werror" to the test
> in visibility.m4 so that it won't set CFLAGS_VISIBILITY and HAVE_VISIBILITY
> on those platforms that don't actually support it.
>
> What do you think?
I agree, and I recall that this was also suggested earlier. The current
approach leads to one warning per compiled source file, which is rather
annoying.
Bruno, how about this patch?
/Simon
diff --git a/m4/visibility.m4 b/m4/visibility.m4
index 35a6dc0..06537d6 100644
--- a/m4/visibility.m4
+++ b/m4/visibility.m4
@@ -29,7 +29,11 @@ AC_DEFUN([gl_VISIBILITY],
AC_MSG_CHECKING([for simple visibility declarations])
AC_CACHE_VAL([gl_cv_cc_visibility], [
gl_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -fvisibility=hidden"
+ # We use -Werror here because Cygwin/MinGW gives a warning
+ # 'visibility attribute not supported in this configuration'
+ # instead of doing what we want. Using -Werror makes gcc fail
+ # instead, so we detect the problem.
+ CFLAGS="$CFLAGS -fvisibility=hidden -Werror"
AC_TRY_COMPILE(
[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
extern __attribute__((__visibility__("default"))) int exportedvar;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: visibility.m4,
Simon Josefsson <=