X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fgcov.c;h=c36f69b09da87500ed9654b82234a33544f39bf4;hp=f922d8d97ed1dc5496213d81840305c0d99c5985;hb=d1827b423b5d30c8ecb184a3186d95d9f134f806;hpb=bcb956d9afb054a36c4f481900cdbc6587c4a2bf diff --git a/tools/gcov.c b/tools/gcov.c index f922d8d9..c36f69b0 100644 --- a/tools/gcov.c +++ b/tools/gcov.c @@ -2,16 +2,28 @@ #include #include +const char *gcov; /* = NULL */ + bool run_gcov(const void *ctx, unsigned int *time_ms, char **output, const char *fmt, ...) { + const char *cmd = gcov; char *args; va_list ap; bool rc; + if (!gcov) { +#ifdef __GNUC__ + cmd = "gcov"; +#endif + } + + if (!cmd) + return false; + va_start(ap, fmt); args = tal_vfmt(ctx, fmt, ap); - rc = run_command(ctx, time_ms, output, "gcov %s", args); + rc = run_command(ctx, time_ms, output, "%s %s", cmd, args); tal_free(args); return rc; } @@ -20,6 +32,13 @@ const char *gcov_unavailable(void *ctx) { const char *err = NULL; + /* + * If the user has specified a path, assume they know what + * they're doing + */ + if (gcov) + return NULL; + #ifdef __GNUC__ unsigned int timeleft = default_timeout_ms; char *output;