From b64fd2a395f99a7d7fc64a277237a8be71b05ffd Mon Sep 17 00:00:00 2001 From: NRK Date: Sat, 1 Jan 2022 16:04:16 +0600 Subject: improve WC_EXTRA_MAKEFILE warning currently if open_default_makefile() finds a standard makefile it will print info message but then warn about the same file being "additional." [nrk mklint master]% ./mklint ./mklint: [info] found standard makefile to use: Makefile (-wmakefile) ./mklint: [warn] found additional standard makefile: Makefile (-wextra-makefile) this makes it so that it doesn't produce warning about the the makefile that it already found as "additional." also declares the default_makefiles pointer as const for good measures. --- mklint.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mklint.c b/mklint.c index aec636e..1c17eea 100644 --- a/mklint.c +++ b/mklint.c @@ -7,7 +7,7 @@ NUSAGE(EXIT_ERROR, "[-f makefile]"); int exit_status = 0; -static const char *default_makefiles[] = { +static const char *const default_makefiles[] = { "makefile", "Makefile" }; @@ -41,9 +41,10 @@ open_default_makefile(const char **pathp) "alternatives are ./makefile and ./Makefile"); find_existing_fallbacks: - for (; i < ELEMSOF(default_makefiles); i++) + for (i++; i < ELEMSOF(default_makefiles); i++) if (!access(default_makefiles[i], F_OK)) - warnf_warning(WC_EXTRA_MAKEFILE, "found additional standard makefile: %s", *pathp); + warnf_warning(WC_EXTRA_MAKEFILE, "found additional standard makefile: %s", + default_makefiles[i]); return fd; } -- cgit v1.2.3-70-g09d2