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

From: Đoàn Trần Công Danh <[email-masked]>
Date: Fri, 9 Apr 2021 05:59:16 +0700

On 2021-04-09 00:23:52+0200, Ævar Arnfjörð Bjarmason <[email-masked]> 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