version_info: fix clang output.

Clang's __VERSION__ shows a trailing space. This ends up in a useless
space before the period, that shows a different output from other
compilers. Example:

Built using clang Clang 10.0.0 .
Built using gcc 7.5.0.

Fixed by stripping it in clang only.

Change-Id: I98dfce46b189fc6b2b58950dbb27f69d271bd729
Reviewed-on: https://code.wireshark.org/review/37480
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Dario Lombardo 2020-06-10 22:36:40 +02:00 committed by Anders Broman
parent ef8da8e355
commit 326a43627a
1 changed files with 6 additions and 1 deletions

View File

@ -328,8 +328,13 @@ get_compiler_info(GString *str)
#if defined(__clang__)
/*
* We know this isn't clang/C2, as _MSC_FULL_VER isn't defined.
*
* Strip out trailing space from clang's __VERSION__ to be consistent
* with other compilers.
*/
g_string_append_printf(str, "\n\nBuilt using clang %s.\n", __VERSION__);
gchar* version = g_strstrip(g_strdup(__VERSION__));
g_string_append_printf(str, "\n\nBuilt using clang %s.\n", version);
g_free(version);
#elif defined(__llvm__)
/* llvm-gcc */
g_string_append_printf(str, "\n\nBuilt using llvm-gcc %s.\n", __VERSION__);