utf8: don't allow NUL in decoded strings.
[ccan] / tools / ccanlint / tests / tests_helpers_compile.c
index d7c8f0ae75ccd7282c0c39726ee639f04f8a7ee1..0f728fb9420160b7bf852ce8210289056d59a163 100644 (file)
@@ -1,6 +1,5 @@
 #include <tools/ccanlint/ccanlint.h>
 #include <tools/tools.h>
-#include <ccan/talloc/talloc.h>
 #include <ccan/str/str.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -15,7 +14,7 @@
 #include <ctype.h>
 #include "reduce_features.h"
 
-static const char *can_run(struct manifest *m)
+static const char *can_run(struct manifest *m UNNEEDED)
 {
        if (safe_mode)
                return "Safe mode enabled";
@@ -23,20 +22,18 @@ static const char *can_run(struct manifest *m)
 }
 
 static bool compile(struct manifest *m,
-                   bool keep,
                    struct ccan_file *cfile,
                    const char *flags,
                    enum compile_type ctype,
                    char **output)
 {
-       cfile->compiled[ctype] = maybe_temp_file(m, ".o", keep, cfile->fullname);
+       cfile->compiled[ctype] = temp_file(m, ".o", cfile->fullname);
        return compile_object(m, cfile->fullname, ccan_dir, compiler, flags,
                              cfile->compiled[ctype], output);
 }
 
 static void compile_test_helpers(struct manifest *m,
-                                bool keep,
-                                unsigned int *timeleft,
+                                unsigned int *timeleft UNNEEDED,
                                 struct score *score,
                                 const char *flags,
                                 enum compile_type ctype)
@@ -52,7 +49,7 @@ static void compile_test_helpers(struct manifest *m,
        list_for_each(&m->other_test_c_files, i, list) {
                char *cmdout;
 
-               if (!compile(m, keep, i, flags, ctype, &cmdout)) {
+               if (!compile(m, i, flags, ctype, &cmdout)) {
                        errors = true;
                        score_file_error(score, i, 0, "Compile failed:\n%s",
                                         cmdout);
@@ -70,12 +67,10 @@ static void compile_test_helpers(struct manifest *m,
 }
 
 static void do_compile_test_helpers(struct manifest *m,
-                                   bool keep,
                                    unsigned int *timeleft,
                                    struct score *score)
 {
-       compile_test_helpers(m, keep, timeleft, score, cflags,
-                            COMPILE_NORMAL);
+       compile_test_helpers(m, timeleft, score, cflags, COMPILE_NORMAL);
 }
 
 struct ccanlint tests_helpers_compile = {
@@ -88,7 +83,7 @@ struct ccanlint tests_helpers_compile = {
 
 REGISTER_TEST(tests_helpers_compile);
 
-static const char *features_reduced(struct manifest *m)
+static const char *features_reduced(struct manifest *m UNNEEDED)
 {
        if (features_were_reduced)
                return NULL;
@@ -96,16 +91,14 @@ static const char *features_reduced(struct manifest *m)
 }
 
 static void do_compile_test_helpers_without_features(struct manifest *m,
-                                                    bool keep,
                                                     unsigned int *timeleft,
                                                     struct score *score)
 {
        char *flags;
 
-       flags = talloc_asprintf(score, "%s -I.", cflags);
+       flags = tal_fmt(score, "%s %s", cflags, REDUCE_FEATURES_FLAGS);
 
-       compile_test_helpers(m, keep, timeleft, score, flags,
-                            COMPILE_NOFEAT);
+       compile_test_helpers(m, timeleft, score, flags, COMPILE_NOFEAT);
 }
 
 struct ccanlint tests_helpers_compile_without_features = {