Commit Graph

8 Commits

Author SHA1 Message Date
Rusty Russell 186b895440 tools/check-includes.sh: make shellcheck happy.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-12-06 10:05:39 +10:30
Rusty Russell 4ffda340d3 check: make sure all files outside contrib/ include "config.h" first.
And turn "" includes into full-path (which makes it easier to put
config.h first, and finds some cases check-includes.sh missed
previously).

config.h sets _GNU_SOURCE which really needs to be done before any
'#includes': we mainly got away with it with glibc, but other platforms
like Alpine may have stricter requirements.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-12-06 10:05:39 +10:30
Rusty Russell 00a0d09340 tools/check-includes.sh: test that c files include their .h files.
This is best-practice (to ensure prototypes match up), but there were a
few places we didn't (at least, directly).  Make it a requirement,
either of form "foo.h" or <dir/foo.h>.

The noise is the change to our print templates.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-17 09:43:22 +09:30
Rusty Russell 06a54606a3 check-includes: allow redundant "config.h"
We should actually be including this (as it may define _GNU_SOURCE
etc) before any system headers.  But where we include <assert.h> we
often didn't, because check-includes would complain that the headers
included it too.

Weaken that check, and include config.h in C files before assert.h.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-02-04 12:02:36 +10:30
Rusty Russell fbb494fba3 devtools/create-gossipstore: clean up enough to pass check-source.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-08 04:41:43 +00:00
William Casarin f8fa4213f1 tools: use /usr/bin/env bash instead of /bin/bash
These commands fail on systems that do not have bash under /bin

Signed-off-by: William Casarin <jb55@jb55.com>
2018-07-24 00:25:43 +00:00
Jan Sarenik 9f519afc5d tools/check-includes.sh: shellcheck recommended fixes
$ shellcheck --version
    ShellCheck - shell script analysis tool
    version: 0.5.0
    license: GNU General Public License, version 3
    website: https://www.shellcheck.net
    $ make check-source
    ...

    In tools/check-includes.sh line 14:
        if [[ $(grep -cE "^#((ifndef|define) ${HEADER_ID}|endif /\* ${HEADER_ID} \*/)$" "${HEADER_FILE}") != 3 ]]; then
                                                                 ^-- SC1117: Backslash is literal in "\*". Prefer explicit escaping: "\\*".

    In tools/check-includes.sh line 28:
        git ls-files | grep -v 'ccan/' | grep -E "\.${1}"'$'
                                                  ^-- SC1117: Backslash is literal in "\.". Prefer explicit escaping: "\\.".
2018-07-04 01:48:21 +00:00
practicalswift e078fcefdd Add check-includes.sh: Find redundant includes. Check ifndef:s. 2018-03-25 23:54:21 +00:00