summaryrefslogtreecommitdiffstatshomepage
path: root/tools/codeformat.py
diff options
context:
space:
mode:
authorDavid Lechner <david@pybricks.com>2020-03-09 18:09:49 -0500
committerDamien George <damien.p.george@gmail.com>2020-03-11 14:34:40 +1100
commit8a4ce6b79a09510fc5b970f2c019519f47852101 (patch)
tree9359da07f08325a19479e7c5badae358a6b659cf /tools/codeformat.py
parentfccf17521aeec7438785a132434137f266474119 (diff)
downloadmicropython-8a4ce6b79a09510fc5b970f2c019519f47852101.tar.gz
micropython-8a4ce6b79a09510fc5b970f2c019519f47852101.zip
tools/codeformat.py: Eliminate need for sizeof fixup.
This eliminates the need for the sizeof regex fixup by rearranging things a bit. All other bitfields already use the parentheses around expressions with sizeof, so one case is fixed by following this convention. VM_MAX_STATE_ON_STACK is the only remaining problem and it can be worked around by changing the order of the operands.
Diffstat (limited to 'tools/codeformat.py')
-rwxr-xr-xtools/codeformat.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/codeformat.py b/tools/codeformat.py
index f3efb5df75..b3e3d01268 100755
--- a/tools/codeformat.py
+++ b/tools/codeformat.py
@@ -70,10 +70,7 @@ C_EXTS = (
PY_EXTS = (".py",)
-FIXUP_REPLACEMENTS = (
- (re.compile("sizeof\(([a-z_]+)\) \*\(([a-z_]+)\)"), r"sizeof(\1) * (\2)"),
- (re.compile("([0-9]+) \*sizeof"), r"\1 * sizeof"),
-)
+FIXUP_REPLACEMENTS = ((re.compile("sizeof\(([a-z_]+)\) \*\(([a-z_]+)\)"), r"sizeof(\1) * (\2)"),)
def list_files(paths, exclusions=None, prefix=""):