Re: [HACKERS] sparse (static analyzer) report

2005-01-16 Thread Neil Conway
Mark Wong wrote: Ah, so you beat me to it Neil. ;) Out of curiosity, how much worse was it before you started fixing things? As I recall, not too different than things are today -- sparse flagged a bunch of stylistic issues that I fixed, like: void some_func() { ... } => void some_func(void) { .

Re: [HACKERS] sparse (static analyzer) report

2005-01-15 Thread Tommi Mäkitalo
Am Samstag, 15. Januar 2005 21:38 schrieb Bruno Wolff III: > On Sat, Jan 15, 2005 at 10:44:48 -0500, > > Greg Stark <[EMAIL PROTECTED]> wrote: > > What I miss most in both C and Java is the lispish ability to write > > expressions like: > > > > foo = bar() || baz() || qux(); > > Are you sure tha

Re: [HACKERS] sparse (static analyzer) report

2005-01-15 Thread Tom Lane
Bruno Wolff III <[EMAIL PROTECTED]> writes: > Greg Stark <[EMAIL PROTECTED]> wrote: >> What I miss most in both C and Java is the lispish ability to write >> expressions like: >> >> foo = bar() || baz() || qux(); > Are you sure that C doesn't guarenty short circuit evaluation? > I don't have my

Re: [HACKERS] sparse (static analyzer) report

2005-01-15 Thread Bruno Wolff III
On Sat, Jan 15, 2005 at 10:44:48 -0500, Greg Stark <[EMAIL PROTECTED]> wrote: > > > What I miss most in both C and Java is the lispish ability to write > expressions like: > > foo = bar() || baz() || qux(); Are you sure that C doesn't guarenty short circuit evaluation? I don't have my C refe

Re: [HACKERS] sparse (static analyzer) report

2005-01-15 Thread Greg Stark
Tom Lane <[EMAIL PROTECTED]> writes: > if (ptr) > > Can anyone mount a good readability argument for one over the other? My argument in favour of "if (ptr)" as well as "if (integer)" and "if (!ptr)" is simply that all else being equal the shorter expression is clearer. Forcing the reader t

Re: [HACKERS] sparse (static analyzer) report

2005-01-15 Thread Alvaro Herrera
On Sat, Jan 15, 2005 at 08:31:42AM -0500, Andrew Dunstan wrote: > Tom Lane wrote: > >Something that I don't have a real strong feeling about is > > if (ptr != NULL) > >versus > > if (ptr) > >I've been known to write both. Can anyone mount a good readability > >argument for one over the o

Re: [HACKERS] sparse (static analyzer) report

2005-01-15 Thread Andrew Dunstan
Tom Lane wrote: Greg Stark <[EMAIL PROTECTED]> writes: Alvaro Herrera <[EMAIL PROTECTED]> writes: Hmm. Well, it showed the multiple incorrect uses of 0 as NULL in dllist.c and other places, Incidentally, while it may not be conformant to your style guidelines, use of the consta

Re: [HACKERS] sparse (static analyzer) report

2005-01-15 Thread Tom Lane
Greg Stark <[EMAIL PROTECTED]> writes: > Alvaro Herrera <[EMAIL PROTECTED]> writes: >> Hmm. Well, it showed the multiple incorrect uses of 0 as NULL in >> dllist.c and other places, > Incidentally, while it may not be conformant to your style guidelines, use of > the constant 0 compared to or as

Re: [HACKERS] sparse (static analyzer) report

2005-01-14 Thread Greg Stark
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Hmm. Well, it showed the multiple incorrect uses of 0 as NULL in > dllist.c and other places, Incidentally, while it may not be conformant to your style guidelines, use of the constant 0 compared to or assigned to a pointer is a perfectly valid ANSI

Re: [HACKERS] sparse (static analyzer) report

2005-01-14 Thread Alvaro Herrera
On Fri, Jan 14, 2005 at 05:50:30PM -0800, Mark Wong wrote: > Yeah, I generate the file list to run sparse against with a > "find . -name '*.c'". So that's simple enough. But flex and bison > files don't end in .c, do they? Generated files do. I have a list of generated files here: pl_gram.c p

Re: [HACKERS] sparse (static analyzer) report

2005-01-14 Thread Mark Wong
Ah, so you beat me to it Neil. ;) Out of curiosity, how much worse was it before you started fixing things? Mark On Sat, Jan 15, 2005 at 01:30:37PM +1100, Neil Conway wrote: > BTW, perhaps one reason for the relatively small number of legitimate > issues picked up by sparse is that I ran sparse

Re: [HACKERS] sparse (static analyzer) report

2005-01-14 Thread Neil Conway
BTW, perhaps one reason for the relatively small number of legitimate issues picked up by sparse is that I ran sparse on the tree a month or two ago and fixed some of the stylistic issues it reported. Most of the stuff I didn't bother to fix looked like either a sparse bug, or a marginal style

Re: [HACKERS] sparse (static analyzer) report

2005-01-14 Thread Mark Wong
On Fri, Jan 14, 2005 at 09:54:24PM -0300, Alvaro Herrera wrote: > On Fri, Jan 14, 2005 at 03:53:09PM -0800, Mark Wong wrote: > > On Thu, Jan 13, 2005 at 03:09:19PM -0800, Mark Wong wrote: > > > On Thu, Jan 13, 2005 at 08:06:23PM -0300, Alvaro Herrera wrote: > > > > On Thu, Jan 13, 2005 at 01:31:36P

Re: [HACKERS] sparse (static analyzer) report

2005-01-14 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > ... And fmgroids.h is > missing; not sure what's the minimal make target to install it, because > make -C src/backend/utils fmgroids.h > generates it, but the symbolic link to src/include/utils is still > needed. Looks like the symlinks are made in src/

Re: [HACKERS] sparse (static analyzer) report

2005-01-14 Thread Alvaro Herrera
On Fri, Jan 14, 2005 at 03:53:09PM -0800, Mark Wong wrote: > On Thu, Jan 13, 2005 at 03:09:19PM -0800, Mark Wong wrote: > > On Thu, Jan 13, 2005 at 08:06:23PM -0300, Alvaro Herrera wrote: > > > On Thu, Jan 13, 2005 at 01:31:36PM -0800, Mark Wong wrote: > > > > We've also started automating sparse a

Re: [HACKERS] sparse (static analyzer) report

2005-01-14 Thread Mark Wong
On Thu, Jan 13, 2005 at 03:09:19PM -0800, Mark Wong wrote: > On Thu, Jan 13, 2005 at 08:06:23PM -0300, Alvaro Herrera wrote: > > On Thu, Jan 13, 2005 at 01:31:36PM -0800, Mark Wong wrote: > > > We've also started automating sparse analyses in our PLM tool, which > > > will show an error and warning

Re: [HACKERS] sparse (static analyzer) report

2005-01-13 Thread Mark Wong
On Thu, Jan 13, 2005 at 08:06:23PM -0300, Alvaro Herrera wrote: > On Thu, Jan 13, 2005 at 01:31:36PM -0800, Mark Wong wrote: > > We've also started automating sparse analyses in our PLM tool, which > > will show an error and warning count. Here's an example: > > http://www.osdl.org/plm-cgi/plm

Re: [HACKERS] sparse (static analyzer) report

2005-01-13 Thread Alvaro Herrera
On Thu, Jan 13, 2005 at 01:31:36PM -0800, Mark Wong wrote: > We've also started automating sparse analyses in our PLM tool, which > will show an error and warning count. Here's an example: > http://www.osdl.org/plm-cgi/plm?module=patch_info&patch_id=4065 I took a peek at the first sparse re

Re: [HACKERS] sparse (static analyzer) report

2005-01-13 Thread Mark Wong
We've also started automating sparse analyses in our PLM tool, which will show an error and warning count. Here's an example: http://www.osdl.org/plm-cgi/plm?module=patch_info&patch_id=4065 On Wed, Jan 12, 2005 at 02:18:36PM -0800, Mark Wong wrote: > Hi, > > Just wondering if anyone find

[HACKERS] sparse (static analyzer) report

2005-01-12 Thread Mark Wong
Hi, Just wondering if anyone finds spare's analysis useful. I ran it against 8.0-rc5: http://developer.osdl.org/markw/pgsql/sparse/pg-8.0rc5.txt Sparse can be downloaded http://www.codemonkey.org.uk/projects/bitkeeper/sparse/ or bk://sparse.bkbits.net/sparse