Обсуждение: Compile warnings on OSX 10.10 clang 6.0

Поиск
Список
Период
Сортировка

Compile warnings on OSX 10.10 clang 6.0

От
John Gorman
Дата:
Hi All

I am getting compile warnings on OSX 10.10 from clang 6.0:

clang: warning: argument unused during compilation: '-pthread'

The 5 warnings are where we are making a -dynamiclib and
the -pthread argument is not necessary:

./src/interfaces/libpq/
./src/interfaces/ecpg/pgtypeslib/
./src/interfaces/ecpg/ecpglib/
./src/interfaces/ecpg/compatlib/
./src/interfaces/ecpg/preproc/

This is interfering with using "-Wall -Werror" to catch warnings.

Any opinions as to whether this is worth fixing and if so
what the cleanest approach might be?

Thanks, John

Re: Compile warnings on OSX 10.10 clang 6.0

От
Peter Eisentraut
Дата:
On 4/3/15 4:02 PM, John Gorman wrote:
> I am getting compile warnings on OSX 10.10 from clang 6.0:
> 
> clang: warning: argument unused during compilation: '-pthread'
> 
> The 5 warnings are where we are making a -dynamiclib and
> the -pthread argument is not necessary:
> 
> ./src/interfaces/libpq/
> ./src/interfaces/ecpg/pgtypeslib/
> ./src/interfaces/ecpg/ecpglib/
> ./src/interfaces/ecpg/compatlib/
> ./src/interfaces/ecpg/preproc/
> 
> This is interfering with using "-Wall -Werror" to catch warnings.
> 
> Any opinions as to whether this is worth fixing and if so
> what the cleanest approach might be?

These warnings also happen with older versions of clang.  Now idea how
to fix yet.  I'm thinking that clang should be fixed, because these
warnings are stupid.



Re: Compile warnings on OSX 10.10 clang 6.0

От
Tom Lane
Дата:
Peter Eisentraut <peter_e@gmx.net> writes:
> On 4/3/15 4:02 PM, John Gorman wrote:
>> I am getting compile warnings on OSX 10.10 from clang 6.0:
>> 
>> clang: warning: argument unused during compilation: '-pthread'
>> 
>> The 5 warnings are where we are making a -dynamiclib and
>> the -pthread argument is not necessary:
>> 
>> ./src/interfaces/libpq/
>> ./src/interfaces/ecpg/pgtypeslib/
>> ./src/interfaces/ecpg/ecpglib/
>> ./src/interfaces/ecpg/compatlib/
>> ./src/interfaces/ecpg/preproc/
>> 
>> This is interfering with using "-Wall -Werror" to catch warnings.
>> 
>> Any opinions as to whether this is worth fixing and if so
>> what the cleanest approach might be?

> These warnings also happen with older versions of clang.  Now idea how
> to fix yet.  I'm thinking that clang should be fixed, because these
> warnings are stupid.

Yeah, they're utterly stupid; whoever put them in obviously doesn't
have a clue about typical Makefile construction.  I wonder if next
we'll see complaints about unnecessary -D or -I switches.

Having said that, I did look awhile ago about how we might get rid of
them, and it seems not easy; for starters we would need to drop the
assumption that CFLAGS can always be included when linking.  Also,
AFAICT -pthread sometimes *is* required when linking; so it's
not even very obvious when to suppress the switch, even if we could
do so without wholesale rearrangement of our FLAGS handling.
        regards, tom lane



Re: Compile warnings on OSX 10.10 clang 6.0

От
Tom Lane
Дата:
I wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> These warnings also happen with older versions of clang.  Now idea how
>> to fix yet.  I'm thinking that clang should be fixed, because these
>> warnings are stupid.

> Yeah, they're utterly stupid; whoever put them in obviously doesn't
> have a clue about typical Makefile construction.  I wonder if next
> we'll see complaints about unnecessary -D or -I switches.

> Having said that, I did look awhile ago about how we might get rid of
> them, and it seems not easy; for starters we would need to drop the
> assumption that CFLAGS can always be included when linking.  Also,
> AFAICT -pthread sometimes *is* required when linking; so it's
> not even very obvious when to suppress the switch, even if we could
> do so without wholesale rearrangement of our FLAGS handling.

On the other hand, there's often more than one way to skin a cat.
It occurred to me that maybe we could just turn off this class of warning,
and after some experimentation I found out that
"-Wno-unused-command-line-argument" does that, at least in the version
of clang that Apple's currently shipping.

Who's for enabling that if the compiler takes it?
        regards, tom lane



Re: Compile warnings on OSX 10.10 clang 6.0

От
John Gorman
Дата:
I have confirmed that "-Wno-unused-command-line-argument"
suppresses the "-pthread" warning for clang 6.0 and does not
trigger a warning in gcc 4.9.

Works for me!

John

On Fri, Apr 3, 2015 at 5:21 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> These warnings also happen with older versions of clang.  Now idea how
>> to fix yet.  I'm thinking that clang should be fixed, because these
>> warnings are stupid.

> Yeah, they're utterly stupid; whoever put them in obviously doesn't
> have a clue about typical Makefile construction.  I wonder if next
> we'll see complaints about unnecessary -D or -I switches.

> Having said that, I did look awhile ago about how we might get rid of
> them, and it seems not easy; for starters we would need to drop the
> assumption that CFLAGS can always be included when linking.  Also,
> AFAICT -pthread sometimes *is* required when linking; so it's
> not even very obvious when to suppress the switch, even if we could
> do so without wholesale rearrangement of our FLAGS handling.

On the other hand, there's often more than one way to skin a cat.
It occurred to me that maybe we could just turn off this class of warning,
and after some experimentation I found out that
"-Wno-unused-command-line-argument" does that, at least in the version
of clang that Apple's currently shipping.

Who's for enabling that if the compiler takes it?

                        regards, tom lane

Re: Compile warnings on OSX 10.10 clang 6.0

От
Michael Paquier
Дата:
On Sat, Apr 4, 2015 at 6:21 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I wrote:
>> Peter Eisentraut <peter_e@gmx.net> writes:
>>> These warnings also happen with older versions of clang.  Now idea how
>>> to fix yet.  I'm thinking that clang should be fixed, because these
>>> warnings are stupid.
>
>> Yeah, they're utterly stupid; whoever put them in obviously doesn't
>> have a clue about typical Makefile construction.  I wonder if next
>> we'll see complaints about unnecessary -D or -I switches.
>
>> Having said that, I did look awhile ago about how we might get rid of
>> them, and it seems not easy; for starters we would need to drop the
>> assumption that CFLAGS can always be included when linking.  Also,
>> AFAICT -pthread sometimes *is* required when linking; so it's
>> not even very obvious when to suppress the switch, even if we could
>> do so without wholesale rearrangement of our FLAGS handling.
>
> On the other hand, there's often more than one way to skin a cat.
> It occurred to me that maybe we could just turn off this class of warning,
> and after some experimentation I found out that
> "-Wno-unused-command-line-argument" does that, at least in the version
> of clang that Apple's currently shipping.
>
> Who's for enabling that if the compiler takes it?

Yes, please. I always found those pthread warnings annoying.
-- 
Michael



Re: Compile warnings on OSX 10.10 clang 6.0

От
Tom Lane
Дата:
Michael Paquier <michael.paquier@gmail.com> writes:
> On Sat, Apr 4, 2015 at 6:21 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> It occurred to me that maybe we could just turn off this class of warning,
>> and after some experimentation I found out that
>> "-Wno-unused-command-line-argument" does that, at least in the version
>> of clang that Apple's currently shipping.
>> 
>> Who's for enabling that if the compiler takes it?

> Yes, please. I always found those pthread warnings annoying.

After a bit more experimentation I found out that for both gcc and clang
(at least in the versions I'm using, on RHEL6 and Yosemite), you can
write "-Wno-anythingatall" and the compiler will not complain about it.
(And how did *that* get by the bozo who put in this warning, I wonder.)
So that means that if we just add the obvious test
 PGAC_PROG_CC_CFLAGS_OPT([-Wno-unused-command-line-argument])

then we will end up including that in CFLAGS on pretty much every
platform, whether or not there's an actual problem to solve.

gcc *does* complain about -Wunused-command-line-argument, so a possible
answer is to test for that and then add the other to CFLAGS.  That seems
kinda grotty though, does anyone have another way?
        regards, tom lane