]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/avoids_cpp_reserved.c
base64: fix for unsigned chars (e.g. ARM).
[ccan] / tools / ccanlint / tests / avoids_cpp_reserved.c
index 72b3604efa45478c4f8d59110d92bc37bca9880a..8e49618023ac814dce9f2faabcede4c077440651 100644 (file)
@@ -1,7 +1,5 @@
 #include <tools/ccanlint/ccanlint.h>
 #include <tools/tools.h>
-#include <ccan/talloc/talloc.h>
-#include <ccan/grab_file/grab_file.h>
 #include <ccan/str/str.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -15,7 +13,7 @@
 #include <string.h>
 #include <ctype.h>
 
-static const char *can_build(struct manifest *m)
+static const char *can_build(struct manifest *m UNNEEDED)
 {
        if (safe_mode)
                return "Safe mode enabled";
@@ -36,7 +34,8 @@ static struct ccan_file *main_header(struct manifest *m)
 }
 
 static void check_headers_no_cpp(struct manifest *m,
-                                unsigned int *timeleft, struct score *score)
+                                unsigned int *timeleft UNNEEDED,
+                                struct score *score)
 {
        char *contents;
        char *tmpsrc, *tmpobj, *cmdout;
@@ -52,7 +51,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"
@@ -85,7 +84,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 <ccan/%s/%s.h>\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);
@@ -94,7 +93,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);
        }