1#!/bin/bash
2
3# Copyright 2020-2023 The Khronos Group Inc.
4# SPDX-License-Identifier: Apache-2.0
5
6# scripts/ci/check_undefined
7# Check for non-tagged 'undefined' in spec sources.
8# Skip appendices/VK* files, which are non-normative.
9# Ideally we would skip NOTES too, but that would require parsing.
10
11undefined=/tmp/undefined
12ls chapters/*.adoc chapters/*/*.adoc appendices/[A-UW-Za-z]*.adoc | \
13    xargs egrep -E '(^|[[:space:]])undefined($|[^:])' > $undefined
14if test `cat $undefined | wc -l` -gt 0 ; then
15    echo "*** Found un-tagged uses of 'undefined'"
16    cat $undefined
17    rm $undefined
18    exit 1
19else
20    rm $undefined
21    exit 0
22fi
23