starpu_check_public.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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, 2015 CNRS
  7. # Copyright (C) 2011 INRIA
  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. functions=$(spatch -very_quiet -sp_file doc/doxygen/dev/starpu_funcs.cocci $(find include -name '*.h'))
  23. for func in $functions ; do
  24. fname=$(echo $func|awk -F ',' '{print $1}')
  25. location=$(echo $func|awk -F ',' '{print $2}')
  26. x=$(grep -rs "$fname" examples tests mpi starpufft gcc-plugin tools src/sched_policies)
  27. if test "$x" == "" ; then
  28. echo "function ${redcolor}${fname}${stcolor} at location ${redcolor}$location${stcolor} is not used in any examples or tests"
  29. fi
  30. done
  31. echo
  32. structs=$(grep "struct starpu" $(find include -name '*.h') | grep -v "[;|,|(|)]" | awk '{print $2}')
  33. for struct in $structs ; do
  34. x=$(grep -rs "struct $struct" examples tests mpi starpufft gcc-plugin tools src/sched_policies)
  35. if test "$x" == "" ; then
  36. echo "struct ${redcolor}${struct}${stcolor} is not used in any examples or tests"
  37. fi
  38. done
  39. echo
  40. enums=$(grep "enum starpu" $(find include -name '*.h') | grep -v "[;|,|(|)]" | awk '{print $2}')
  41. for enum in $enums ; do
  42. x=$(grep -rs "enum $enum" examples tests mpi starpufft gcc-plugin tools src/sched_policies)
  43. if test "$x" == "" ; then
  44. echo "enum ${redcolor}${enum}${stcolor} is not used in any examples or tests"
  45. fi
  46. done
  47. echo
  48. macros=$(grep "define\b" include/*|grep -v deprecated|grep "#" | grep -v "__" | sed 's/#[ ]*/#/g' | awk '{print $2}' | awk -F'(' '{print $1}' | sort|uniq)
  49. for macro in $macros ; do
  50. x=$(grep -rs "$macro" examples tests mpi starpufft gcc-plugin tools src/sched_policies)
  51. if test "$x" == "" ; then
  52. echo "macro ${redcolor}${macro}${stcolor} is not used in any examples or tests"
  53. fi
  54. done