diff mbox series

[2/3] check-syntax: ignore "bad" astyle versions

Message ID 20241024182424.138616-2-paul@paul-moore.com (mailing list archive)
State New
Delegated to: Ondrej Mosnáček
Headers show
Series [1/3] check-syntax: update arguments for astyle v3.2 (possibly earlier) | expand

Commit Message

Paul Moore Oct. 24, 2024, 6:24 p.m. UTC
Create a list of known bad versions of astyle and ignore them.

Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 tools/check-syntax | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/tools/check-syntax b/tools/check-syntax
index 2775eb46c6c4..c55c51420142 100755
--- a/tools/check-syntax
+++ b/tools/check-syntax
@@ -54,17 +54,26 @@  EOF
 #     1    Source file
 #
 function tool_c_style() {
-	astyle --options=none --lineend=linux --mode=c \
-		--style=linux \
-		--indent=force-tab=8 \
-		--indent-col1-comments \
-		--min-conditional-indent=0 \
-		--max-continuation-indent=80 \
-		--pad-oper \
-		--align-pointer=name \
-		--align-reference=name \
-		--max-code-length=80 \
-		--break-after-logical < "$1"
+	# filter on astyle version
+	case "$(astyle -V)" in
+	"Artistic Style Version 3.6.3")
+		# continuation lines indented vs aligned
+		cat "$1"
+		;;
+	*)
+		astyle --options=none --lineend=linux --mode=c \
+			--style=linux \
+			--indent=force-tab=8 \
+			--indent-col1-comments \
+			--min-conditional-indent=0 \
+			--max-continuation-indent=80 \
+			--pad-oper \
+			--align-pointer=name \
+			--align-reference=name \
+			--max-code-length=80 \
+			--break-after-logical < "$1"
+		;;
+	esac
 }
 
 #