This odp_format script applies source file formatting to match the ODP checkpatch style
Signed-off-by: Mike Holmes <mike.hol...@linaro.org> --- scripts/odp_format | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 scripts/odp_format diff --git a/scripts/odp_format b/scripts/odp_format new file mode 100755 index 0000000..192e63d --- /dev/null +++ b/scripts/odp_format @@ -0,0 +1,31 @@ +#!/bin/bash +# This script is a clean up tool for the ODP project source files. +# It will replace the src files with versions that are formatted to match the +# checkpatch rules for ODP. + +set -e + +CLANG_FORMAT=clang-format-3.6 + +if ! type $CLANG_FORMAT >/dev/null ; then + echo "Require $CLANG_FORMAT" + echo "try apt-get install $CLANG_FORMAT" + exit +fi + +if [[ $# -eq 0 ]] +then + echo "No source file paths supplied" + exit +fi + +#work on specified files +while (( "$#" )); do + echo $1 + clang-format-3.6 -i -style=file $1 + #as of version 3.6 a few corner cases slip though so use sed + #to fix them bacasue it uses space where checkpatch wants a tab + sed -i 's/^ /\t/' $1 + sed -i 's/\\ /\\\t/' $1 + shift +done -- 2.1.4 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp