Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Nov 2012 16:39:18 +0000 (GMT)
From:      Gavin Atkinson <gavin@FreeBSD.org>
To:        Niclas Zeising <zeising@daemonic.se>
Cc:        freebsd-current@freebsd.org, Larry Rosenman <ler@lerctr.org>
Subject:   Re: lsof vs. clang
Message-ID:  <alpine.BSF.2.00.1211061637090.22947@thunderhorn.york.ac.uk>
In-Reply-To: <50991B47.2060409@daemonic.se>
References:  <alpine.BSF.2.00.1211060741040.2564@borg> <50991B47.2060409@daemonic.se>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 6 Nov 2012, Niclas Zeising wrote:
> On 11/06/12 14:42, Larry Rosenman wrote:
> > It appears that we've (mostly) cleaned up the clang/system interface
> > such that sysutils/lsof works with cc as clang.
> > 
> > Can someone tell me what we need to do to shut these up?
> > 
> > 
> > # LSOFCC=cc CC=cc make LSOFCC=cc CC=cc
> > ===> lsof-4.87.a,7 depends on file: /usr/local/sbin/pkg - found
> > ===> Extracting for lsof-4.87.a,7
> > => SHA256 Checksum OK for lsof_4.87A.freebsd.tar.bz2.
> > ===> Patching for lsof-4.87.a,7
> > ===> Configuring for lsof-4.87.a,7
> > Creating ./lockf_owner.h from /usr/src/sys/kern/kern_lockf.c
> > ./lockf_owner.h creation succeeded.
> > rm -f ddev.c dfile.c dlsof.h dmnt.c dnode*.c dproc.c dproto.h dsock.c
> > dstore.c dzfs.h kernelbase.h machine.h machine.h.old new_machine.h
> > __lseek.s Makefile Makefile.zfs ./tests/config.cflags
> > rm -f ./tests/config.cc ./tests/config.xobj ./tests/config.ldflags
> > Testing C library for localtime() and strftime(), using cc ... present
> > ln -s dialects/freebsd/dlsof.h dlsof.h
> > ln -s dialects/freebsd/dmnt.c dmnt.c
> > ln -s dialects/freebsd/dnode.c dnode.c
> > ln -s dialects/freebsd/dnode1.c dnode1.c
> > ln -s dialects/freebsd/dnode2.c dnode2.c
> > ln -s dialects/freebsd/dproc.c dproc.c
> > ln -s dialects/freebsd/dproto.h dproto.h
> > ln -s dialects/freebsd/dsock.c dsock.c
> > ln -s dialects/freebsd/dstore.c dstore.c
> > ln -s dialects/freebsd/dzfs.h dzfs.h
> > ln -s dialects/freebsd/machine.h machine.h
> > Makefile and lib/Makefile created.
> > Makefile.zfs created.
> > ./tests/config.cc created
> > ./tests/config.cflags created
> > ./tests/config.ldflags created
> > ./tests/config.xobj created
> > ===> Building for lsof-4.87.a,7
> > (cd lib; make DEBUG="-O2" CFGF="-pipe -fno-omit-frame-pointer
> > -fno-strict-aliasing -fno-omit-frame-pointer -DHASEFFNLINK=i_effnlink
> > -DHASF_VNODE -DHASSBSTATE -DHAS_KVM_VNODE -DHAS_UFS1_2
> > -DHAS_VM_MEMATTR_T -DHAS_CDEV2PRIV -DHAS_NO_SI_UDEV -DHAS_SYS_SX_H
> > -DHAS_ZFS -DHAS_V_LOCKF -DHAS_LOCKF_ENTRY -DHAS_NO_6PORT -DHAS_NO_6PPCB
> > -DNEEDS_BOOLEAN_T -DFREEBSDV=10000 -DHASFDESCFS=2 -DHASPSEUDOFS
> > -DHASNULLFS -DHASIPv6 -DHASUTMPX -DHAS_STRFTIME
> > -DLSOF_VSTR=\"10.0-CURRENT\"")
> > cc -pipe -fno-omit-frame-pointer -fno-strict-aliasing
> > -fno-omit-frame-pointer -DHASEFFNLINK=i_effnlink -DHASF_VNODE
> > -DHASSBSTATE -DHAS_KVM_VNODE -DHAS_UFS1_2 -DHAS_VM_MEMATTR_T
> > -DHAS_CDEV2PRIV -DHAS_NO_SI_UDEV -DHAS_SYS_SX_H -DHAS_ZFS -DHAS_V_LOCKF
> > -DHAS_LOCKF_ENTRY -DHAS_NO_6PORT -DHAS_NO_6PPCB -DNEEDS_BOOLEAN_T
> > -DFREEBSDV=10000 -DHASFDESCFS=2 -DHASPSEUDOFS -DHASNULLFS -DHASIPv6
> > -DHASUTMPX -DHAS_STRFTIME -DLSOF_VSTR="10.0-CURRENT" -I/usr/src/sys -O2
> > -c ckkv.c
> > In file included from ckkv.c:43:
> > In file included from ./../lsof.h:195:
> > In file included from ./../dlsof.h:190:
> > In file included from /usr/src/sys/ufs/ufs/ufsmount.h:36:
> > /usr/src/sys/sys/buf.h:392:2: warning: implicit declaration of function
> > 'KASSERT' is invalid in C99 [-Wimplicit-function-declaration]
> > KASSERT(bp->b_bufobj != NULL, ("bwrite: no bufobj bp=%p", bp));
> > ^
> As this hints on, KASSERT is undeclared.  You should either declare KASSERT
> manually or include the proper header file.
> With that said, KASSERT look very much like kernel code, and should probably
> not be used in userland utilities at all, but I am no expert on this.

Yes, probalby either #include sys/systm.h, or it may be easier to roll 
your own #define inside lsof.h:

#define KASSERT(exp,msg) do {} while (0)

Given this is userland code, you probably don't want the true KASSERT code 
anyway.

Gavin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1211061637090.22947>