From bdd65d19e5aa806ec367a6727900d1aabf7fb83d Mon Sep 17 00:00:00 2001 From: Graham Percival Date: Fri, 10 Sep 2010 20:10:15 +0100 Subject: [PATCH] Style: don't break compiling. - Given a "define blah {" line, we *don't* want to move the { to the next line. - given a: = include "foo.h" ; don't move the include onto the = line, or the ; onto the include line. --- scripts/auxiliar/fixcc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/auxiliar/fixcc.py b/scripts/auxiliar/fixcc.py index 3928c60775..b77982e2c6 100755 --- a/scripts/auxiliar/fixcc.py +++ b/scripts/auxiliar/fixcc.py @@ -91,8 +91,8 @@ rules = { # space around +/-; exponent ('([\w\)\]])(\+|-)([_A-Za-z\(])', '\\1 \\2 \\3'), ('([_\dA-Za-df-z\)\]])(\+|-)([\w\(])', '\\1 \\2 \\3'), - # trailing operator - (' (::|&&|\|\||<=|>=|!=|\|=|==|\+=|-=|\*=|/=|\?|<|>|\+|-|=|/|:|&XXX|\||\*XXX)[ \t]*\n([ \t]*)', '\n\\2\\1 '), + # trailing operator, but don't un-trail #include + (' (::|&&|\|\||<=|>=|!=|\|=|==|\+=|-=|\*=|/=|\?|<|>|\+|-|=|/|:|&XXX|\||\*XXX)[ \t]*\n([ \t]*)(?!#include)', '\n\\2\\1 '), # pointer ##('(bool|char|const|delete|int|stream|unsigned|void|size_t|struct \w+|[A-Z]\w*|,|;|&&|<|[^-]>|\|\||-|\+)[ \t]*(\*|&)[ \t]*', '\\1 \\2'), ('(bool|char|const|delete|int|stream|unsigned|void|vsize|size_t|struct \w+|[A-Z]\w*|,|;|:|=|\?\)|&&|<|[^-]>|\|\||-|\+)[ \t]*(\*|&)[ \t]*', '\\1 \\2'), @@ -115,10 +115,10 @@ rules = { ('\n[ \t]*\)', ')'), # dangling comma ('\n[ \t]*,', ','), - # dangling semicolon - ('\n[ \t]*;', ';'), - # brace open - ('(\w)[ \t]*([^\s]*){([ \t]*\n)', '\\1\\2\n{\n'), + # dangling semicolon, but don't un-dangle it onto #include + ('(\n.*\n[ \t]*;)(?!\n#include)', '\\1'), + # brace open, but not changing a #define... line + ('(\w)[ \t]*([^\s]*){([ \t]*\n)(?!#define)', '\\1\\2\n{\n'), # brace open backslash ('(\w[^\n]*){[ \t]*\\\\\n', '\\1\\\n{\\\n'), # brace close -- 2.39.5