[cfe-dev] Macros for revision number and commit hash

James Y Knight via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 18 09:17:15 PDT 2019


On Mon, Mar 18, 2019 at 11:08 AM Tom Honermann via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> On 3/17/2019 2:50 PM, Aaron Ballman via cfe-dev wrote:
> > On Sun, Mar 17, 2019 at 1:59 PM Nico Weber via cfe-dev
> > <cfe-dev at lists.llvm.org> wrote:
> >> This would basically undo
> https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D37272&d=DwIGaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=oOJsFtgkFCCcDlfLWKmfrVDtpXLihXJTBGJfSapXCV0&m=NN7eJZPEoSXTgtLbDft08spwp4-8SuqJAEb82D7VQ_g&s=xAZXMyOnpVwmiNzdVbq3IST7I4DrGtNBpcnyXJWSsAI&e=
> which also caused lots of incremental build work after every sync (and
> technically, after every local commit). So if this got added, it should
> probably be opt-in and only be set for production builds, not for dev
> builds.
> >>
> >> Since you can't compare git hashes, when do you imagine would
> __clang_commit_hash__ be useful?
> > As mentioned upthread, I believe this is for automated equality
> > comparisons, mostly. You can compare git hashes for equality, so I
> > guess that's useful.
> >
> >> Doesn't __clang_revision_number__ solve the same problem that
> __has_feature() and friends solve, only in a worse way?
> > This one is less clear to me, especially given that we're phasing out
> > svn. What will this macro represent once we've fully switched away
> > from svn?
> >
> >> In practice, I found all the __clang_major__ / __clang_minor__ etc
> built-ins to be useless because they're gratuitously different in Xcode's
> clang and there isn't a vendor id define. I suppose that's what Troy said
> above.
> > +infinity (this causes considerable problems for our tools)
>
> Likewise.  We have to parse the output of 'clang --version' to determine
> if the Clang version we're emulating is Apple Clang (or ARM Clang or
> Android Clang or ...).  It would be great to have a __clang_vendor__ or
> similar macro that we could rely on instead


Apple Clang does set the __apple_build_version__ macro.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190318/bcd22d62/attachment.html>


More information about the cfe-dev mailing list