diff options
author | Andrea Fioraldi <andreafioraldi@gmail.com> | 2019-09-03 20:43:11 +0200 |
---|---|---|
committer | Andrea Fioraldi <andreafioraldi@gmail.com> | 2019-09-03 20:43:11 +0200 |
commit | 7151651ea9a87f394cf7f44fcba56cd0d2b7eefa (patch) | |
tree | 18f302c2d67c07deacc5680d8920b7d5e221a8da /.custom-format.py | |
parent | 0d7ecd4327aa4c67a0ddf1807847f9106db07be1 (diff) | |
download | AFLplusplus-7151651ea9a87f394cf7f44fcba56cd0d2b7eefa.tar.gz |
remove macro indentation from code-format
Diffstat (limited to '.custom-format.py')
-rwxr-xr-x | .custom-format.py | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/.custom-format.py b/.custom-format.py index 32b8f7c9..81adbd85 100755 --- a/.custom-format.py +++ b/.custom-format.py @@ -45,31 +45,14 @@ def custom_format(filename): src, _ = p.communicate() src = str(src, "utf-8") - macro_indent = 0 in_define = False last_line = None out = "" for line in src.split("\n"): if line.startswith("#"): - i = macro_indent - if line.startswith("#end") and macro_indent > 0: - macro_indent -= 1 - i -= 1 - elif line.startswith("#el") and macro_indent > 0: - i -= 1 - elif line.startswith("#if") and not (line.startswith("#ifndef") and (line.endswith("_H") or line.endswith("H_"))): - macro_indent += 1 - elif line.startswith("#define"): + if line.startswith("#define"): in_define = True - r = "#" + (i * " ") + line[1:] - if i != 0 and line.endswith("\\"): - r = r[:-1] - while r[-1].isspace() and len(r) != (len(line)-1): - r = r[:-1] - r += "\\" - if len(r) <= COLUMN_LIMIT: - line = r elif "/*" in line and not line.strip().startswith("/*") and line.endswith("*/") and len(line) < (COLUMN_LIMIT-2): cmt_start = line.rfind("/*") |