[PR testsuite/116860] Testsuite adjustment for recently added tests
[official-gcc.git] / gcc / config / aarch64 / check-sve-md.awk
blob8867b571888e674d5f87e2b8cd1d3b52367b5e05
1 #!/usr/bin/awk -f
2 # Copyright (C) 2019-2025 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the
6 # Free Software Foundation; either version 3, or (at your option) any
7 # later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; see the file COPYING3. If not see
16 # <http://www.gnu.org/licenses/>.
18 # This awk script checks that aarch64-sve.md (passed either on the
19 # command line or via stdin) has an up-to-date contents section.
21 BEGIN {
22 seen1 = 0
23 seen2 = 0
24 errors = 0
27 # The headings in the comments use a two-level hierarchy: ";; == ..."
28 # for major sections and ";; ---- ..." for minor sections. Each section
29 # heading must be unique.
31 # The contents section should list all the section headings, using the
32 # same text and in the same order. We should therefore see exactly two
33 # copies of the section list.
34 /^;; == / || /^;; ---- / {
35 if ($0 in seen || seen2 > 0)
37 if (seen2 >= seen1)
39 printf "error: line not in contents: %s\n", $0 > "/dev/stderr"
40 errors += 1
41 exit(1)
43 if ($0 != order[seen2])
45 printf "error: mismatched contents\n saw: %s\nexpected: %s\n", \
46 $0, order[seen2] > "/dev/stderr"
47 errors += 1
48 exit(1)
50 seen2 += 1
52 else
54 seen[$0] = 1
55 order[seen1] = $0
56 seen1 += 1
60 END {
61 if (seen2 < seen1 && errors == 0)
63 printf "error: line only in contents: %s\n", order[seen2] > "/dev/stderr"
64 exit(1)