<commit_before>#!/bin/sh

usage(){
	echo "Usage: $0 A [B] -- [cc-args]\n" >&2
	exit 1
}

verbose=0
if [ "$1" = -v ]
then
	verbose=1
	shift
fi

if [ "$1" = '--help' ]
then usage
fi

rmfiles(){
	test -z "$rmfiles" || rm -f $rmfiles
}
rmfiles=
trap rmfiles EXIT

if [ $# -ge 1 ]
then
	if echo "$1" | grep '\.c$' > /dev/null
	then
		in="$1"
		shift
		out="/tmp/chk.out.$$"

		rmfiles="$rmfiles $out"

		if [ $verbose -ne 0 ]
		then echo "$0: ucc -S -o'$out' '$in' $@"
		fi

		# $@ are the optional compiler args
		"$UCC" -S -o"$out" "$in" "$@"
		r=$?
		if [ $r -ne 0 ]
		then exit $r
		fi

		set -- "$out" "$in.layout"
	else
		set -- "$1" "${1}.layout"
	fi
fi

if [ $# -ne 2 ]
then usage
fi

a=/tmp/$$.chk.a
b=/tmp/$$.chk.b
rmfiles="$rmfiles $a $b"

set -e

./layout_normalise.pl "$1" $cc_args | ./layout_sort.pl > $a
./layout_normalise.pl "$2" $cc_args | ./layout_sort.pl > $b

diff -u $b $a<commit_msg>Remove unused args in layout_check<commit_after>#!/bin/sh

usage(){
	echo "Usage: $0 A [B] -- [cc-args]\n" >&2
	exit 1
}

verbose=0
if [ "$1" = -v ]
then
	verbose=1
	shift
fi

if [ "$1" = '--help' ]
then usage
fi

rmfiles(){
	test -z "$rmfiles" || rm -f $rmfiles
}
rmfiles=
trap rmfiles EXIT

if [ $# -ge 1 ]
then
	if echo "$1" | grep '\.c$' > /dev/null
	then
		in="$1"
		shift
		out="/tmp/chk.out.$$"

		rmfiles="$rmfiles $out"

		if [ $verbose -ne 0 ]
		then echo "$0: ucc -S -o'$out' '$in' $@"
		fi

		# $@ are the optional compiler args
		"$UCC" -S -o"$out" "$in" "$@"
		r=$?
		if [ $r -ne 0 ]
		then exit $r
		fi

		set -- "$out" "$in.layout"
	else
		set -- "$1" "${1}.layout"
	fi
fi

if [ $# -ne 2 ]
then usage
fi

a=/tmp/$$.chk.a
b=/tmp/$$.chk.b
rmfiles="$rmfiles $a $b"

set -e

./layout_normalise.pl "$1" | ./layout_sort.pl > $a
./layout_normalise.pl "$2" | ./layout_sort.pl > $b

diff -u $b $a
{'fraction_non_alphanumeric': 0.23294509151414308, 'fraction_numerical': 0.019966722129783693, 'mean_word_length': 2.4893617021276597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '77585', 'n_tokens_mistral': 899, 'n_tokens_neox': 840, 'n_words': 237}