Re: configure can't detect proper pthread flags

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Max Filippov <jcmvbkbc(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Bruce Momjian <bruce(at)momjian(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Peter Seiderer <ps(dot)report(at)gmx(dot)net>
Subject: Re: configure can't detect proper pthread flags
Date: 2015-07-08 17:19:33
Message-ID: 559D5BA5.4060506@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 07/08/2015 04:38 PM, Tom Lane wrote:
> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
>> I suggest that we revert that work-around for that GCC bug, and stop
>> testing the pthread flags as soon as we find one that works.
>
> OK ...
>
>> Then we can
>> also remove the test for whether the compiler produces any warnings.
>
> Don't see how that follows?

That test was added after the GCC-bug workaround, because that
workaround caused warnings. The upstream philosophy is to have a list of
flags, and try them in order until you find one that works. With the
workaround that we added, after it finds one flag that makes the pthread
test program to compile, it adds every flag in the list to the command
line as long as they donn't make the test program to fail again. For
example, after it found out that "-pthread" makes the compilation to
work, it appended "-pthreads -mthreads -mt -lpthread --thread-safe" to
PTHREAD_CFLAGS, as long as none of those caused a compiler error. They
could cause warnings though. That's why we had to add the test to check
for warnings.

The only scenario where you might now get warnings if we switch to
upstream version, and didn't before, is if one of the flags makes
pthreads to work, but also creates compiler warnings, while another flag
later in the list would make it work without warnings. That's not
totally inconceivable, but I doubt it happens. In any case, there's
nothing PostgreSQL-specific about that, so if that happens, I'd like to
find out so that we can complain to the upstream.

I'll commit the upstream version, and we'll see what the buildfarm thinks.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-07-08 17:50:22 Re: configure can't detect proper pthread flags
Previous Message Robbie Harwood 2015-07-08 16:24:37 Re: [PATCH] libpq: Allow specifying multiple host names to try to connect to