diff options
author | NRK <nrk@disroot.org> | 2022-01-01 16:04:16 +0600 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-01 11:32:49 +0100 |
commit | b64fd2a395f99a7d7fc64a277237a8be71b05ffd (patch) | |
tree | dcbac27f93fd90e82563adb10dc9d23c4b5c1494 | |
parent | Rename to mklint to avoid confusion with pre-existing tool with opposite goal (diff) | |
download | makel-b64fd2a395f99a7d7fc64a277237a8be71b05ffd.tar.gz makel-b64fd2a395f99a7d7fc64a277237a8be71b05ffd.tar.bz2 makel-b64fd2a395f99a7d7fc64a277237a8be71b05ffd.tar.xz |
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.
-rw-r--r-- | mklint.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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; } |