X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Fccanlint.c;fp=tools%2Fccanlint%2Fccanlint.c;h=1a847deb4c7e326203ba33ca2b5189a58c34bece;hb=0248fa2c84bdf4b5117d2672a68d89505aacae8f;hp=2fdb8863cea9dc79c291518bb89c668a653e80c5;hpb=e0529e15e0c7f9251af5465ef03f208d279affc1;p=ccan diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c index 2fdb8863..1a847deb 100644 --- a/tools/ccanlint/ccanlint.c +++ b/tools/ccanlint/ccanlint.c @@ -46,10 +46,6 @@ bool keep_results = false; static bool targeting = false; static unsigned int timeout; -/* These are overridden at runtime if we can find config.h */ -const char *compiler = NULL; -const char *cflags = NULL; - const char *config_header; const char *ccan_dir; @@ -607,6 +603,7 @@ int main(int argc, char *argv[]) const char *prefix = ""; char *cwd = path_cwd(NULL), *dir; struct dgraph_node all; + const char *override_compiler = NULL, *override_cflags = NULL; /* Empty graph node to which we attach everything else. */ dgraph_init_node(&all); @@ -631,9 +628,9 @@ int main(int argc, char *argv[]) opt_register_arg("-t|--target ", opt_set_target, NULL, &all, "only run one test (and its prerequisites)"); opt_register_arg("--compiler ", opt_set_const_charp, - NULL, &compiler, "set the compiler"); + NULL, &override_compiler, "set the compiler"); opt_register_arg("--cflags ", opt_set_const_charp, - NULL, &cflags, "set the compiler flags"); + NULL, &override_cflags, "set the compiler flags"); opt_register_noarg("-?|-h|--help", opt_usage_and_exit, "\nA program for checking and guiding development" " of CCAN modules.", @@ -668,8 +665,13 @@ int main(int argc, char *argv[]) ccan_dir = find_ccan_dir(dir); if (!ccan_dir) errx(1, "Cannot find ccan/ base directory in %s", dir); - config_header = read_config_header(ccan_dir, &compiler, &cflags, - verbose > 1); + config_header = read_config_header(ccan_dir, verbose > 1); + + /* We do this after read_config_header has set compiler & cflags */ + if (override_cflags) + cflags = override_cflags; + if (override_compiler) + compiler = override_compiler; if (argc == 1) pass = test_module(&all, cwd, "", summary);