]> git.ozlabs.org Git - ccan/blobdiff - tools/depends.c
ccanlint: test for C++ reserved words in headers.
[ccan] / tools / depends.c
index ee39a12f134e4405c98f45f10cefe9fff829752a..16c2a5b3de54bbfe32f963958693fe8c851dfbce 100644 (file)
@@ -13,7 +13,7 @@
 #include <errno.h>
 
 static char ** __attribute__((format(printf, 2, 3)))
-lines_from_cmd(const void *ctx, char *format, ...)
+lines_from_cmd(const void *ctx, const char *format, ...)
 {
        va_list ap;
        char *cmd, *buffer;
@@ -59,10 +59,12 @@ static char *compile_info(const void *ctx, const char *dir)
                return NULL;
 
        ccandir = talloc_dirname(ctx, dir);
-       *strrchr(ccandir, '/') = '\0';
+       if (strrchr(ccandir, '/'))
+               *strrchr(ccandir, '/') = '\0';
 
        compiled = maybe_temp_file(ctx, "", false, "info");
-       if (compile_and_link(ctx, info_c_file, ccandir, "", "", "",
+       if (compile_and_link(ctx, info_c_file, ccandir, "",
+                            CCAN_COMPILER, CCAN_CFLAGS " -I.", "",
                             compiled, &output))
                return compiled;
        return NULL;