m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Generating a list of defined but unused macros


From: john
Subject: Generating a list of defined but unused macros
Date: Fri, 3 Feb 2006 10:13:28 -0500

Brian writes:
 > I've tried, unsuccessfully, to list out unused macros in my acsite.m4 used
 > in the autotools. There is probably an easy way to do this but I'm not all
 > that familiar with m4.Any help would be appreciated
 > 
 > 
 > Here was my latest unsuccessful attempt:
 > 
 > unused:
 > >         @ if [ -e /tmp/unused_macros.log ]; then rm -f
 > > /tmp/unused_macros.log; fi
 > >         @ m4 -dta -R/usr/share/autoconf/autoconf/autoconf.m4f `ls *.m4`
 > > -o/tmp/unused_macros.log
 > >         @ grep AC_DEFUN /tmp/unused_macros.log | sed -r
 > > 's/m4trace:.*AC_DEFUN\(([A-Z_]*),\s|$|./\1/g' | sort | uniq >
 > > /tmp/unused_macros.log
 > >         @ cat *.m4 | grep AC_DEFUN | sed -r
 > > 's/.*AC_DEFUN\(\[(.*)\]\,.*/\1/' >> /tmp/unused_macros.log
 > >         @ echo Unused macros: "`cat /tmp/unused_macros.log | tr "\n" "\\n
 > > " | sort | uniq -u`"
 > >

Brian,
Depending on what shell you use,  doing 

  grep FILE | ... > FILE

will erase the contents of FILE before grep gets a chance to read it.

John B.


 > >
 > --
 > Brian Mingus
 > AIM, Skype: BReflection
 > Google talk: address@hidden
 > Phone: (720) 771-2599
 > I've tried, unsuccessfully, to list out unused macros in my acsite.m4
 > used in the autotools. There is probably an easy way to do this but I'm
 > not all that familiar with m4.Any help would be appreciated <br>
 > <br>
 > <br>
 > Here was my latest unsuccessful attempt:<br>
 > <br>
 > <blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 
 > 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">unused:<br>
 > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @ if [ -e /tmp/unused_macros.log 
 > ]; then rm -f /tmp/unused_macros.log; fi<br>
 > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @ m4 -dta
 > -R/usr/share/autoconf/autoconf/autoconf.m4f `ls *.m4`
 > -o/tmp/unused_macros.log<br>
 > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @ grep AC_DEFUN
 > /tmp/unused_macros.log | sed -r
 > 's/m4trace:.*AC_DEFUN\(([A-Z_]*),\s|$|./\1/g' | sort | uniq &gt;
 > /tmp/unused_macros.log<br>
 > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @ cat *.m4 | grep AC_DEFUN |
 > sed -r 's/.*AC_DEFUN\(\[(.*)\]\,.*/\1/' &gt;&gt; /tmp/unused_macros.log<br>
 > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @ echo Unused macros: &quot;`cat
 > /tmp/unused_macros.log | tr &quot;\n&quot; &quot;\\n &quot; | sort | uniq 
 > -u`&quot;<br>
 >   <br>
 > </blockquote>
 > <br>-- <br>Brian Mingus<br>AIM, Skype: BReflection<br>Google talk: <a 
 > href="mailto:address@hidden";>address@hidden</a><br>Phone: (720) 771-2599
 > _______________________________________________
 > M4-discuss mailing list
 > address@hidden
 > http://lists.gnu.org/mailman/listinfo/m4-discuss

-- 
John Brzustowski - http://www.ProgramOrPerish.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]