1*1f5207b7SJohn Levon#!/bin/bash
2*1f5207b7SJohn Levon
3*1f5207b7SJohn Levonfile=$1
4*1f5207b7SJohn Levonproject=$(echo "$2" | cut -d = -f 2)
5*1f5207b7SJohn Levon
6*1f5207b7SJohn Levonif [[ "$file" = "" ]] ; then
7*1f5207b7SJohn Levon    echo "Usage:  $0 <file with smatch messages> -p=<project>"
8*1f5207b7SJohn Levon    exit 1
9*1f5207b7SJohn Levonfi
10*1f5207b7SJohn Levon
11*1f5207b7SJohn Levonif [[ "$project" != "kernel" ]] ; then
12*1f5207b7SJohn Levon    exit 0
13*1f5207b7SJohn Levonfi
14*1f5207b7SJohn Levon
15*1f5207b7SJohn Levonoutfile="kernel.unwind_functions"
16*1f5207b7SJohn Levonbin_dir=$(dirname $0)
17*1f5207b7SJohn Levonremove=$(echo ${bin_dir}/../smatch_data/${outfile}.remove)
18*1f5207b7SJohn Levontmp=$(mktemp /tmp/smatch.XXXX)
19*1f5207b7SJohn Levontmp2=$(mktemp /tmp/smatch.XXXX)
20*1f5207b7SJohn Levon
21*1f5207b7SJohn Levonecho "// list of unwind functions." > $outfile
22*1f5207b7SJohn Levonecho '// generated by `gen_unwind_functions.sh`' >> $outfile
23*1f5207b7SJohn Levongrep "is unwind function" $file | cut -d ' ' -f 2 | cut -d '(' -f 1 >> $tmp
24*1f5207b7SJohn Levoncat $tmp | sort -u > $tmp2
25*1f5207b7SJohn Levonmv $tmp2 $tmp
26*1f5207b7SJohn Levoncat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> $outfile
27*1f5207b7SJohn Levonrm $tmp
28*1f5207b7SJohn Levonecho "Done.  List saved as '$outfile'"
29