Stephen Rothwell | 0a4690c | 2008-01-07 16:12:44 +1100 | [diff] [blame] | 1 | #!/bin/sh |
Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 2 | # SPDX-License-Identifier: GPL-2.0-or-later |
Stephen Rothwell | 0a4690c | 2008-01-07 16:12:44 +1100 | [diff] [blame] | 3 | # |
| 4 | # Just process the CPP output from systbl_chk.c and complain |
| 5 | # if anything is out of order. |
| 6 | # |
Stephen Rothwell | caa34c9 | 2008-01-18 12:06:01 +1100 | [diff] [blame] | 7 | # Copyright © 2008 IBM Corporation |
Stephen Rothwell | 0a4690c | 2008-01-07 16:12:44 +1100 | [diff] [blame] | 8 | # |
Stephen Rothwell | 0a4690c | 2008-01-07 16:12:44 +1100 | [diff] [blame] | 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) { |
Michael Ellerman | 53da14d | 2018-04-30 13:27:36 +1000 | [diff] [blame] | 16 | printf "Error: NR_syscalls (%s) is not one more than the last syscall (%s)\n", |
Stephen Rothwell | 0a4690c | 2008-01-07 16:12:44 +1100 | [diff] [blame] | 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)) { |
Michael Ellerman | 53da14d | 2018-04-30 13:27:36 +1000 | [diff] [blame] | 25 | printf "Error: Syscall %s out of order (expected %s)\n", |
Stephen Rothwell | 0a4690c | 2008-01-07 16:12:44 +1100 | [diff] [blame] | 26 | $1, num; |
| 27 | exit(1); |
| 28 | }; |
| 29 | num++; |
| 30 | }' "$1" |