Re: Mixing CC and a different CLANG seems like a bad idea - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Mixing CC and a different CLANG seems like a bad idea
Date
Msg-id 20211118173244.yzyuvkscui2so232@alap3.anarazel.de
Whole thread Raw
In response to Mixing CC and a different CLANG seems like a bad idea  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Mixing CC and a different CLANG seems like a bad idea
List pgsql-hackers
Hi,

On 2021-11-18 11:56:59 -0500, Tom Lane wrote:
> I noticed that, a week after Michael pushed 9ff47ea41 to silence
> -Wcompound-token-split-by-macro warnings, buildfarm member sidewinder
> is still spewing them.  Investigation shows that it's building with
> 
> configure: using compiler=cc (nb4 20200810) 7.5.0
> configure: using CLANG=ccache clang
> 
> and the system cc doesn't know -Wcompound-token-split-by-macro,
> so we don't use it, but the modules that are built into bytecode
> still produce the warnings because they're built with clang.

> I think this idea of using clang with switches selected for some other
> compiler is completely horrid, and needs to be nuked from orbit before
> it causes problems worse than mere warnings.

We can test separately for flags, see BITCODE_CFLAGS/BITCODE_CXXFLAGS.


> Why did we not simply insist that if you want to use --with-llvm, the
> selected compiler must be clang?  I cannot see any benefit of mix-and-match
> here.

It seemed like a problematic restriction at the time. And still does to
me.

For one, gcc does generate somewhat better code. For another, extensions could
still compile with a different compiler, and generate bitcode with another
compiler, so it's good to have that easily testable.

It also just seems architecturally wrong: People pressed for making the choice
of JIT runtime replaceable, and it now is, at some pain. And forcing the main
compiler seems problematic from that angle.  With the meson port jit
compilation actually kinda works on windows - but it seems we shouldn't force
people to not use visual studio there, just for that?


I think the issue is more with trying to be miserly in the choice of compiler
flag tests to duplicate and how many places to change to choose the right flag
variable. It's taken a while for this to become a real issue, so it perhaps
was the right choice at the time.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Mixing CC and a different CLANG seems like a bad idea
Next
From: Tom Lane
Date:
Subject: Re: Mixing CC and a different CLANG seems like a bad idea