X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Favoids_cpp_reserved.c;h=78ba6ca8b87fbecdbd7a23db1593d424f537ae22;hp=68d4ad603b91479db6ff6b34acf35f473a02cf57;hb=dc8042b42500f79f613b1197df6cdf739615a89f;hpb=9aa2e32a540e26d68be9b4c1dbca6a42ef0787c1 diff --git a/tools/ccanlint/tests/avoids_cpp_reserved.c b/tools/ccanlint/tests/avoids_cpp_reserved.c index 68d4ad60..78ba6ca8 100644 --- a/tools/ccanlint/tests/avoids_cpp_reserved.c +++ b/tools/ccanlint/tests/avoids_cpp_reserved.c @@ -1,7 +1,5 @@ #include #include -#include -#include #include #include #include @@ -36,7 +34,6 @@ static struct ccan_file *main_header(struct manifest *m) } static void check_headers_no_cpp(struct manifest *m, - bool keep, unsigned int *timeleft, struct score *score) { char *contents; @@ -44,8 +41,8 @@ static void check_headers_no_cpp(struct manifest *m, int fd; struct ccan_file *mainh = main_header(m); - tmpsrc = maybe_temp_file(m, "-included.c", keep, mainh->fullname); - tmpobj = maybe_temp_file(m, ".o", keep, tmpsrc); + tmpsrc = temp_file(m, "-included.c", mainh->fullname); + tmpobj = temp_file(m, ".o", tmpsrc); /* We don't fail you for this. */ score->pass = true; @@ -53,7 +50,7 @@ static void check_headers_no_cpp(struct manifest *m, if (fd < 0) err(1, "Creating temporary file %s", tmpsrc); - contents = talloc_asprintf(tmpsrc, + contents = tal_fmt(tmpsrc, "#define alignas #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" "#define class #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" "#define constexpr #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" @@ -86,7 +83,7 @@ static void check_headers_no_cpp(struct manifest *m, "#define using #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" "#define virtual #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" "#include \n", - m->basename, m->basename); + m->modname, m->basename); if (write(fd, contents, strlen(contents)) != strlen(contents)) err(1, "writing to temporary file %s", tmpsrc); close(fd); @@ -95,7 +92,7 @@ static void check_headers_no_cpp(struct manifest *m, tmpobj, &cmdout)) { score->score = score->total; } else { - score->error = talloc_asprintf(score, + score->error = tal_fmt(score, "Main header file with C++ names:\n%s", cmdout); }