]> git.ipfire.org Git - thirdparty/git.git/blob - compat/compiler.h
Merge branch 'ea/blame-use-oideq'
[thirdparty/git.git] / compat / compiler.h
1 #ifndef COMPILER_H
2 #define COMPILER_H
3
4 #include "git-compat-util.h"
5 #include "strbuf.h"
6
7 #ifdef __GLIBC__
8 #include <gnu/libc-version.h>
9 #endif
10
11 static inline void get_compiler_info(struct strbuf *info)
12 {
13 int len = info->len;
14 #ifdef __clang__
15 strbuf_addf(info, "clang: %s\n", __clang_version__);
16 #elif defined(__GNUC__)
17 strbuf_addf(info, "gnuc: %d.%d\n", __GNUC__, __GNUC_MINOR__);
18 #endif
19
20 #ifdef _MSC_VER
21 strbuf_addf(info, "MSVC version: %02d.%02d.%05d\n",
22 _MSC_VER / 100, _MSC_VER % 100, _MSC_FULL_VER % 100000);
23 #endif
24
25 if (len == info->len)
26 strbuf_addstr(info, _("no compiler information available\n"));
27 }
28
29 static inline void get_libc_info(struct strbuf *info)
30 {
31 int len = info->len;
32
33 #ifdef __GLIBC__
34 strbuf_addf(info, "glibc: %s\n", gnu_get_libc_version());
35 #endif
36
37 if (len == info->len)
38 strbuf_addstr(info, _("no libc information available\n"));
39 }
40
41 #endif /* COMPILER_H */