#include <tools/ccanlint/ccanlint.h>
#include <tools/tools.h>
-#include <ccan/talloc/talloc.h>
#include <ccan/str/str.h>
#include <ccan/foreach/foreach.h>
#include <sys/types.h>
char *output;
if (!run_command(m, &timeleft, &output, "gcov -h"))
- return talloc_asprintf(m, "No gcov support: %s", output);
+ return tal_fmt(m, "No gcov support: %s", output);
return NULL;
#else
return "No coverage support for this compiler";
#endif
}
+static char *cflags_list(const struct manifest *m)
+{
+ unsigned int i;
+ char *ret = tal_strdup(m, cflags);
+
+ char **flags = get_cflags(m, m->dir, get_or_compile_info);
+ for (i = 0; flags[i]; i++)
+ tal_append_fmt(&ret, " %s", flags[i]);
+ return ret;
+}
+
+static char *cflags_list_append(const struct manifest *m, char *iflags)
+{
+ unsigned int i;
+
+ char **flags = get_cflags(m, m->dir, get_or_compile_info);
+ for (i = 0; flags[i]; i++)
+ tal_append_fmt(&iflags, " %s", flags[i]);
+ return iflags;
+}
+
static void cov_compile(const void *ctx,
unsigned int time_ms,
struct manifest *m,
struct ccan_file *file,
bool link_with_module)
{
- char *flags = talloc_asprintf(ctx, "%s %s", cflags, COVERAGE_CFLAGS);
+ char *flags = tal_fmt(ctx, "%s %s", cflags, COVERAGE_CFLAGS);
+ flags = cflags_list_append(m, flags);
file->compiled[COMPILE_COVERAGE] = temp_file(ctx, "", file->fullname);
compile_and_link_async(file, time_ms, file->fullname, ccan_dir,
struct ccan_file *i;
struct list_head *h;
bool ok;
- char *f = talloc_asprintf(score, "%s %s", cflags, COVERAGE_CFLAGS);
+ char *f = cflags_list(m);
+ tal_append_fmt(&f, " %s", COVERAGE_CFLAGS);
/* For API tests, we need coverage version of module. */
if (!list_empty(&m->api_tests)) {
build_objects(m, score, f, COMPILE_COVERAGE);
if (!score->pass) {
- score->error = talloc_strdup(score,
+ score->error = tal_strdup(score,
"Failed to compile module objects with coverage");
return;
}