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

Dan Nicholson dbn.lists at gmail.com
Wed Apr 27 05:45:24 PDT 2011


On Wed, Apr 27, 2011 at 4:06 AM, Jon TURNEY <jon.turney at dronecode.org.uk> wrote:
> On 27/04/2011 11:39, Dan Nicholson wrote:
>> On Tue, Apr 26, 2011 at 5:00 AM, Jon TURNEY wrote:
>>> 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
>>
>> You could add -Werror to the CFLAGS used for the visibility test since
>> any host that's throwing warnings for something so simple probably has
>> issues with visibility. Something like:
>>
>> diff --git a/configure.ac b/configure.ac
>> index 8989c2b..ec662a3 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -152,7 +152,7 @@ if test "x$GCC" = xyes; then
>>      save_CFLAGS="$CFLAGS"
>>      AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
>>      VISIBILITY_CFLAGS="-fvisibility=hidden"
>> -    CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
>> +    CFLAGS="$CFLAGS $VISIBILITY_CFLAGS -Werror"
>>      AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
>>                    [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
>>
>> Does that do the right thing?
>
> Yes, this works, and in fact this was the approach I initially tried, and
> seems more elegant.
>
> However, I was concerned about false negatives.  As far as I can tell, nothing
> guarantees that the test program compiled by AC_LANG_PROGRAM() compiles
> without warnings, only without errors, so using -Werror might cause this test
> to fail for reasons unrelated to -fvisibility.
>
> Looking at this a bit more, though, a bit of googling seems to indicate we
> wouldn't be the first to use this construction, so perhaps it's ok :-)

Yeah, I didn't say, but that's what I was worried about, too. On the
other hand, what we're trying to compile is a bunch of defines then:

int
main ()
{

  ;
  return 0;
}

I'd hope we can do that without warnings. I'm fine if we don't feel
like messing with that now and would rather just blacklist cygwin.

--
Dan


More information about the mesa-dev mailing list