Subject: Re: [PATCH v8 06/15] bugreport: add compiler info

From: Danh Doan <[email-masked]>
Date: Thu, 20 Feb 2020 09:49:03 +0700

On 2020-02-19 17:58:49-0800, Emily Shaffer <[email-masked]> wrote:
> diff --git a/compat/compiler.h b/compat/compiler.h
> new file mode 100644
> index 0000000000..ef41177233
> --- /dev/null
> +++ b/compat/compiler.h
> @@ -0,0 +1,27 @@
> +#ifndef COMPILER_H
> +#define COMPILER_H
> +
> +#include "git-compat-util.h"
> +#include "strbuf.h"
> +
> +#ifdef __GLIBC__
> +#include <gnu/libc-version.h>
> +
> +static inline void get_compiler_info(struct strbuf *info)
> +{
> +	strbuf_addf(info, "glibc: %s\n", gnu_get_libc_version());
> +#ifdef __GNUC__
> +	strbuf_addf(info, "gnuc: %d.%d\n", __GNUC__, __GNUC_MINOR__);
> +#endif

I think we're better having

- get_compiler_info placed under #ifdef __GNUC__ gate,
- get_libc_info under #ifdef __GLIBC

Then have a function to merge those information together.
Correct me if I were wrong, as it is now,
this is only useful for Linux people with glibc.

Anyway, clang also defines __GNUC__ and __GNUC_MINOR__,
IIRC, FreeBSD people started to move to use clang instead of gcc
as their default compiler.

Gentoo forks are also known to use clang to compile their ports.

-- 
Danh