From 48c153ef7fe8888d56ba729e4d7a5859ea117907 Mon Sep 17 00:00:00 2001 From: Maijin Date: Thu, 21 Jan 2021 16:33:03 +0100 Subject: [PATCH] Remove obsolete indent scripts --- sys/clang-analyzer.sh | 47 ---------- sys/indent-whitelist.sh | 100 -------------------- sys/indent.sh | 200 ---------------------------------------- 3 files changed, 347 deletions(-) delete mode 100755 sys/clang-analyzer.sh delete mode 100755 sys/indent-whitelist.sh delete mode 100755 sys/indent.sh diff --git a/sys/clang-analyzer.sh b/sys/clang-analyzer.sh deleted file mode 100755 index de9e562bc4..0000000000 --- a/sys/clang-analyzer.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -CHECKERS="alpha.core.TestAfterDivZero -alpha.core.BoolAssignment -alpha.core.CastToStruct -alpha.core.FixedAddr -alpha.core.IdenticalExpr -alpha.core.PointerArithm -alpha.core.PointerSub -alpha.core.SizeofPtr -alpha.core.TestAfterDivZero -alpha.deadcode.UnreachableCode -alpha.security.ArrayBoundV2 -alpha.security.MallocOverflow -alpha.security.ReturnPtrRange -alpha.security.taint.TaintPropagation -alpha.unix.Chroot -alpha.unix.PthreadLock -alpha.unix.SimpleStream -alpha.unix.cstring.BufferOverlap -alpha.unix.cstring.NotNullTerminated -alpha.unix.cstring.OutOfBounds -security.FloatLoopCounter -" - -for a in ${CHECKERS} ; do - PLUGINS="${PLUGINS} -enable-checker $a" -done - -if [ -z "${MAKE}" ]; then - MAKE=make - gmake --help >/dev/null 2>&1 - [ $? = 0 ] && MAKE=gmake - export MAKE="${MAKE}" -fi -scan-build echo >/dev/null -[ $? = 0 ] || exit 1 - -# find root -cd `dirname $PWD/$0` ; cd .. - -# build -${MAKE} mrproper > /dev/null 2>&1 -rm -rf scan-log -scan-build ./configure --prefix=/usr -scan-build ${PLUGINS} -o ${PWD}/clang-log ${MAKE} -j 4 -echo Check ${PWD}/clang-log diff --git a/sys/indent-whitelist.sh b/sys/indent-whitelist.sh deleted file mode 100755 index 739a845560..0000000000 --- a/sys/indent-whitelist.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh -FILES=" -librz/util/mem.c -librz/util/base64.c -librz/util/name.c -librz/util/idpool.c -librz/util/stack.c -librz/util/slist.c -librz/util/log.c -librz/util/cache.c -librz/util/print.c - -librz/asm/p/asm_bf.c - -librz/hash/calc.c -librz/hash/crc16.c -librz/hash/luhn.c -librz/hash/xxhash.c -librz/hash/md4.c -librz/hash/adler32.c -librz/hash/hash.c -librz/hash/sha2.c - -librz/reg/reg.c -librz/reg/arena.c -librz/reg/double.c -librz/reg/cond.c -librz/reg/value.c -librz/reg/profile.c - -librz/include/r_list.h -librz/include/r_reg.h -librz/include/r_util.h - -librz/analysis/var.c -librz/analysis/fcn.c -librz/analysis/cycles.c -librz/analysis/esil.c -librz/analysis/data.c -librz/analysis/flirt.c -librz/analysis/p/analysis_arc.c - -librz/config/config.c - -librz/fs/fs.c -librz/fs/file.c - -librz/bin/bin.c -librz/bin/bin_write.c -librz/bin/dbginfo.c -librz/bin/filter.c -librz/bin/format/objc/mach0_classes.c - -librz/cons/hud.c -librz/cons/2048.c -librz/cons/utf8.c -librz/cons/grep.c -librz/cons/line.c -librz/cons/canvas.c -librz/cons/editor.c - -librz/core/file.c -librz/core/yank.c -librz/core/blaze.c -librz/core/cmd_egg.c - -shlr/tcc/tccgen.c -shlr/tcc/libtcc.c -shlr/tcc/tccpp.c - -binrz/rizin/rizin.c -binrz/rz_bin/rz_bin.c -binrz/rz_diff/rz_diff.c -binrz/rz_asm/rz_asm.c -binrz/rz_ax/rz_ax.c -" - -chk() { - if [ -z "$2" ]; then - return 0 - fi - echo "$1" | grep -q "$2" -} - -case "$1" in -help|-h) - echo "Usage. sys/indent-whitelist.sh [--fix] [regex]" - ;; ---fix) - for f in $FILES ; do - chk $f $2 || continue - rz-pm -r sys/indent.sh -i $f - done - ;; -*) - for f in $FILES ; do - chk $f $1 || continue - rz-pm -r sys/indent.sh -u $f - done -esac diff --git a/sys/indent.sh b/sys/indent.sh deleted file mode 100755 index d41a2c6332..0000000000 --- a/sys/indent.sh +++ /dev/null @@ -1,200 +0,0 @@ -#!/bin/sh - -# known bugs -# ---------- -# - labels are indented -# - #if 0 code is indented -# - //comment should be // comment - -IFILE="$1" -P=`readlink $0` -[ -z "$P" ] && P="$0" -cd `dirname $P`/.. - -if [ -z "${IFILE}" ]; then - echo "Usage: rz-indent [-a|-i|-u|-c] [file] [...]" - echo " -a indent all whitelisted files" - echo " -i indent in place (modify file)" - echo " -u unified diff of the file" - echo " -c use clang-format" - exit 1 -fi - -if [ "${IFILE}" = - ]; then - cat > /tmp/input - IFILE=/tmp/input -fi - -CWD="$PWD" -INPLACE=0 -ALLWHITE=0 -UNIFIED=0 -ROOTDIR=/ - -UNCRUST=1 - -if [ "${IFILE}" = "-a" ]; then - shift - ALLWHITE=1 - IFILE="$1" - $CWD/sys/indent-whitelist.sh $@ - exit 0 -fi - -if [ "${IFILE}" = "-i" ]; then - shift - INPLACE=1 - IFILE="$1" -fi - -if [ "${IFILE}" = "-u" ]; then - shift - UNIFIED=1 - IFILE="$1" -fi - -if [ "${IFILE}" = "-c" ]; then - shift - UNCRUST=0 - IFILE="$1" -fi - -if [ "`echo $IFILE | cut -c 1`" != / ]; then - IFILE="$OLDPWD/$IFILE" -fi - -if [ "${UNCRUST}" = 1 ]; then - # yell, rather than overwrite an innocent file - command -v uncrustify >/dev/null 2>&1 || { - if ! rz-pm -r type uncrustify >/dev/null 2>&1; then - #echo "This script requires uncrustify to function. Check rz-pm -i uncrustify" - UNCRUST=0 - fi - } -fi -if [ "${UNCRUST}" = 0 ]; then - # yell, rather than overwrite an innocent file - if ! type clang-format >/dev/null 2>&1; then - echo "This script requires clang-format to function" - exit 1 - fi -fi - -indentDirectory() { - D=`dirname "$IFILE"` - for a in "$D/"*.c ; do - IFILE="$a" - ( indentFile ) - done -} - -indentFile() { - if [ ! -f "${IFILE}" ]; then - echo "Cannot find $IFILE" - return - fi - echo "${IFILE}" >&2 - ( - if [ "${UNCRUST}" = 1 ]; then - cp -f .clang-format ${CWD}/.clang-format - cd "$CWD" - rz-pm -r uncrustify -c ${CWD}/doc/uncrustify.cfg -f "${IFILE}" -o .tmp-format - else - D=$(dirname ${IFILE}) - if [ -f "${D}/.clang-format" ]; then - cp -f "${D}/.clang-format" .tmp-clang-format - else - rm -f .tmp-clang-format - fi - cp -f .clang-format ${D}/.clang-format - cd "$CWD" - ( - clang-format "${IFILE}" > .tmp-format - ) - if [ -f "${D}/.tmp-clang-format" ]; then - mv .tmp-clang-format "${D}/.clang-format" - fi - if [ "${D}/.clang-format" != "${CWD}/.clang-format" ]; then - rm -f "${D}/.clang-format" - fi - fi - - # fix ternary conditional indent -# perl -ne 's/ \? /? /g;print' < .tmp-format > .tmp-format2 -# cat .tmp-format2 | perl -ne 's/\r//g;print' | sed -e 's, : ,: ,g' > .tmp-format - mv .tmp-format .tmp-format2 - # do not space before parenthesis on function signatures - awk '{if (/^static/ || /^RZ_API/) { gsub(/ \(/,"("); }; print;}' \ - < .tmp-format2 > .tmp-format - # allow oneliner else statements - mv .tmp-format .tmp-format2 - perl -ne 's/\telse\n[ \t]*/\telse /g;print' < .tmp-format2 | \ - awk '{if (/\telse \t+/) {gsub(/\telse \t+/, "\telse ");} print;}' > .tmp-format - mv .tmp-format .tmp-format2 - perl -ne 's/} else\n[ \t]*/} else /g;print' < .tmp-format2 | \ - awk '{if (/} else \t+/) {gsub(/} else \t+/, "} else ");} print;}' > .tmp-format - # do not place spaces after tabs - #mv .tmp-format .tmp-format2 - #perl -ne 's,\t[ ]+,\t,g;print' < .tmp-format2 > .tmp-format - # drop spaces an multiline backslashes - mv .tmp-format .tmp-format2 - perl -ne 's/[ ]+\\$/\\/g;print' < .tmp-format2 > .tmp-format - # spaces in { brackets - #mv .tmp-format .tmp-format2 - #perl -ne 's/{\s/{ /g;print' < .tmp-format2 > .tmp-format - #perl -ne 's/{([^ \n])/{ \1/g if(!/"/);print' < .tmp-format2 > .tmp-format - # spaces in } brackets - #mv .tmp-format .tmp-format2 - #perl -ne 's/([^ \t])}/$1 }/g if(!/"/);print' < .tmp-format2 > .tmp-format - # _( macro - mv .tmp-format .tmp-format2 - perl -ne 's/_\s\(/_(/g;print' < .tmp-format2 > .tmp-format - # 0xa0 - mv .tmp-format .tmp-format2 - perl -ne 's/[\xa0\xc2]//g;print' < .tmp-format2 > .tmp-format - # remove spaces after #if - #mv .tmp-format .tmp-format2 - #perl -ne 's/#if\ */#if /g;print' < .tmp-format2 > .tmp-format - # add spce after every // - - if [ "$UNIFIED" = 1 ]; then - diff -ru "${IFILE}" .tmp-format - rm .tmp-format - elif [ "$INPLACE" = 1 ]; then - if [ -s .tmp-format ]; then - mv .tmp-format "${IFILE}" - else - rm -f .tmp-format - rm -f .tmp-format2 - rm -f ${CWD}/.clang-format - echo "Syntax error. Not re-indented" - exit 1 - fi - else - cat .tmp-format - rm .tmp-format - fi - rm -f .tmp-format2 - ) -} - -if [ ! -f "${CWD}/.clang-format" ]; then - echo "Cannot find ${CWD}/.clang-format" - exit 1 -fi - -while : ; do - [ "$PWD" = / ] && break - ROOTDIR=$PWD - while : ; do - [ -z "${IFILE}" ] && break - if [ -d "$IFILE" ]; then - indentDirectory "$1" - else - indentFile - fi - shift - IFILE="$1" - done - cd .. -done