On Thu, Feb 20, 2020 at 09:49:03AM +0700, Danh Doan wrote: > On 2020-02-19 17:58:49-0800, Emily Shaffer <emilyshaffer@xxxxxxxxxx> 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. Yeah, between your comments now and Dscho's comments on this patch in the last rollup, I'll go ahead and refactor it like you suggest. - Emily