diff --git a/check_source/check_style_c.py b/check_source/check_style_c.py index 447d85f2f76f28561f8d2f82c0efec0808e679bc..eb1c0bb932d1a5f210e8cf388fab4234edbc559f 100755 --- a/check_source/check_style_c.py +++ b/check_source/check_style_c.py @@ -812,8 +812,20 @@ def quick_check_indentation(lines): # comment or pre-processor if ls: # #ifdef ... or ... // comment - if (ls[0] == "#" or ls[0:2] == "//"): + if ls[0] == "#": + + # check preprocessor indentation here + # basic rules, NEVER INDENT + # just need to check multi-line macros. + if l[0] != "#": + # we have indent, check previous line + if not ls_prev.rstrip().endswith("\\"): + # report indented line + warning_lineonly("indentation found with preprocessor (expected none or after '#')", i + 1) + skip = True + if ls[0:2] == "//": + skip = true # label: elif (':' in ls and l[0] != '\t'): skip = True