Bug 38864

Summary: -CURRENT: buildkernel stop in vnode_if.h due to gawk error in /sys/tools/vnode_if.awk
Product: Base System Reporter: Pierre-Francois LAURAND <pushf>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: pushf
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   

Description Pierre-Francois LAURAND 2002-06-03 17:20:01 UTC
When trying to build a new -CURRENT kernel with "make KERNCONF=CURLY buildkernel" in /usr/src, the build stops at:

...snip...
cc -c -x assembler-with-cpp -DLOCORE -O2 -march=pentiumpro -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wno-format -ansi  -nostdinc -I-  -I. -I/usr/src/sys -I/usr/src/sys/dev -I/usr/src/sys/contrib/dev/acpica -I/usr/src/sys/contrib/ipfilter -I/usr/src/sys/../include  -D_KERNEL -ffreestanding -include opt_global.h -fno-common   -mpreferred-stack-boundary=2 -ffreestanding  /usr/src/sys/i386/i386/locore.s
cc -c -O2 -march=pentiumpro -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wno-format -ansi  -nostdinc -I-  -I. -I/usr/src/sys -I/usr/src/sys/dev -I/usr/src/sys/contrib/dev/acpica -I/usr/src/sys/contrib/ipfilter -I/usr/src/sys/../include  -D_KERNEL -ffreestanding -include opt_global.h -fno-common   -mpreferred-stack-boundary=2 -ffreestanding   vnode_if.c
In file included from /usr/src/sys/sys/vnode.h:549,
                 from vnode_if.c:10:
vnode_if.h:17: syntax error before ')' token
vnode_if.h:18: warning: function declaration isn't a prototype
vnode_if.h: In function `VOP_ISLOCKED':
vnode_if.h:22: `vp' undeclared (first use in this function)
vnode_if.h:22: (Each undeclared identifier is reported only once
vnode_if.h:22: for each function it appears in.)
vnode_if.h:23: `td' undeclared (first use in this function)
...snip...

vnode_if.h is automatically produced by /sys/tools/vnode_if.awk in a command line like :
awk -f /usr/src/sys/tools/vnode_if.awk /usr/src/sys/kern/vnode_if.src -h

The output of my -CURRENT awk --version is : GNU Awk 3.1.0.
In the awk script vnode_if.awk, at line 222 in the "print out function" for loop, when i should be 1, it reaches 0.12477970123291015625 (!).
In the others cases, i takes its right value, eg:
i should be 0: i == 0
i should be 1: i == 0.12477970123291015625
i should be 2: i == 2

The output of the script, vnode_if.h, which is rejected by cc, look like:

...snip...
extern struct vnodeop_desc vop_default_desc;
struct vop_islocked_args {
  struct vnodeop_desc *a_desc;
  struct vnode *a_vp;
  struct thread *a_td;
};
extern struct vnodeop_desc vop_islocked_desc;
static __inline int VOP_ISLOCKED(
  struct vnode *vp,
^^^^^^^^^^^^^^^^^^^^^^
  )
{
  struct vop_islocked_args a;
  int rc;
  a.a_desc = VDESC(vop_islocked);
  a.a_vp = vp;
  a.a_td = td;
  rc = VCALL(vp, VOFFSET(vop_islocked), &a);
  return (rc);
}
...snip...

For more detail, you should find my full vnode_if.h and build logs at:
http://laurand.ath.cx/freebsd/

I have tested vnode_if.awk on a 4.5-STABLE with gawk 3.0.6 and it seems to work well.
So, I think that it could be a -CURRENT gawk 3.1.0  bug (?).

Fix: 

coming back to gawk 3.0.6 :-((
How-To-Repeat: 
make buildkernel on -CURRENT with a fresh src three, and gawk 3.1.0
Comment 1 Jens Schweikhardt freebsd_committer freebsd_triage 2002-08-13 17:48:26 UTC
State Changed
From-To: open->closed

Transient problems like builds failing on -current should be discussed 
on current@FreeBSD.org, to which you are required to subscribe as a 
-current user. These things get sorted out very quickly as any broken 
build will be seen by a lot of people so there is never need to open a 
PR. 

In this case, gawk has been replaced by awk some time ago.