Re: [PATCH v13 5/5] bugreport: add compiler info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-04-09 00:23:52+0200, Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote:
> > +static inline void get_compiler_info(struct strbuf *info)
> > +{
> > +	int len = info->len;
> > +#ifdef __clang__
> > +	strbuf_addf(info, "clang: %s\n", __clang_version__);
> > +#elif defined(__GNUC__)
> > +	strbuf_addf(info, "gnuc: %d.%d\n", __GNUC__, __GNUC_MINOR__);
> > +#endif
> > +
> > +#ifdef _MSC_VER
> > +	strbuf_addf(info, "MSVC version: %02d.%02d.%05d\n",
> > +		    _MSC_VER / 100, _MSC_VER % 100, _MSC_FULL_VER % 100000);
> > +#endif
> 
> Why the ifdef/elif/ifdef instead of ifdef/elif/elif? Isn't _MSC_VER
> mutually exclusive with __clang__ and __GNUC__?

No, clang-cl is a MSVC emulation from clang, and clang-cl defines both
__clang__ and _MSC_VER. See: [mail].

AFAICT, clang-cl is production-usable, Google uses clang-cl to build
Google Chrome for Windows fro 2018 [blog]

mail: https://lists.llvm.org/pipermail/cfe-dev/2016-March/048147.html
blog: https://blog.llvm.org/2018/03/clang-is-now-used-to-build-chrome-for.html

-- 
Danh



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux