mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
550e141c59
When a inline function was declared in a file, we would find the declaration and remove the function body. However, since it is a declaration, there is NO function body, so we were deleting a random piece of code that was between square brackets in the file. To properly handle this, we have to detect if we are dealing with a function declaration or a function definition. If we are dealing with a function declaration, a semicolon will come BEFORE the first square bracket. If we are dealing with a function definition, a square bracket will come BEFORE the first semicolon (the first semicolon will be in the inline function body, so between the square brackets). So we determine the location of the first semicolon and the first square bracket after the function name and apply the logic described above to handle function declarations. If we are dealing with a function declaration, we don't do anything, we just move to the next match. This will result in redeclarations of the inline function, but this is allowed in C and I'd rather not touch the file anymore than necessary.