From 319dadd4fa7af3f75b15bcb4f33b33f65d87a523 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 19 Jan 2017 08:56:48 +1100 Subject: [PATCH] ccanlint: Correct default coverage tool for clang Currently ccanlint defaults to using "gcov" as the coverage analysis tool for any compiler defining __GNUC__. That's generally correct for the (system default) gcc. However, clang also defines __GNUC__ because it implements the GCC langauge extensions. For clang, "gcov" is not the correct coverage tool (clang does use roughly the gcov format, but unless you're very lucky the system gcc and system clang won't use the same gcov versions). This changes the default coverage tool in the case of clang to the correct "llvm-cov gcov". Signed-off-by: David Gibson --- tools/gcov.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/gcov.c b/tools/gcov.c index c36f69b0..79528c1b 100644 --- a/tools/gcov.c +++ b/tools/gcov.c @@ -13,7 +13,9 @@ bool run_gcov(const void *ctx, unsigned int *time_ms, char **output, bool rc; if (!gcov) { -#ifdef __GNUC__ +#if defined(__clang__) + cmd = "llvm-cov gcov"; +#elif defined(__GNUC__) cmd = "gcov"; #endif } -- 2.39.2