starpu_check_undocumented.sh 3.3 KB

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