aboutsummaryrefslogtreecommitdiff
path: root/tests/c-lint.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-11-08 19:45:53 -0300
committerEuAndreh <eu@euandre.org>2022-11-08 19:45:53 -0300
commit256df54826d6cf0a298b71ebe3a9a463e7a16aef (patch)
treed7ea5a0389380782c8e5f52e0faea1e0992fe27e /tests/c-lint.sh
parentdoc/: Add new manpages as empty files (diff)
downloadremembering-256df54826d6cf0a298b71ebe3a9a463e7a16aef.tar.gz
remembering-256df54826d6cf0a298b71ebe3a9a463e7a16aef.tar.xz
Makefile: Remove rules for C files
Diffstat (limited to 'tests/c-lint.sh')
-rwxr-xr-xtests/c-lint.sh65
1 files changed, 0 insertions, 65 deletions
diff --git a/tests/c-lint.sh b/tests/c-lint.sh
deleted file mode 100755
index 0fa0b01..0000000
--- a/tests/c-lint.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh
-set -eu
-
-awk '
-BEGIN {
- ret = 0
- msg = "function not on the start of the line:"
-}
-
-/^[a-zA-Z0-9_]+ .+\(/ {
- if (ret == 0) {
- print msg
- }
- printf "%s:%s:%s\n", FILENAME, FNR, $0
- ret = 1
-}
-
-END {
- exit ret
-}
-' "$@"
-
-
-awk '
-BEGIN {
- ret = 0
- static = 1
- msg = "non-static function is not declared in a header:"
-}
-
-/^[a-zA-Z0-9_]+\(.*$/ && static == 0 {
- split($0, line, /\(/)
- fn_name = line[1]
- if (fn_name != "main") {
- header = substr(FILENAME, 0, length(FILENAME) - 2) ".h"
- if (system("grep -q ^\"" fn_name "\" \"" header "\"")) {
- if (ret == 0) {
- print msg
- }
- printf "%s:%s:%s\n", FILENAME, FNR, $0
- ret = 1
- }
- }
-}
-
-/^static / {
- static = 1
-}
-
-!/^static / {
- static = 0
-}
-
-END {
- exit ret
-}
-' "$@"
-
-
-RE='[a-z]+\(\) {'
-if grep -Eq "$RE" "$@"; then
- echo 'Functions with no argument without explicit "void" parameter:' >&2
- grep -En "$RE" "$@"
- exit 1
-fi