starpu_check_undocumented.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2011-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  5. #
  6. # StarPU is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License as published by
  8. # the Free Software Foundation; either version 2.1 of the License, or (at
  9. # your option) any later version.
  10. #
  11. # StarPU is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. #
  17. stcolor=$(tput sgr0)
  18. redcolor=$(tput setaf 1)
  19. greencolor=$(tput setaf 2)
  20. dirname=$(dirname $0)
  21. STARPU_H_FILES=$(find $dirname/../../../include $dirname/../../../mpi/include -name '*.h')
  22. SC_H_FILES=$(find $dirname/../../../sc_hypervisor/include -name '*.h')
  23. SRC="$dirname/../../../src $dirname/../../../mpi/src $dirname/../../../sc_hypervisor/src"
  24. if [ "$1" == "--starpu" ]
  25. then
  26. SC_H_FILES="$0"
  27. shift
  28. else
  29. if [ "$1" == "--sc" ]
  30. then
  31. STARPU_H_FILES="$0"
  32. shift
  33. fi
  34. fi
  35. ok()
  36. {
  37. type=$1
  38. name=$2
  39. echo "$type ${greencolor}${name}${stcolor} is (maybe correctly) documented"
  40. }
  41. ko()
  42. {
  43. type=$1
  44. name=$2
  45. echo "$type ${redcolor}${name}${stcolor} is not (or incorrectly) documented"
  46. }
  47. if [ "$1" == "--func" ] || [ "$1" == "" ]
  48. then
  49. for f in $STARPU_H_FILES $SC_H_FILES
  50. do
  51. grep "(" $f | grep ';' | grep starpu | grep '^[a-z]' | grep -v typedef | grep -v '(\*' | while read line
  52. do
  53. x=$(grep -F -B1 "$line" $f | head -1)
  54. fname=$(echo $line | awk -F'(' '{print $1}' | awk '{print $NF}' | tr -d '*')
  55. if test "$x" == '*/'
  56. then
  57. ok function $fname
  58. else
  59. #echo $line
  60. ko function $fname
  61. fi
  62. done
  63. done
  64. fi
  65. if [ "$1" == "--struct" ] || [ "$1" == "" ] ; then
  66. starpu=$(grep "^struct starpu_[a-z_]*$" $STARPU_H_FILES | awk '{print $NF}')
  67. sc=$(grep "^struct sc_[a-z_]*$" $SC_H_FILES | awk '{print $NF}')
  68. for o in $starpu $sc ; do
  69. hfile=$(grep -l "^struct ${o}$" $STARPU_H_FILES $SC_H_FILES)
  70. x=$(grep -B1 "^struct ${o}$" $hfile | head -1)
  71. if test "$x" == '*/'
  72. then
  73. ok "struct" ${o}
  74. else
  75. ko "struct" ${o}
  76. fi
  77. done
  78. echo
  79. fi
  80. if [ "$1" == "--enum" ] || [ "$1" == "" ] ; then
  81. starpu=$(grep "^enum starpu_[a-z_]*$" $STARPU_H_FILES | awk '{print $NF}')
  82. sc=$(grep "^enum sc_[a-z_]*$" $SC_H_FILES | awk '{print $NF}')
  83. for o in $starpu $sc ; do
  84. hfile=$(grep -l "^enum ${o}$" $STARPU_H_FILES $SC_H_FILES)
  85. x=$(grep -B1 "^enum ${o}$" $hfile | head -1)
  86. if test "$x" == '*/'
  87. then
  88. ok "enum" ${o}
  89. else
  90. ko "enum" ${o}
  91. fi
  92. done
  93. echo
  94. fi
  95. if [ "$1" == "--macro" ] || [ "$1" == "" ] ; then
  96. macros=$(grep "define\b" $STARPU_H_FILES $SC_H_FILES |grep -v deprecated|grep "#" | grep -v "__" | sed 's/#[ ]*/#/g' | awk '{print $2}' | awk -F'(' '{print $1}' | grep -i starpu | sort|uniq)
  97. for o in $macros ; do
  98. hfile=$(grep -l "define\b ${o}" $STARPU_H_FILES $SC_H_FILES)
  99. x=$(grep -B1 "define\b ${o}" $hfile | head -1)
  100. if test "$x" == '*/'
  101. then
  102. ok "define" ${o}
  103. else
  104. ko "define" ${o}
  105. fi
  106. done
  107. echo
  108. fi
  109. if [ "$1" == "--var" ] || [ "$1" == "" ] ; then
  110. variables=$(grep -rs -E "(getenv|get_env)" $SRC| tr ' ' '\012'|grep -E "(getenv|get_env)" | grep "\"" | sed 's/.*("//' | sed 's/").*//'|tr -d '",'|sort|uniq)
  111. for variable in $variables ; do
  112. x=$(grep "$variable" $dirname/../chapters/501_environment_variables.doxy | grep "\\anchor")
  113. if test "$x" == "" ; then
  114. ko "variable" $variable
  115. else
  116. ok "variable" $variable
  117. fi
  118. done
  119. fi