Merge https://github.com/j6t/gitk
[git/gitster.git] / compat / compiler.h
blobe12e426404ab0c299175aba335041b44aca2cc7b
1 #ifndef COMPILER_H
2 #define COMPILER_H
4 #include "strbuf.h"
6 #ifdef __GLIBC__
7 #include <gnu/libc-version.h>
8 #endif
10 static inline void get_compiler_info(struct strbuf *info)
12 size_t len = info->len;
13 #ifdef __clang__
14 strbuf_addf(info, "clang: %s\n", __clang_version__);
15 #elif defined(__GNUC__)
16 strbuf_addf(info, "gnuc: %d.%d\n", __GNUC__, __GNUC_MINOR__);
17 #endif
19 #ifdef _MSC_VER
20 strbuf_addf(info, "MSVC version: %02d.%02d.%05d\n",
21 _MSC_VER / 100, _MSC_VER % 100, _MSC_FULL_VER % 100000);
22 #endif
24 if (len == info->len)
25 strbuf_addstr(info, _("no compiler information available\n"));
28 static inline void get_libc_info(struct strbuf *info)
30 size_t len = info->len;
32 #ifdef __GLIBC__
33 strbuf_addf(info, "glibc: %s\n", gnu_get_libc_version());
34 #endif
36 if (len == info->len)
37 strbuf_addstr(info, _("no libc information available\n"));
40 #endif /* COMPILER_H */