Bruno, the patch looks simple to me, any objections to pushing it? I'm seeing a lot of useless warnings when building for Windows without it.
/Simon Simon Josefsson <[email protected]> writes: > Bruno, ping? Ok to push? > > /Simon > > Simon Josefsson <[email protected]> writes: > >> Mike Gran <[email protected]> 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;
