1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
#! /bin/bash -eu
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2003-22 Bradley M. Bell
# ----------------------------------------------------------------------------
# bash function that echos and executes a command
echo_eval() {
echo $*
eval $*
}
# -----------------------------------------------------------------------------
if [ "$0" != "bin/check_deprecated.sh" ]
then
echo "bin/check_deprecated.sh: must be executed from its parent directory"
exit 1
fi
if [ "$#" != '0' ]
then
echo 'usage: bin/check_deprecated.sh.sh'
exit 1
fi
# -----------------------------------------------------------------------------
file_list=`git ls-files example speed | sed -e '/example\/deprecated\//d'`
# -----------------------------------------------------------------------------
# deprecated functions with not arguments
list_just_name='
CPPAD_TRACK_
CPPAD_TEST_VECTOR
CppADCreateUnaryBool
CppADCreateDiscrete
zdouble
colpack.star
'
list_namespace='
omp_alloc
cppad_ipopt
'
template_name='
epsilon
'
list_no_argument='
Order
Memory
Size
taylor_size
use_VecAD
size_taylor
capacity_taylor
CompareChange
memory_leak
'
list_one_argument='
nan
Dependent
omp_max_thread
memory_leak
'
list_two_argument='
'
list_three_argument='
'
for file in $file_list
do
for name in $list_just_name
do
if grep "$name" $file > /dev/null
then
echo "$name is deprecated and appreas in $file"
exit 1
fi
done
for name in $list_namespace
do
if grep "[^a-zA-Z_]$name::" $file > /dev/null
then
echo "$name:: is deprecated and appreas in $file"
exit 1
fi
done
for name in $list_namespace
do
if grep "using *$name[^a-zA-Z_]" $file > /dev/null
then
echo "using $name is deprecated and appreas in $file"
exit 1
fi
done
for name in $template_name
do
if grep "[^a-zA-Z_]$name *< *[a-zA-Z_][a-zA-Z_]* *>" $file > /dev/null
then
echo "$name<arg> is deprecated and appreas in $file"
exit 1
fi
done
for fun in $list_no_argument
do
if grep "[^a-zA-Z_]$fun *( *)" $file > /dev/null
then
echo "$fun() is deprecated and appreas in $file"
exit 1
fi
done
for fun in $list_one_argument
do
if sed -e "s|bool *$fun(void)||" $file | \
grep "[^a-zA-Z_]$fun *( *[a-zA-Z_0-9.][a-zA-Z_0-9.]* *)" > /dev/null
then
echo "$fun(arg1) is deprecated and appreas in $file"
exit 1
fi
done
for fun in $list_two_argument
do
if grep "[^a-zA-Z_]$fun *([^,)]*,[^,)]*)" $file > /dev/null
then
echo "$fun(arg1,arg2) is deprecated and appreas in $file"
exit 1
fi
done
for fun in $list_three_argument
do
if grep "[^a-zA-Z_]$fun *([^,)]*,[^,)]*,[^,)]*)" $file > /dev/null
then
echo "$fun(arg1,arg2,arg3) is deprecated and appreas in $file"
exit 1
fi
done
done
# -----------------------------------------------------------------------------
echo 'bin/check_deprecated.sh: OK'
exit 0
|