Project

General

Profile

Feature #7627 ยป fix_clang_errors.sh

Vadim Mutilin, 11/18/2016 04:48 PM

 
#!/bin/bash
SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname $SCRIPT`
AWKCMD=$SCRIPTPATH/"fix_main.awk"
INPUT=$1
sed -i '/^extern int ( \/\* missing proto \*\/ __builtin_unreachable)() ;/d' $INPUT
if [ $? != 0 ]
then
exit 1;
fi

sed -i 's/void main(void) ;/int main(void) ;/g' $INPUT
if [ $? != 0 ]
then
exit 1;
fi

sed -i 's/void main(void)/int main(void)/g' $INPUT
if [ $? != 0 ]
then
exit 1;
fi

sed -i 's/\b__builtin_trap/ldv__builtin_trap/g' $INPUT
if [ $? != 0 ]
then
exit 1;
fi
sed -i 's/\b__builtin_expect/ldv__builtin_expect/g' $INPUT
if [ $? != 0 ]
then
exit 1;
fi

sed -i '/^int __builtin_bswap32(int ) ;/d' $INPUT
if [ $? != 0 ]
then
exit 1;
fi

sed -i '/^long __builtin_bswap64(long ) ;/d' $INPUT
if [ $? != 0 ]
then
exit 1;
fi

sed -i 's/\b__builtin_va_start/ldv__builtin_va_start/g' $INPUT
if [ $? != 0 ]
then
exit 1;
fi
sed -i 's/\b__builtin_va_end/ldv__builtin_va_end/g' $INPUT
if [ $? != 0 ]
then
exit 1;
fi

sed -i '/^unsigned long __builtin_object_size(void \* , int ) ;/d' $INPUT
if [ $? != 0 ]
then
exit 1;
fi

# RETURN=`awk -f $AWKCMD $INPUT`
# if [ $? != 0 ]
# then
# exit 1;
# fi
# if [ $RETURN ]
# then
# echo "Change return $RETURN";
# sed -i "$RETURN"'s/.*/return 0;/' $INPUT
# if [ $? != 0 ]
# then
# exit 1;
# fi
# fi

    (1-1/1)