^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /// The address of a variable or field is likely always to be non-zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ///
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) // Confidence: High
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) // URL: http://coccinelle.lip6.fr/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) // Comments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) // Options: --no-includes --include-headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) virtual org
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) virtual report
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) virtual context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) @r@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) expression x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) statement S1,S2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) position p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) *if@p (&x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) S1 else S2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) @script:python depends on org@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) p << r.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) cocci.print_main("test of a variable/field address",p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) @script:python depends on report@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) p << r.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) msg = "ERROR: test of a variable/field address"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) coccilib.report.print_report(p[0],msg)