File indexing completed on 2024-11-24 03:34:30
0001 #!/bin/bash 0002 # 0003 # This script checks if all Marble development headers are really necessary 0004 # as often unnecessary headers get included by accident. 0005 # 0006 # Parameter 1: Directory with Marble development headers 0007 # 0008 # Algorithm: 0009 # - for each marble header: 0010 # - check if it is included in another marble header, 0011 # if it is not included in any other marble header, 0012 # it is perhaps unnecessary 0013 # 0014 marble_include_dir=${1} 0015 #echo Marble include directory: $marble_include_dir 0016 0017 marble_headers=$(find $marble_include_dir -name "*.h") 0018 #echo Marble headers: $marble_headers 0019 0020 for header_path in $marble_headers; do 0021 header_filename=$(basename $header_path) 0022 #echo $header_filename 0023 0024 #echo grep --exclude=$header_filename $header_filename $marble_headers 0025 grep --silent --exclude=$header_filename $header_filename $marble_headers 0026 # grep exit status 0027 # 0 => matches found 0028 # 1 => no matches found 0029 # 2 => error 0030 if [[ $? -eq 1 ]]; then 0031 grep --silent EXPORT $header_path 0032 if [[ $? -eq 1 ]]; then 0033 # class is at least exported 0034 echo >/dev/null 0035 echo not exported, probably unnecessary: $header_filename; 0036 # else 0037 # echo exported, but perhaps unnecessary: $header_filename; 0038 fi; 0039 0040 fi; 0041 done