|
9 | 9 | #undef __entry
|
10 | 10 | #define __entry entry
|
11 | 11 |
|
| 12 | +/* |
| 13 | + * Fields should never declare an array: i.e. __field(int, arr[5]) |
| 14 | + * If they do, it will cause issues in parsing and possibly corrupt the |
| 15 | + * events. To prevent that from happening, test the sizeof() a fictitious |
| 16 | + * type called "struct _test_no_array_##item" which will fail if "item" |
| 17 | + * contains array elements (like "arr[5]"). |
| 18 | + * |
| 19 | + * If you hit this, use __array(int, arr, 5) instead. |
| 20 | + */ |
12 | 21 | #undef __field
|
13 |
| -#define __field(type, item) |
| 22 | +#define __field(type, item) \ |
| 23 | + { (void)sizeof(struct _test_no_array_##item *); } |
14 | 24 |
|
15 | 25 | #undef __field_ext
|
16 |
| -#define __field_ext(type, item, filter_type) |
| 26 | +#define __field_ext(type, item, filter_type) \ |
| 27 | + { (void)sizeof(struct _test_no_array_##item *); } |
17 | 28 |
|
18 | 29 | #undef __field_struct
|
19 |
| -#define __field_struct(type, item) |
| 30 | +#define __field_struct(type, item) \ |
| 31 | + { (void)sizeof(struct _test_no_array_##item *); } |
20 | 32 |
|
21 | 33 | #undef __field_struct_ext
|
22 |
| -#define __field_struct_ext(type, item, filter_type) |
| 34 | +#define __field_struct_ext(type, item, filter_type) \ |
| 35 | + { (void)sizeof(struct _test_no_array_##item *); } |
23 | 36 |
|
24 | 37 | #undef __array
|
25 | 38 | #define __array(type, item, len)
|
|
0 commit comments