From bdac8272d8b1a726012bec897dc51dacbe70b295 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 29 Aug 2022 16:50:49 +1000 Subject: [PATCH] tools: Add note about uncrustify versions. Uncrustify versions are not mutually compatible: 1. Version 0.73 or newer produce slightly different formatting. It may be possible to tweak these by adding more config items, but this will cause older versions to error out with 'Unknown option'. 2. Version 0.75 prints a range of deprecation warnings due to config file changes, and returns a non-zero exit code. These are actually fixable as most are the default value, and pp_indent has changed from 'true' to '1' which is backwards compatible. However issue 1 remains, so probably better to have it fail explicitly. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton --- CODECONVENTIONS.md | 4 ++++ tools/uncrustify.cfg | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CODECONVENTIONS.md b/CODECONVENTIONS.md index 78fb912a6a..bceab74618 100644 --- a/CODECONVENTIONS.md +++ b/CODECONVENTIONS.md @@ -65,6 +65,10 @@ changes to the correct style. Without arguments this tool will reformat all source code (and may take some time to run). Otherwise pass as arguments to the tool the files that changed and it will only reformat those. +**Important**: Use only [uncrustify](https://github.com/uncrustify/uncrustify) +v0.71 or v0.72 for MicroPython. Different uncrustify versions produce slightly +different formatting, and the configuration file formats are often incompatible. + Python code conventions ======================= diff --git a/tools/uncrustify.cfg b/tools/uncrustify.cfg index 221fb458e9..28eb49faf7 100644 --- a/tools/uncrustify.cfg +++ b/tools/uncrustify.cfg @@ -1,5 +1,8 @@ # Uncrustify-0.71.0_f +# IMPORTANT: Output is different if using Uncrustify 0.73 or newer, and config file format has changed in newer versions. +# Use version 0.71 or 0.72 to get matching code formatting. + # # General options #