Re: [cocci] Search for the concatenation of meta variable + fixed string
Markus Elfring <[email protected]>
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
> // The macro automatically concatenates led_status + _show for struct initialization. > static DEVICE_ATTR_RO(led_status); See also: https://elixir.bootlin.com/linux/v6.18/source/include/linux/device.h#L193-L199 > I'd like to find the position of all functions assigned by DEVICE_ATTR_RO. So I thought to use a 1st rule to search for the identifier inside DEVICE_ATTR_RO, then use a 2nd rule to search for the inherited meta variable, concatenated with the fixed string "_show". Like: The source code search idea is reasonable. But the indicated data processing algorithm is improvable. Where would you like to store the identifiers which are passed to calls of the macro “DEVICE_ATTR_RO”? The corresponding data collection can be used to apply subsequent code queries also with the help of regular expressions, can't it? How many computation resources can you invest then? Regards, Markus