On 20/02/16 15:04, Tom de Vries wrote:
Hi,
this patch adds a script contrib/fix-ChangeLog.sh.
It fixes whitespace issues, and shows ChangeLog lines that look suspicious.
Using the script, I was able to find a stray changelog entry (removed in
rr233583, https://gcc.gnu.org/viewcvs?rev=233583&root=gcc&view=rev ).
And I've
[ slip of the keyboard ]
cleaned up a few ChangeLogs using the script (r233584 - r233587):
ChangeLog, gcc/ChangeLog, gcc/testsuite/ChangeLog, libgomp/ChangeLog.
Any comments?
Thanks,
- Tom
0001-Add-contrib-fix-ChangeLog.sh.patch
Add contrib/fix-ChangeLog.sh
---
contrib/fix-ChangeLog.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/contrib/fix-ChangeLog.sh b/contrib/fix-ChangeLog.sh
new file mode 100755
index 0000000..b09ab83
--- /dev/null
+++ b/contrib/fix-ChangeLog.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+f="$1"
+
+# Make white-space-only lines empty
+sed -i 's/^[ \t]*$//' "$f"
+
+# Remove trailing whitespace
+sed -i 's/[ \t]*$//' "$f"
+
+# Replace 8/16 spaces at start of line with tab(s)
+sed -i 's/^ /\t/' "$f"
+sed -i 's/^ /\t\t/' "$f"
+
+# Replace 1-7 spaces followed by tab at start of line with tab
+sed -i 's/^ \t/\t/' "$f"
+sed -i 's/^ \t/\t/' "$f"
+sed -i 's/^ \t/\t/' "$f"
+sed -i 's/^ \t/\t/' "$f"
+sed -i 's/^ \t/\t/' "$f"
+sed -i 's/^ \t/\t/' "$f"
+sed -i 's/^ \t/\t/' "$f"
+
+# Replace 1-7 spaces at start of line with tab
+sed -i 's/^ /\t/' "$f"
+sed -i 's/^ /\t/' "$f"
+sed -i 's/^ /\t/' "$f"
+sed -i 's/^ /\t/' "$f"
+sed -i 's/^ /\t/' "$f"
+sed -i 's/^ /\t/' "$f"
+sed -i 's/^ /\t/' "$f"
+
+# Remove duplicate empty lines
+sed -i '/^$/N;/^\n$/D' "$f"
+
+# Detect lines that are not allowed.
+# Allowed are:
+# - '^$' : empty line
+# - '^<TAB>' : tab at start of line
+# - '^[a-zA-Z0-9]' : line starting with letter or number
+# - '^<^L>$' : form feed line
+egrep -H -C2 -v '^$|^ |^[a-zA-Z0-9]|^$' "$f"