blob: c7ac3ed657c482423eb862670ea00467b35cc197 [file] [log] [blame]
Stephen Rothwell0a4690c2008-01-07 16:12:44 +11001#!/bin/sh
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02002# SPDX-License-Identifier: GPL-2.0-or-later
Stephen Rothwell0a4690c2008-01-07 16:12:44 +11003#
4# Just process the CPP output from systbl_chk.c and complain
5# if anything is out of order.
6#
Stephen Rothwellcaa34c92008-01-18 12:06:01 +11007# Copyright © 2008 IBM Corporation
Stephen Rothwell0a4690c2008-01-07 16:12:44 +11008#
Stephen Rothwell0a4690c2008-01-07 16:12:44 +11009
10awk '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) {
Michael Ellerman53da14d2018-04-30 13:27:36 +100016 printf "Error: NR_syscalls (%s) is not one more than the last syscall (%s)\n",
Stephen Rothwell0a4690c2008-01-07 16:12:44 +110017 $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)) {
Michael Ellerman53da14d2018-04-30 13:27:36 +100025 printf "Error: Syscall %s out of order (expected %s)\n",
Stephen Rothwell0a4690c2008-01-07 16:12:44 +110026 $1, num;
27 exit(1);
28 };
29 num++;
30 }' "$1"