* getsyms, getsyms.sed: simple scripts to find #ifdef's that
authorTom Yu <tlyu@mit.edu>
Mon, 19 Jun 1995 05:00:40 +0000 (05:00 +0000)
committerTom Yu <tlyu@mit.edu>
Mon, 19 Jun 1995 05:00:40 +0000 (05:00 +0000)
aren't declared with configure.in

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6089 dc483132-0cff-0310-8789-dd5450dbe970

src/util/ChangeLog
src/util/getsyms [new file with mode: 0644]
src/util/getsyms.sed [new file with mode: 0644]

index 19e5da550b207dbbd8ce0451561b9307dcea487b..92117fa0e4cfa8bcae90f7d4fa222043828dc636 100644 (file)
@@ -1,3 +1,8 @@
+Mon Jun 19 00:58:33 1995  Tom Yu  (tlyu@dragons-lair)
+
+       * getsyms, getsyms.sed: simple scripts to find #ifdef's that
+               aren't declared with configure.in
+
 Fri Jun 16 14:05:03 1995  Tom Yu  (tlyu@dragons-lair)
 
        * libupdate.sh: oops they were right to begin with; hack
diff --git a/src/util/getsyms b/src/util/getsyms
new file mode 100644 (file)
index 0000000..cecdb52
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Run this from the TOP of the source tree!
+M4=gm4
+configs=`find $1 -name configure.in -print|sed -e 's@/configure.in@@`
+for dir in $configs; do
+       AC_MACRODIR=./util/autoconf
+       # The following bits shamelessly stolen from autoheader.sh
+       eval "`$M4 -I$AC_MACRODIR autoheader.m4 $dir/configure.in|
+               sed -n -e '
+               : again
+               /^@@@.*@@@$/s/^@@@\(.*\)@@@$/\1/p
+               /^@@@/{
+                       s/^@@@//p
+                       n
+                       s/^/@@@/
+                       b again
+               }'`"
+       syms="`for sym in $syms; do echo $sym; done | sort | uniq`"
+       echo $dir/configure.in: $syms
+       files="$dir/*.[ch]"
+       for file in $files; do
+               badsyms=""
+               fsyms=`sed -f ./util/getsyms.sed $file`
+               fsyms="`for sym in $fsyms; do echo $sym; done | sort | uniq`"
+               for sym in $fsyms; do
+                       isbad=yes
+                       for tsym in $syms; do
+                               if [ $tsym = $sym ]; then isbad=no; fi
+                       done
+                       if [ $isbad = yes ]; then
+                               badsyms="$badsyms $sym"
+                       fi
+               done
+               echo $file:$badsyms
+       done
+done
diff --git a/src/util/getsyms.sed b/src/util/getsyms.sed
new file mode 100644 (file)
index 0000000..abf305e
--- /dev/null
@@ -0,0 +1,30 @@
+# emulate a C preprocessor (well, sort of)
+y/     / /
+s/  */ /g
+/\/\*/{
+:COMMENT
+N
+y/     / /
+s/  */ /g
+/\*\//!bCOMMENT
+}
+s/\/\*.*\*\///
+/^ *#ifdef/{
+s/^ *#ifdef //
+b
+}
+/^ *#ifndef/{
+s/^ *#ifndef //
+b
+}
+/^ *#if/{
+s/^ *#if//
+s/ *defined *( *\([A-Za-z0-9_]*\) *) */\1 /g
+s/||//g
+s/&&//g
+s/!//g
+s/(//g
+s/)//g
+b
+}
+d