Skip site navigation (1) Skip section navigation (2)

Re: Patches for static check on geo_ops.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul Matthews <plm(at)netspace(dot)net(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patches for static check on geo_ops.c
Date: 2009-08-27 16:04:54
Message-ID: 5141.1251389094@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Paul Matthews <plm(at)netspace(dot)net(dot)au> writes:
> Grzegorz Jaskiewicz wonderful static checker coughed up 5 errors in
> geo_ops.c.  None of them of any particular excitement or of earth
> shattering nature. A patch is attached below that should correct these.
> (The more little issue we eliminate, the more the large ones will stand
> out.)

> At line 3131 value stored into 'dist' variable is never referenced again.
> At line 3014 value stored into 'dist' variable is never referenced again.
> At line 2942 value stored into 'd' variable is never referenced again.
> At line 2953 value stored into 'd' variable is never referenced again.
> At line 2993 value stored into 'd' variable is never referenced again.

I've applied the first three of these changes, but not the last two
(the 'dist' assignments).  "clang" seems to have a tin ear for style :-(.
It's failing to notice that we have several similar code blocks in
sequence in these two places, and making the last one different from the
rest would decrease code readability and modifiability.  I'm happy if
the compiler optimizes away useless stores, but I don't really think
it should presume to dictate code style to us on that basis.

BTW, if we did apply those changes, I suppose clang would immediately
start complaining that the preceding assignments to 'd' are useless.
So by the time we'd made it happy, those code blocks would look quite
different from their mates.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Jeff JanesDate: 2009-08-27 16:07:31
Subject: Re: [pgsql-hackers] Daily digest v1.9418 (15 messages)
Previous:From: Jaime CasanovaDate: 2009-08-27 15:55:39
Subject: Re: 8.5 release timetable, again

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group