From 1c0769fdc316a5e2982d8909e713050af223c928 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Mon, 27 Jan 2025 22:32:10 -0700 Subject: GNUmakefile: Pull lint/c, lint/all, and lint/unknown out into separate shell scripts --- build-aux/lint-h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 build-aux/lint-h (limited to 'build-aux/lint-h') diff --git a/build-aux/lint-h b/build-aux/lint-h new file mode 100755 index 0000000..965d7d8 --- /dev/null +++ b/build-aux/lint-h @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# build-aux/lint-h - Lint checks for C header files +# +# Copyright (C) 2024-2025 Luke T. Shumaker +# SPDX-License-Identifier: AGPL-3.0-or-later + +r=0 +for filename in "$@"; do + dscname=$(./build-aux/get-dscname "$filename") + guard=${dscname//'/'/'_'} + guard=${guard//'.'/'_'} + guard="_${guard^^}_" + if ! { grep -Fxq "#ifndef ${guard}" "$filename" && + grep -Fxq "#define ${guard}" "$filename" && + grep -Fxq "#endif /* ${guard} */" "$filename"; }; then + echo "$filename does not have ${guard} guard"; r=1 + fi +done +exit $r -- cgit v1.2.3-2-g168b