Skip to content

Commit 326a436

Browse files
crondaemonAndersBroman
authored andcommitted
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 <[email protected]> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <[email protected]> Reviewed-by: Anders Broman <[email protected]>
1 parent ef8da8e commit 326a436

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

version_info.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,13 @@ get_compiler_info(GString *str)
328328
#if defined(__clang__)
329329
/*
330330
* We know this isn't clang/C2, as _MSC_FULL_VER isn't defined.
331+
*
332+
* Strip out trailing space from clang's __VERSION__ to be consistent
333+
* with other compilers.
331334
*/
332-
g_string_append_printf(str, "\n\nBuilt using clang %s.\n", __VERSION__);
335+
gchar* version = g_strstrip(g_strdup(__VERSION__));
336+
g_string_append_printf(str, "\n\nBuilt using clang %s.\n", version);
337+
g_free(version);
333338
#elif defined(__llvm__)
334339
/* llvm-gcc */
335340
g_string_append_printf(str, "\n\nBuilt using llvm-gcc %s.\n", __VERSION__);

0 commit comments

Comments
 (0)