Re: [PATCH v7 06/15] bugreport: add compiler info
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 20, 2020, 22:33 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2002202306390.46@tvgsbejvaqbjf.bet>
- In-Reply-To
- <20200219224547.GC26221@google.com>
Hi Emily,
On Wed, 19 Feb 2020, Emily Shaffer wrote:
Show 16 quoted lines
> #ifdef __GLIBC__
> #include <gnu/libc-version.h>
> #endif
>
> static inline void get_compiler_info(struct strbuf *info)
> {
> #ifdef __GLIBC__
> strbuf_addf(info, "glibc: %s\n", gnu_get_libc_version());
> #endif
>
> #ifdef __GNUC__
> strbuf_addf(info, "gnuc: %d.%d\n", __GNUC__, __GNUC_MINOR__);
> #endif
>
> #ifdef _MSC_VER
> strbuf_addf(info, "msc runtime: %s\n", some_msc_info());You could do it this way right away:
strbuf_addf(info, "MSVC version: %d.%d\n", _MSC_VER / 100, _MSC_VER % 100);
Note: this is _not_ the MSVC _runtime_ version, but really the compiler version.
You could also use _MSC_FULL_VER, which is a bit more complete.
Show 12 quoted lines
> #endif > } > > The thinking being - this way if I decide to use, say, LLVM + glibc, > then I don't need to reimplement this command with all the glibc > diagnostics again. Or, if someone else already wrote diagnostics for > LLVM with some other libc, then it even Just Works for me and my new > combination. > > That said, I'm reasoning about these combinations of compilers and libcs > and whatever else from an inexperienced viewpoint, so maybe this isn't > necessary?
I would have hoped that the argument I made earlier about the broken GCC version would have convinced you that the answer to this question is: Yes, this is necessary.
Ciao, Dscho
> > - Emily >