Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / arch / powerpc / kernel / systbl_chk.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0-or-later
3 #
4 # Just process the CPP output from systbl_chk.c and complain
5 # if anything is out of order.
6 #
7 # Copyright © 2008 IBM Corporation
8 #
9
10 awk     'BEGIN { num = -1; }    # Ignore the beginning of the file
11         /^#/ { next; }
12         /^[ \t]*$/ { next; }
13         /^START_TABLE/ { num = 0; next; }
14         /^END_TABLE/ {
15                 if (num != $2) {
16                         printf "Error: NR_syscalls (%s) is not one more than the last syscall (%s)\n",
17                                 $2, num - 1;
18                         exit(1);
19                 }
20                 num = -1;       # Ignore the rest of the file
21         }
22         {
23                 if (num == -1) next;
24                 if (($1 != -1) && ($1 != num)) {
25                         printf "Error: Syscall %s out of order (expected %s)\n",
26                                 $1, num;
27                         exit(1);
28                 };
29                 num++;
30         }' "$1"