Mentions légales du service

Skip to content

Skip nested code when searching for function start

LAWALL Julia requested to merge skip_nest into master

SmPL does not require the user to specify the return type of a function definition. This is convenient for users, but a nuisance for parsing. Some heuristics are used to find the start of a function definition or a function prototype, whether or not a return type is specified. These heuristics rely on the fact that the name part of a function definition never follows a variety of characters, such as = or :. For a bit of extra security, this patch furthermore doesn't look for such names inside braces, square brackets, or parentheses.

Note that at least in + code, a new function definition does not necessarily appear at the start of a SmPL rule, as a SmPL rule can add a new function definition after an existing one. This implies that it is necessary to traverse all of the tokens, eg it is not possible to simply stop when an open brace is encountered.

Reported-by: Markus Elfring Markus.Elfring@web.de

Merge request reports