qdev: Don't assume existence of parent bus on unparenting
[qemu/opensuse.git] / scripts / check-qerror.sh
blobaf7fbd52490e6ffa45303bee9fc76d241fa52ff9
1 #!/bin/sh
2 # This script verifies that qerror definitions and table entries are
3 # alphabetically ordered.
5 check_order() {
6 errmsg=$1
7 shift
9 # sort -C verifies order but does not print a message. sort -c does print a
10 # message. These options are both in POSIX.
11 if ! "$@" | sort -C; then
12 echo "$errmsg"
13 "$@" | sort -c
14 exit 1
16 return 0
19 check_order 'Definitions in qerror.h must be in alphabetical order:' \
20 grep '^#define QERR_' qerror.h
21 check_order 'Entries in qerror.c:qerror_table must be in alphabetical order:' \
22 sed -n '/^static.*qerror_table\[\]/,/^};/s/QERR_/&/gp' qerror.c