1#!/bin/bash
2
3file=$1
4project=$(echo "$2" | cut -d = -f 2)
5
6if [[ "$file" = "" ]] ; then
7    echo "Usage:  $0 <file with smatch messages> -p=<project>"
8    exit 1
9fi
10
11if [[ "$project" != "kernel" ]] ; then
12    exit 0
13fi
14
15bin_dir=$(dirname $0)
16remove=$(echo ${bin_dir}/../smatch_data/kernel.puts_argument.remove)
17tmp=$(mktemp /tmp/smatch.XXXX)
18
19echo "// list of functions and the argument they decrement the ref of." > kernel.puts_argument
20echo '// generated by `gen_puts_list.sh`' >> kernel.puts_argument
21grep -w puts_arg $file | cut -d ' ' -f 5- >> $tmp
22cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> kernel.puts_argument
23rm $tmp
24echo "Done.  List saved as 'kernel.puts_argument'"
25
26