starpu_check_undocumented.sh 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2011-2018 CNRS
  5. # Copyright (C) 2011 Inria
  6. #
  7. # StarPU is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU Lesser General Public License as published by
  9. # the Free Software Foundation; either version 2.1 of the License, or (at
  10. # your option) any later version.
  11. #
  12. # StarPU is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. #
  16. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. #
  18. # Note: expects Coccinelle's spatch command n the PATH
  19. # See: http://coccinelle.lip6.fr/
  20. stcolor=$(tput sgr0)
  21. redcolor=$(tput setaf 1)
  22. greencolor=$(tput setaf 2)
  23. dirname=$(dirname $0)
  24. STARPU_H_FILES=$(find $dirname/../../../include $dirname/../../../mpi/include -name '*.h')
  25. SC_H_FILES=$(find $dirname/../../../sc_hypervisor/include -name '*.h')
  26. SRC="$dirname/../../../src $dirname/../../../mpi/src $dirname/../../../sc_hypervisor/src"
  27. if [ "$1" == "--starpu" ]
  28. then
  29. SC_H_FILES="$0"
  30. shift
  31. else
  32. if [ "$1" == "--sc" ]
  33. then
  34. STARPU_H_FILES="$0"
  35. shift
  36. fi
  37. fi
  38. if [ "$1" == "--func" ] || [ "$1" == "" ] ; then
  39. starpu_functions=$(spatch -very_quiet -sp_file $dirname/starpu_funcs.cocci $STARPU_H_FILES)
  40. sc_functions=$(spatch -very_quiet -sp_file $dirname/sc_funcs.cocci $SC_H_FILES)
  41. for func in $starpu_functions $sc_functions ; do
  42. fname=$(echo $func|awk -F ',' '{print $1}')
  43. location=$(echo $func|awk -F ',' '{print $2}')
  44. x=$(grep "$fname(" $dirname/../chapters/api/*.doxy | grep "\\fn")
  45. if test "$x" == "" ; then
  46. echo "function ${redcolor}${fname}${stcolor} at location ${redcolor}$location${stcolor} is not (or incorrectly) documented"
  47. # else
  48. # echo "function ${greencolor}${fname}${stcolor} at location $location is correctly documented"
  49. fi
  50. done
  51. echo
  52. fi
  53. if [ "$1" == "--struct" ] || [ "$1" == "" ] ; then
  54. starpu_structs=$(grep "struct starpu" $STARPU_H_FILES | grep -v "[;|,|(|)]" | awk '{print $2}')
  55. sc_structs=$(grep "struct sc" $SC_H_FILES | grep -v "[;|,|(|)]" | awk '{print $2}')
  56. for struct in $starpu_structs $sc_structs ; do
  57. x=$(grep -F "\\struct $struct" $dirname/../chapters/api/*.doxy)
  58. if test "$x" == "" ; then
  59. echo "struct ${redcolor}${struct}${stcolor} is not (or incorrectly) documented"
  60. fi
  61. done
  62. echo
  63. fi
  64. if [ "$1" == "--enum" ] || [ "$1" == "" ] ; then
  65. starpu_enums=$(grep "enum starpu" $STARPU_H_FILES | grep -v "[;|,|(|)]" | awk '{print $2}')
  66. sc_enums=$(grep "enum starpu" $SC_H_FILES | grep -v "[;|,|(|)]" | awk '{print $2}')
  67. for enum in $starpu_enums $sc_enums ; do
  68. x=$(grep -F "\\enum $enum" $dirname/../chapters/api/*.doxy)
  69. if test "$x" == "" ; then
  70. echo "enum ${redcolor}${enum}${stcolor} is not (or incorrectly) documented"
  71. fi
  72. done
  73. echo
  74. fi
  75. if [ "$1" == "--macro" ] || [ "$1" == "" ] ; then
  76. 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}' | sort|uniq)
  77. for macro in $macros ; do
  78. x=$(grep -F "\\def $macro" $dirname/../chapters/api/*.doxy)
  79. if test "$x" == "" ; then
  80. echo "macro ${redcolor}${macro}${stcolor} is not (or incorrectly) documented"
  81. fi
  82. done
  83. echo
  84. fi
  85. if [ "$1" == "--var" ] || [ "$1" == "" ] ; then
  86. variables=$(grep -rs -E "(getenv|get_env)" $SRC| tr ' ' '\012'|grep -E "(getenv|get_env)" | grep "\"" | sed 's/.*("//' | sed 's/").*//'|tr -d '",'|sort|uniq)
  87. for variable in $variables ; do
  88. x=$(grep "$variable" $dirname/../chapters/501_environment_variables.doxy | grep "\\anchor")
  89. if test "$x" == "" ; then
  90. echo "variable ${redcolor}${variable}${stcolor} is not (or incorrectly) documented"
  91. fi
  92. done
  93. fi