Subject: misc/1132: mkdep in usr.sbin/netstat fails
To: None <gnats-admin@sun-lamp.pc.cs.cmu.edu>
From: Duncan McEwan <duncan@comp.vuw.ac.nz>
List: netbsd-bugs
Date: 06/19/1995 22:50:14
>Number:         1132
>Category:       misc
>Synopsis:       mkdep in usr.sbin/netstat fails
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 19 22:50:13 1995
>Originator:     Duncan McEwan
>Organization:
	Computer Scence Department,
	Victoria University of Wellington, New Zealand.
>Release:        1.0
>Environment:
	
System: NetBSD grass.pc.comp.vuw.ac.nz 1.0A NetBSD 1.0A (ORSINIS) #0: Wed Jun 14 16:46:45 NZST 1995 duncan@grass.pc.comp.vuw.ac.nz:/scratch/src/sys/arch/i386/compile/ORSINIS i386


>Description:

In /usr/src/usr.bin/netstat from a recent (Jun 9th ish) -current:

make depend
rm -f .depend
files=" ";  if [ "$files" != " " ]; then  mkdep -a     $files;  fi
files="if.c inet.c iso.c main.c mbuf.c mroute.c ns.c route.c /usr/src/usr.bin/netstat/../../sys/netiso/tp_astring.c unix.c";  if [ "$files" != "" ]; then  mkdep -a    $files;  fi
In file included from if.c:50:
/usr/include/netiso/iso_var.h:86: macro or `#include' recursion too deep
mkdep: compile failed.
*** Error code 1

Stop.

The problem seems to be mutually recursive #defines of ifra_dstaddr and
ifra_broadaddr in netinet/in_var.h and netns/ns_if.h.  This then causes mkdep
to fail when parsing line 86 of netiso/iso_var.h 

The following shows the relevent lines:

cd /usr/include
grep -n ifra_dstaddr netinet/in_var.h netns/ns_if.h netiso/iso_var.h
netinet/in_var.h:65:    struct  sockaddr_in ifra_dstaddr;
netinet/in_var.h:66:#define     ifra_broadaddr  ifra_dstaddr
netns/ns_if.h:60:#define ifra_dstaddr ifra_broadaddr
netiso/iso_var.h:86:    struct  sockaddr_iso ifra_dstaddr;

Note: the problem only occurs when depending and not when compiling as a result
of the '-traditional' flag that /usr/bin/cpp passes to the pre-processor.  The
compiler invokves the preprocessor without '-traditional' and doesn't get
this error.

>How-To-Repeat:
	cd /usr/src/usr.bin/netstat
	make depend

>Fix:
	o remove the mutual recursion?

	o change /usr/bin/cpp so that is invokes /usr/libexec/cpp without
          -traditional (note: this was the temporary hack I used to get my
          compile going again, and although it solves this problem, it causes
          another later.  When depending font.cc in gnu/usr.bin/groff/libgroff.
	  I got the error 

		font.cc:465: unterminated character constant

	  which didn't happen when cpp was invoked *with* -traditional :-(

	o ???
>Audit-Trail:
>Unformatted: