Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Added a Coccinelle test for NELEM.
Alexandre Perrin committed 12 years ago
commit 178ea4d5250ba3d0ca0702a4a8b71a98f227b371
parent c03111f
1 file changed +31 -0
added tests/cocci/NELEM.cocci
@@ -0,0 +1,31 @@
+
// Use the macro NELEM when possible.
+
// based on: http://coccinelle.lip6.fr/rules/array.html
+
//
+
// Confidence: High
+
// Copyright: (C) Gilles Muller, Julia Lawall, EMN, INRIA, DIKU.  GPLv2.
+
// URL: http://coccinelle.lip6.fr/rules/array.html
+
// Options: -I ... -all_includes can give more complete results
+

+
@@
+
type T;
+
T[] E;
+
@@
+

+
- (sizeof(E)/sizeof(*E))
+
+ NELEM(E)
+

+
@@
+
type T;
+
T[] E;
+
@@
+

+
- (sizeof(E)/sizeof(E[...]))
+
+ NELEM(E)
+

+
@@
+
type T;
+
T[] E;
+
@@
+

+
- (sizeof(E)/sizeof(T))
+
+ NELEM(E)