devtools: add checks for ABI symbol addition
[dpdk.git] / devtools / check-dup-includes.sh
1 #! /bin/sh -e
2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright 2017 Mellanox Technologies, Ltd
4
5 # Check C files in git repository for duplicated includes.
6 # Usage: devtools/check-dup-includes.sh [directory]
7
8 dir=${1:-$(dirname $(readlink -m $0))/..}
9 cd $dir
10
11 # speed up by ignoring Unicode details
12 export LC_ALL=C
13
14 for file in $(git ls-files '*.[ch]') ; do
15         sed -rn 's,^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*,\1,p' $file |
16         sort | uniq -d |
17         sed "s,^,$file: duplicated include: ,"
18 done