starpu_check_register.cocci 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // StarPU --- Runtime system for heterogeneous multicore architectures.
  2. //
  3. // Copyright (C) 2011 INRIA
  4. //
  5. // StarPU is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU Lesser General Public License as published by
  7. // the Free Software Foundation; either version 2.1 of the License, or (at
  8. // your option) any later version.
  9. //
  10. // StarPU is distributed in the hope that it will be useful, but
  11. // WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. //
  14. // See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. @initialize:python@
  16. handles = {}
  17. @select@
  18. position p;
  19. identifier f =~ "^starpu_.*_data_register$";
  20. identifier e;
  21. @@
  22. <...
  23. f@p( &e, ... );
  24. ...>
  25. @script:python@
  26. p << select.p;
  27. f << select.f;
  28. e << select.e;
  29. @@
  30. s = "%s(%s),%s:%s" % (f,e,p[0].file,p[0].line)
  31. # hack: 'clean' the string e from unwanted non printing characters, otherwise 'e' in select rule does not match 'e' in check rule
  32. e = "%s" % e
  33. handles[e]=s
  34. @check@
  35. position p;
  36. identifier select.e;
  37. @@
  38. <...
  39. starpu_data_unregister@p( e );
  40. ...>
  41. @script:python@
  42. e << select.e;
  43. p << check.p;
  44. @@
  45. # hack: position p must be defined in the check rule even though it is not used, otherwise the 'check' python script is not run
  46. e = "%s" % e
  47. if e in handles:
  48. del handles[e]
  49. @finalize:python@
  50. for s in handles.values():
  51. print s