starpu_check_register.cocci 791 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. @initialize:python@
  2. handles = {}
  3. @select@
  4. position p;
  5. identifier f =~ "^starpu_.*_data_register$";
  6. identifier e;
  7. @@
  8. <...
  9. f@p( &e, ... );
  10. ...>
  11. @script:python@
  12. p << select.p;
  13. f << select.f;
  14. e << select.e;
  15. @@
  16. s = "%s(%s),%s:%s" % (f,e,p[0].file,p[0].line)
  17. # hack: 'clean' the string e from unwanted non printing characters, otherwise 'e' in select rule does not match 'e' in check rule
  18. e = "%s" % e
  19. handles[e]=s
  20. @check@
  21. position p;
  22. identifier select.e;
  23. @@
  24. <...
  25. starpu_data_unregister@p( e );
  26. ...>
  27. @script:python@
  28. e << select.e;
  29. p << check.p;
  30. @@
  31. # hack: position p must be defined in the check rule even though it is not used, otherwise the 'check' python script is not run
  32. e = "%s" % e
  33. if e in handles:
  34. del handles[e]
  35. @finalize:python@
  36. for s in handles.values():
  37. print s