view lint/lint-rules.sh @ 8:ec2b657edf13

Add explicit lint-comment-style fallthrough annotations. GCC now assumes that if you don't have these you're making a mistake, which is annoying. XXX: This changeset updates the AG output files only (by hand) and is XXX: abusive - rebuilding them will erase the change. However, I need XXX: to get things to build before I can try to get AG to issue the XXX: annotations itself, so this seems like a reasonable expedient.
author David A. Holland
date Mon, 30 May 2022 23:51:43 -0400
parents 13d2b8934445
children
line wrap: on
line source

#!/bin/sh
# lint-rules.sh - generate make rules for lint dir
# usage: lint-rules.sh > rules.mk

if [ $# != 0 ]; then
    echo "$0: usage: $0" 1>&2
    exit 1
fi

SOURCESETS='tool main example'


# generate the lists of sources

for S in $SOURCESETS; do
    if [ ! -f $S.srcs ]; then
	echo "$0: $S.srcs missing - rerun make rules?"
	exit 1
    fi

    echo $S | tr a-z A-Z | awk '{ printf "%sSRCS=\\\n", $1 }'
    sed < $S.srcs 's/^/    /;s/$/ \\/;$s/ \\$//'
    echo
done

for S in $SOURCESETS; do 
    awk < $S.srcs '
    {
	file=$1;
	base=file;
	sub(".*/", "", base);
	base = set "-" base;
	ok = sprintf("$(TOP)/lint/ok/%s.ok", base)

	printf "%s.lint: $(TOP)/%s $(CHECK)\n", base, file;
	printf "\t@echo \"        [CHECK]   %s\"\n", base;
	printf "\t@$(CHECK) --%s \"$(TOP)\" %s > %s.lint\n", set, file, base;
	printf "\n";

	printf "%s.diff: %s.lint %s\n", base, base, ok;
	printf "\t@diff %s %s.lint | tee %s.diff\n", ok, base, base;
	printf "\n";

	printf "all: %s.diff\n", base;
	printf "\n";
    }
    ' "set=$S"
done