From: Tom Yu Date: Mon, 19 Jun 1995 05:00:40 +0000 (+0000) Subject: * getsyms, getsyms.sed: simple scripts to find #ifdef's that X-Git-Tag: krb5-1.0-beta6~1723 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e2f1559df0d150b4c6990ab69fa1040f540359a4;p=krb5.git * getsyms, getsyms.sed: simple scripts to find #ifdef's that aren't declared with configure.in git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6089 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/ChangeLog b/src/util/ChangeLog index 19e5da550..92117fa0e 100644 --- a/src/util/ChangeLog +++ b/src/util/ChangeLog @@ -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 index 000000000..cecdb5263 --- /dev/null +++ b/src/util/getsyms @@ -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 index 000000000..abf305ea5 --- /dev/null +++ b/src/util/getsyms.sed @@ -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