From: Matthias Maier Date: Sun, 27 May 2018 09:28:39 +0000 (-0500) Subject: Bugfix: Use a different sentinel in indent X-Git-Tag: v9.1.0-rc1~1092^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=531cffe4fc38f589f9101e6919a880e1722d0115;p=dealii.git Bugfix: Use a different sentinel in indent We cannot simply replace the escaped closing bracket "\}" by "} //" any more. clang-format happily fixes the apparent misspelling into namespace Foobar { } // namespace Foobar --- diff --git a/contrib/utilities/indent b/contrib/utilities/indent index f09166a19d..d7778cb825 100755 --- a/contrib/utilities/indent +++ b/contrib/utilities/indent @@ -96,19 +96,22 @@ find tests include source examples \ xargs -0 -n 1 -P 10 -I {} bash -c 'dos_to_unix "$@"' _ {} # -# format .inst.in files. We need to replace \{ and \} because it confuses -# clang-format +# format .inst.in files. We need to replace \{ and \} by a sentinel because +# clang-format happily strips away the backslash. Further, there is a minor +# caveat: clang-format automatically renames a comment after a closing +# bracket for a namespace to "} // namespace FooBar". Thus use "namespace" +# as keyword: # format_inst() { f=$1 cp "$f" "$f.tmp" - sed -i.orig 's#\\{#{ //#g' "$f.tmp" - sed -i.orig 's#\\}#} //#g' "$f.tmp" + sed -i.orig 's#\\{#{ // namespace#g' "$f.tmp" + sed -i.orig 's#\\}#} // namespace#g' "$f.tmp" clang-format -i "$f.tmp" - sed -i.orig 's#{ //#\\{#g' "$f.tmp" - sed -i.orig 's#} //#\\}#g' "$f.tmp" + sed -i.orig 's#{ // namespace#\\{#g' "$f.tmp" + sed -i.orig 's#}[ ]*// namespace.*#\\}#g' "$f.tmp" if ! diff -q "$f" "$f.tmp" >/dev/null then cp "$f.tmp" "$f"