diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-06-21 12:34:26 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-06-21 19:35:06 +0000 |
commit | d99d1b90f84bdf5842281267a77cc7c1334cc67b (patch) | |
tree | eb276887f29a1dd214b0c628cd0ef6c2078006f3 /version_info.c | |
parent | e5abf34f89f62222f641b2f23cfafa2f15949ce5 (diff) |
Add a get_compiler_info() routine in libwsutil to get compiler information.
Change-Id: I8ccb6187f2ee0255460f448aee170768b6fa3f5d
Reviewed-on: https://code.wireshark.org/review/2519
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'version_info.c')
-rw-r--r-- | version_info.c | 77 |
1 files changed, 2 insertions, 75 deletions
diff --git a/version_info.c b/version_info.c index 6403a87fe7..67d4139b76 100644 --- a/version_info.c +++ b/version_info.c @@ -36,6 +36,7 @@ #include <wsutil/unicode-utils.h> #include <wsutil/ws_cpuid.h> #include <wsutil/os_version_info.h> +#include <wsutil/compiler_info.h> #include "version.h" @@ -262,81 +263,7 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *)) get_mem_info(str); /* Compiler info */ - - /* - * See https://sourceforge.net/apps/mediawiki/predef/index.php?title=Compilers - * information on various defined strings. - * - * GCC's __VERSION__ is a nice text string for humans to - * read. The page at sourceforge.net largely describes - * numeric #defines that encode the version; if the compiler - * doesn't also offer a nice printable string, we try prettifying - * the number somehow. - */ -#if defined(__GNUC__) && defined(__VERSION__) - /* - * Clang and llvm-gcc also define __GNUC__ and __VERSION__; - * distinguish between them. - */ -#if defined(__clang__) - g_string_append_printf(str, "\n\nBuilt using clang %s.\n", __VERSION__); -#elif defined(__llvm__) - g_string_append_printf(str, "\n\nBuilt using llvm-gcc %s.\n", __VERSION__); -#else /* boring old GCC */ - g_string_append_printf(str, "\n\nBuilt using gcc %s.\n", __VERSION__); -#endif /* llvm */ -#elif defined(__HP_aCC) - g_string_append_printf(str, "\n\nBuilt using HP aCC %d.\n", __HP_aCC); -#elif defined(__xlC__) - g_string_append_printf(str, "\n\nBuilt using IBM XL C %d.%d\n", - (__xlC__ >> 8) & 0xFF, __xlC__ & 0xFF); -#ifdef __IBMC__ - if ((__IBMC__ % 10) != 0) - g_string_append_printf(str, " patch %d", __IBMC__ % 10); -#endif /* __IBMC__ */ - g_string_append_printf(str, "\n"); -#elif defined(__INTEL_COMPILER) - g_string_append_printf(str, "\n\nBuilt using Intel C %d.%d", - __INTEL_COMPILER / 100, (__INTEL_COMPILER / 10) % 10); - if ((__INTEL_COMPILER % 10) != 0) - g_string_append_printf(str, " patch %d", __INTEL_COMPILER % 10); -#ifdef __INTEL_COMPILER_BUILD_DATE - g_string_sprinta(str, ", compiler built %04d-%02d-%02d", - __INTEL_COMPILER_BUILD_DATE / 10000, - (__INTEL_COMPILER_BUILD_DATE / 100) % 100, - __INTEL_COMPILER_BUILD_DATE % 100); -#endif /* __INTEL_COMPILER_BUILD_DATE */ - g_string_append_printf(str, "\n"); -#elif defined(_MSC_FULL_VER) -# if _MSC_FULL_VER > 99999999 - g_string_append_printf(str, "\n\nBuilt using Microsoft Visual C++ %d.%d", - (_MSC_FULL_VER / 10000000) - 6, - (_MSC_FULL_VER / 100000) % 100); -# if (_MSC_FULL_VER % 100000) != 0 - g_string_append_printf(str, " build %d", - _MSC_FULL_VER % 100000); -# endif -# else - g_string_append_printf(str, "\n\nBuilt using Microsoft Visual C++ %d.%d", - (_MSC_FULL_VER / 1000000) - 6, - (_MSC_FULL_VER / 10000) % 100); -# if (_MSC_FULL_VER % 10000) != 0 - g_string_append_printf(str, " build %d", - _MSC_FULL_VER % 10000); -# endif -# endif - g_string_append_printf(str, "\n"); -#elif defined(_MSC_VER) - /* _MSC_FULL_VER not defined, but _MSC_VER defined */ - g_string_append_printf(str, "\n\nBuilt using Microsoft Visual C++ %d.%d\n", - (_MSC_VER / 100) - 6, _MSC_VER % 100); -#elif defined(__SUNPRO_C) - g_string_append_printf(str, "\n\nBuilt using Sun C %d.%d", - (__SUNPRO_C >> 8) & 0xF, (__SUNPRO_C >> 4) & 0xF); - if ((__SUNPRO_C & 0xF) != 0) - g_string_append_printf(str, " patch %d", __SUNPRO_C & 0xF); - g_string_append_printf(str, "\n"); -#endif + get_compiler_info(str); end_string(str); } |