RFR: 8311043: Remove trailing blank lines in source files
Leo Korinth
lkorinth at openjdk.org
Wed Jun 28 17:04:24 UTC 2023
Remove trailing "blank" lines in source files.
I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files.
The fix removes trailing lines matching ^[[:space:]]*$ in
- *.java
- *.cpp
- *.hpp
- *.c
- *.h
I have applied the following bash script to each file:
file="$1"
while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do
truncate -s -1 "$file"
done
`git diff --ignore-space-change --ignore-blank-lines master` displays no changes
`git diff --ignore-blank-lines master` displays one change
-------------
Commit messages:
- h
- c
- hpp
- cpp
- 8311043: Remove trailing blank lines in source files
Changes: https://git.openjdk.org/jdk/pull/14698/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14698&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8311043
Stats: 4529 lines in 4382 files changed: 0 ins; 4529 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/14698.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14698/head:pull/14698
PR: https://git.openjdk.org/jdk/pull/14698
More information about the hotspot-dev
mailing list