Nothing to complain about. Instead, I got a BRACEPOS warning.
It excludes an opening brace if the line directly above it is a preprocessor directive starting with #. It should probably also exclude an opening brace if every line starting with the second one above ends with a \ until one starts with a #? I don't know how to nicely express that in perl though...
I believe the right approach is to filter away preprocessor directives before the code is checked. But then we still need to allow certain "bending of the rules" when there are preprocessor instructions mixed with code...
I have a fix that I believe works at least for this case, but when working on this I also started to feel the need to add dedicated tests for checksrc so that we know that fixing a problem doesn't break old behavior or introduced new bugs... But I realize I need to put "checksrc tests" as a separate item/PR...
In order to check the actual code better, checksrc now ignores
everything that look like preprocessor instructions.
Note that some rules then still don't need to be followed when code is
exactly below a cpp instruction.
Reported-by: Marcel Raad
Fixes#7863
I did this
Run checksrc.pl on this code:
MarcelRaad@7de0894
I expected the following
Nothing to complain about. Instead, I got a BRACEPOS warning.
It excludes an opening brace if the line directly above it is a preprocessor directive starting with
#
. It should probably also exclude an opening brace if every line starting with the second one above ends with a\
until one starts with a#
? I don't know how to nicely express that in perl though...curl/libcurl version
N/A, checksrc.pl @ 2f0bb86
operating system
Ubuntu
The text was updated successfully, but these errors were encountered: