Re: Compiling CVS HEAD with clang under OSX

From: Neil Conway <neil(dot)conway(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Compiling CVS HEAD with clang under OSX
Date: 2010-08-02 04:54:38
Message-ID: AANLkTimM5-2yLun9ny3b2CDvaJ2XsQxKPpH83bj35fzb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 1, 2010 at 7:40 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I tried to duplicate your results using what I believe to be the latest
> version of clang,

I'm using SVN tip of llvm+clang from ~one week ago.

>> (2) clang doesn't support (or require) "-no-cpp-precomp", which
>> src/template/darwin adds to $CC unconditionally. Adding the flag
>> unconditionally seems wrong regardless: e.g., -no-cpp-precomp isn't
>> supported by FSF GCC on OSX either. clang is happy to ignore the flag,
>> but it just emits countless "warning: argument unused during
>> compilation: '-no-cpp-precomp'"
>
> I do see that, but I also see it complaining about -fwrapv:
>
[...]
>
> We're certainly not going to just drop -fwrapv, as that would break the
> code on many modern versions of gcc.  (I'm a bit surprised and concerned
> that clang hasn't got this flag, btw.)

Support for -fwrapv was apparently implemented recently:

https://llvm.org/viewvc/llvm-project?view=rev&sortby=date&revision=106956

FWIW, I think we should aim to eventually remove the dependency on
-fwrapv, and instead make the code correct under the semantics
guaranteed by the C spec. That will be hard to do without a tool that
checks for code that makes incorrect assumptions about integer
overflow behavior, but there seems to be progress in that area
recently:

http://blog.regehr.org/archives/226

(As it happens, their checker uses llvm, which is what motivated me to
start poking around in the first place...)

>> (3) There are countless warnings emitted during the compilation of
>> regcomp.c and related files, due to unused values returned by ERR(),
>> VERR(), FAILW(), and similar macros.
>
> I fixed this in HEAD, or at least my copy of clang doesn't complain
> anymore.

Yep, looks good here. Thanks!

Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2010-08-02 04:59:28 Re: Compiling CVS HEAD with clang under OSX
Previous Message Tom Lane 2010-08-02 04:40:13 Re: Compiling CVS HEAD with clang under OSX