source: utils/header_checker.sh @ 1239:916f255c2aac

Revision 1239:916f255c2aac, 894 bytes checked in by niam, 3 years ago (diff)

check for directives.h in *cc

  • Property exe set to *
Line 
1#!/bin/bash
2
3src=(trunk/include/libdodo trunk/src)
4
5##
6## Check for header description and #ifndef/#define file protector mark
7##
8for i in ${src[*]}
9do
10        pushd $i
11
12        for j in *h *cc
13        do
14                if [[ ! -f $j ]]
15                then
16                        continue
17                fi
18
19                file=$(sed -n "2p;2q" $j)
20                grep -q "$j" < <(echo $file)
21                if [[ $? -ne 0 ]]
22                then
23                        echo "${j}: header file do not match: $file"
24                fi
25
26                if [[ "$j" == "${j%.cc}" ]]
27                then
28                        directive=$(echo ${j//./_} | awk '{ print "_" toupper($1) "_"}')
29                        grep -q $directive $j
30                        if [[ $? -ne 0 ]]
31                        then
32                                echo "${j}: header file do not match: $directive"
33                        fi
34                fi
35        done
36
37        popd
38done
39
40##
41## Check for files that do not include directives.h
42##
43pushd trunk/src
44wo_direcites=$(uniq -u < <(sort <(grep -l directives.h *cc *inline) <(ls -1)))
45if [[ -n "$wo_direcites" ]]
46then
47        echo "Source files that do not contain directives.h inclusion:"
48        echo $wo_direcites
49fi
50popd
Note: See TracBrowser for help on using the repository browser.