Compiling CVS HEAD with clang under OSX

From: Neil Conway <neil(dot)conway(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Compiling CVS HEAD with clang under OSX
Date: 2010-08-01 23:11:53
Message-ID: AANLkTi=SDfLWxrM0qr672sMXAt2YGjnFW9Sm9ag2-VoK@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I tried $subject recently, and noticed some minor issues:

(1) Two warnings that suggest bugs; in src/backend/utils/adt,

datetime.c:3101:27: warning: use of logical || with constant operand;
switch to bitwise | or remove constant

And similarly for src/interfaces/ecpg/pgtypeslib/interval.c. Attached
is a patch that replaces logical OR with bitwise OR, which seems to be
the intended coding.

(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'" -- not sure the best way to fix this.
Perhaps have configure grep for "apple" in "gcc --version"?

(As an aside, is "no-cpp-precomp" still necessary for
reasonably-modern versions of Apple GCC?)

(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. Perhaps it is possible to rewrite
the macros to avoid the warning, although I didn't see an easy way to
do that. We could also specify -Wno-unused-value, but probably not
worth bothering just for clang.

Neil

Attachment Content-Type Size
clang_pgsql_tweaks.patch application/octet-stream 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-08-02 00:25:41 Re: Compiling CVS HEAD with clang under OSX
Previous Message Mike Fowler 2010-08-01 22:03:53 Initial review of xslt with no limits patch