test_addr.cocci 699 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /// The address of a variable or field is likely always to be non-zero.
  3. ///
  4. // Confidence: High
  5. // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
  6. // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.
  7. // URL: https://coccinelle.gitlabpages.inria.fr/website
  8. // Comments:
  9. // Options: --no-includes --include-headers
  10. virtual org
  11. virtual report
  12. virtual context
  13. @r@
  14. expression x;
  15. position p;
  16. @@
  17. *\(&x@p == NULL \| &x@p != NULL\)
  18. @script:python depends on org@
  19. p << r.p;
  20. @@
  21. cocci.print_main("test of a variable/field address",p)
  22. @script:python depends on report@
  23. p << r.p;
  24. @@
  25. msg = "ERROR: test of a variable/field address"
  26. coccilib.report.print_report(p[0],msg)