Merge remote-tracking branch 'redux/master' into sh4-pool
[tamarin-stm.git] / utils / stale
blob0bc79c2481e76a6903a19d7667684beefc905c99
1 #!/bin/sh
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
13 # License.
15 # The Original Code is [Open Source Virtual Machine.].
17 # The Initial Developer of the Original Code is
18 # Adobe System Incorporated.
19 # Portions created by the Initial Developer are Copyright (C) 2005-2006
20 # the Initial Developer. All Rights Reserved.
22 # Contributor(s):
23 # Adobe AS3 Team
25 # Alternatively, the contents of this file may be used under the terms of
26 # either the GNU General Public License Version 2 or later (the "GPL"), or
27 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
40 # check for unused constants
43 echo "Moving some files temporarily "
44 mv -v ../core/ErrorConstants.as ../core/ErrorConstants.a
45 mv -v ../core/ErrorConstants.h ../core/ErrorConstants.ash
47 if [ -f "../core/ErrorConstants.as" ]; then
48 echo "../core/ErrorConstants.as must be temporarily renamed before running this script "
49 exit 1;
51 if [ -f "../core/ErrorConstants.h" ]; then
52 echo "../core/ErrorConstants.h must be temporarily renamed before running this script "
53 exit 1;
56 # hunka big file!
57 echo "Building monster big file for processing"
58 find ../. -name \*.cpp -exec cat {} \; > stale.raw
59 find ../. -name \*.as -exec cat {} \; >> stale.raw
60 find ../. -name \*.h -exec cat {} \; >> stale.raw
62 echo "Restoring files "
63 mv -v ../core/ErrorConstants.a ../core/ErrorConstants.as
64 mv -v ../core/ErrorConstants.ash ../core/ErrorConstants.h
66 echo "Generating constant list"
67 ./avmplus ./errorgen.abc -- stale.xml
69 echo "Searching for unused constants"
70 MISSING=" ";
71 for PATT in `cat stale.lst`
73 grep -Hniq $PATT stale.raw
74 if [ "${?}" != 0 ]; then
75 MISSING=`echo -e $MISSING "\r\n" $PATT`
77 done
79 echo "Removing monster big file "
80 rm stale.raw
81 rm stale.lst
83 echo "Unused : "
85 for CHK in ${MISSING}
87 echo " " $CHK
88 #add some commands here to help you pin down this missing constants
89 done