From owner-freebsd-current@FreeBSD.ORG Thu Jan 17 21:25:14 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CE5916A583 for ; Thu, 17 Jan 2008 21:25:12 +0000 (UTC) (envelope-from mail@sysfault.org) Received: from smtprelay09.ispgateway.de (smtprelay09.ispgateway.de [80.67.29.23]) by mx1.freebsd.org (Postfix) with ESMTP id 8387713C46E for ; Thu, 17 Jan 2008 21:25:12 +0000 (UTC) (envelope-from mail@sysfault.org) Received: from [89.182.9.65] (helo=medusa.sysfault.org) by smtprelay09.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1JFcEY-0002J1-EQ for freebsd-current@freebsd.org; Thu, 17 Jan 2008 22:25:10 +0100 Received: from localhost ([127.0.0.1] helo=medusa.sysfault.org) by medusa.sysfault.org with esmtp (Exim 4.69 (FreeBSD)) (envelope-from ) id 1JFcEc-000LGB-Tr for freebsd-current@freebsd.org; Thu, 17 Jan 2008 22:25:16 +0100 Received: (from marcus@localhost) by medusa.sysfault.org (8.14.2/8.14.2/Submit) id m0HLPC7c081726 for freebsd-current@freebsd.org; Thu, 17 Jan 2008 22:25:12 +0100 (CET) (envelope-from marcus) Date: Thu, 17 Jan 2008 22:25:10 +0100 From: Marcus von Appen To: freebsd-current@freebsd.org Message-ID: <20080117212510.GB1094@medusa.sysfault.org> Mail-Followup-To: freebsd-current@freebsd.org References: <20080117190011.GA1094@medusa.sysfault.org> <20080117195348.GA67081@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JP+T4n/bALQSJXh8" Content-Disposition: inline In-Reply-To: <20080117195348.GA67081@hoeg.nl> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Score: -4.4 (----) X-Df-Sender: 936934 Subject: Re: BSD cflow available X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Marcus von Appen List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2008 21:25:14 -0000 --JP+T4n/bALQSJXh8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On, Thu Jan 17, 2008, Ed Schouten wrote: > Hello Marcus, >=20 [...] =20 > I just tried cgraph to see how it works, I've never used cflow before (I > didn't even know it was part of POSIX). I don't know if this is required > by the standards, but here it goes: >=20 > When I create 2 C files: >=20 > ~~~~~~~~~~~~~~~~~~ > a.c: >=20 > void a(void) > { > b(); > } > ~~~~~~~~~~~~~~~~~~ >=20 > ~~~~~~~~~~~~~~~~~~ > b.c: >=20 > void b(void) > { > } > ~~~~~~~~~~~~~~~~~~ >=20 > Two very simple C files with a function call that connects the objects > together. When I run cgraph, I get this: >=20 > | 1 a: void(), > | 2 b: <> > | 1 b: void(), >=20 > Isn't the application supposed to resolve b as well? cflow looks like a > useful utility. Hope to see it get integrated. :-) No, it should not resolve b here. In contrast to the POSIX requirements this implementation accepts multiple source code files at once in order to ease the generation of multiple graphs at once. Technically those are built one after each other, without knowing about the contents of the previously parsed file. The problem with your expectation lies within the nature of C code itself (you surely know that): How should the parser know that b is the correct function to be referenced by a()? It can't know and letting it guess this can quickly lead to unwanted, wrong results in the parsing and output tree. Imagine two static functions, both with the same name in each C file. Or a.c is linked to a library, which also defines b() and thus is not related to b.c itself. As cflow - in my opinion - is a useful tool to get a better overview about the control flow in (possibly unknown) source code, being "better safe than sorry" would be the best way to go here, I think. Your expectation however shows that both, the output for multiple files, and the man pages should reflect that :-). Regards Marcus --JP+T4n/bALQSJXh8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iEYEARECAAYFAkePx7YACgkQo/JpszXavhxXrwCgithreTAjZNCnrqWn3d+S/NpY lbsAn3Wb4Mb6I/lv+Qy48TSy08clTqQ7 =N1hj -----END PGP SIGNATURE----- --JP+T4n/bALQSJXh8--