Re: [HACKERS] new compiler warnings

2011-10-19 Thread Tom Lane
"Kevin Grittner" writes: > Tom Lane wrote: >> Unfortunately, the problem we're dealing with here is exactly that >> we can't write to stderr. So it's a bit hard to see what we can >> usefully do to report that we have a problem (short of crashing, >> which isn't a net improvement). > Are you s

Re: [HACKERS] new compiler warnings

2011-10-19 Thread Kevin Grittner
Tom Lane wrote: > Unfortunately, the problem we're dealing with here is exactly that > we can't write to stderr. So it's a bit hard to see what we can > usefully do to report that we have a problem (short of crashing, > which isn't a net improvement). Are you sure that crashing on an assertio

Re: [HACKERS] new compiler warnings

2011-10-19 Thread Greg Stark
On Tue, Oct 18, 2011 at 6:01 PM, Tom Lane wrote: > The chunks are sent indivisibly, because they are less than the pipe > buffer size.  Read the pipe man page.  It's guaranteed that the write > will either succeed or fail as a whole, not write a partial message. > If we cared to retry a failure, t

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Peter Eisentraut
On tis, 2011-10-18 at 16:13 -0400, Tom Lane wrote: > Peter Eisentraut writes: > > On tis, 2011-10-18 at 15:43 -0400, Tom Lane wrote: > >> I don't actually see that warning on my Fedora 15 machine, with > >> gcc version 4.6.1 20110908 (Red Hat 4.6.1-9) (GCC) > > > You get the "unused return value"

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
Heikki Linnakangas writes: > On 18.10.2011 23:28, Tom Lane wrote: >> I don't think the assert is a good idea. If it ever did happen, that >> would promote the problem from "corrupted data in the log" to "database >> crash". > I believe the idea is that if there's a platform that does that, we wa

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
I wrote: > I think a large fraction of the -Waddress warnings are coming from > this line in the heap_getattr macro: > AssertMacro((tup) != NULL), \ > Seems to me we could just lose that test and be no worse off, since > the macro is surely gonna dump core anyway on a null pointer. Actually,

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
Tom Lane wrote: > As far as getting rid of the compiler warning is concerned, I find > that the > > rc = write(...); > (void) rc; > > suggestion works for me (gcc 4.6.1). That silences the warning on my machine, too. -Kevin -- Sent via pgsql-hackers mailing list (pgsql-hacker

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
"Kevin Grittner" writes: > Tom Lane wrote: >> I don't think the assert is a good idea. If it ever did happen, >> that would promote the problem from "corrupted data in the log" to >> "database crash". > ... on a --enable-cassert build. > If we think it's even remotely possible that it could

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
Tom Lane wrote: > I don't think the assert is a good idea. If it ever did happen, > that would promote the problem from "corrupted data in the log" to > "database crash". ... on a --enable-cassert build. If we think it's even remotely possible that it could happen, maybe we should do the lo

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Heikki Linnakangas
On 18.10.2011 23:28, Tom Lane wrote: "Kevin Grittner" writes: Would it be too weird to do something like this for each?: - write(fileno(stderr), line, len); + rc = write(fileno(stderr), line, len); + if (rc>= 0&& rc != len) + { + Assert(false); +

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
"Kevin Grittner" writes: > Would it be too weird to do something like this for each?: > - write(fileno(stderr), line, len); > + rc = write(fileno(stderr), line, len); > + if (rc >= 0 && rc != len) > + { > + Assert(false); > + return; > + } I don

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Robert Haas
On Tue, Oct 18, 2011 at 4:13 PM, Tom Lane wrote: > Peter Eisentraut writes: >> On tis, 2011-10-18 at 15:43 -0400, Tom Lane wrote: >>> I don't actually see that warning on my Fedora 15 machine, with >>> gcc version 4.6.1 20110908 (Red Hat 4.6.1-9) (GCC) > >> You get the "unused return value" warni

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
Peter Eisentraut writes: > On tis, 2011-10-18 at 15:43 -0400, Tom Lane wrote: >> I don't actually see that warning on my Fedora 15 machine, with >> gcc version 4.6.1 20110908 (Red Hat 4.6.1-9) (GCC) > You get the "unused return value" warnings with -D_FORTIFY_SOURCE=2, > which has been the defaul

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
Robert Haas wrote: > Unfortunately, whether Tom's right or not, we still don't have a > solution to the compiler warning. Would it be too weird to do something like this for each?: diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index f0b3b1f..bea5489 100644 ---

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
Tom Lane wrote: > What are the people who do see it using? Currently: gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2 on Linux version 2.6.38-11-generic (buildd@allspice) (gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) ) #50-Ubuntu SMP Mon Sep 12 21:17:25 UTC 2011 I've seen it on earlier ve

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Peter Eisentraut
On tis, 2011-10-18 at 15:43 -0400, Tom Lane wrote: > Robert Haas writes: > > Unfortunately, whether Tom's right or not, we still don't have a > > solution to the compiler warning. > > I don't actually see that warning on my Fedora 15 machine, with > gcc version 4.6.1 20110908 (Red Hat 4.6.1

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
Robert Haas writes: > Unfortunately, whether Tom's right or not, we still don't have a > solution to the compiler warning. I don't actually see that warning on my Fedora 15 machine, with gcc version 4.6.1 20110908 (Red Hat 4.6.1-9) (GCC) What are the people who do see it using? (I do se

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Robert Haas
On Tue, Oct 18, 2011 at 3:03 PM, Kevin Grittner wrote: > Andrew Dunstan wrote: > >> My dim recollection is that Tom and I and maybe some others did >> tests on a bunch of platforms at the time we introduced the >> protocol to make sure it did work this way, since it's crucial to >> making sure we

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
Andrew Dunstan wrote: > My dim recollection is that Tom and I and maybe some others did > tests on a bunch of platforms at the time we introduced the > protocol to make sure it did work this way, since it's crucial to > making sure we don't get interleaved log lines. Testing is good; I like te

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
Tom Lane wrote: > If the O_NONBLOCK flag is clear, a write request may cause the > thread to block, but on normal completion it shall return > nbyte. > > Note the last in particular. Short writes are specifically > disallowed on pipes. OK, that's pretty definitive. I yield the point.

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Andrew Dunstan
On 10/18/2011 01:35 PM, Tom Lane wrote: Robert Haas writes: On Tue, Oct 18, 2011 at 1:01 PM, Tom Lane wrote: The chunks are sent indivisibly, because they are less than the pipe buffer size. Read the pipe man page. It's guaranteed that the write will either succeed or fail as a whole, not

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
Robert Haas writes: > On Tue, Oct 18, 2011 at 1:01 PM, Tom Lane wrote: >> The chunks are sent indivisibly, because they are less than the pipe >> buffer size.  Read the pipe man page.  It's guaranteed that the write >> will either succeed or fail as a whole, not write a partial message. >> If we

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Peter Eisentraut
On tis, 2011-10-18 at 09:36 -0400, Tom Lane wrote: > But some of the remaining -Waddress warnings are not so painless to > get rid of. Ultimately we might have to add -Wno-address to the > default CFLAGS. Here is the bug report to gcc on this issue: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=487

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
"Kevin Grittner" writes: > Tom Lane wrote: >> I think that what Kevin was on about was something else entirely, >> namely whether we need to retry writes to disk. > I would phrase it that we need to *continue* a write to disk if the > OS chooses to write a portion of it and return to the caller

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Robert Haas
On Tue, Oct 18, 2011 at 1:01 PM, Tom Lane wrote: > Robert Haas writes: >> On Tue, Oct 18, 2011 at 12:26 PM, Tom Lane wrote: >>> And it would break the code.  The whole point here is that the message >>> must be sent indivisibly. > >> How is that different than the chunking that the while loop is

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
Robert Haas writes: > On Tue, Oct 18, 2011 at 12:26 PM, Tom Lane wrote: >> And it would break the code.  The whole point here is that the message >> must be sent indivisibly. > How is that different than the chunking that the while loop is already doing? The chunks are sent indivisibly, because

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Robert Haas
On Tue, Oct 18, 2011 at 12:26 PM, Tom Lane wrote: > Robert Haas writes: >> On Tue, Oct 18, 2011 at 10:06 AM, Peter Eisentraut wrote: >>> No, I believe we are OK everywhere else.  We are only ignoring the >>> result in cases where we are trying to report errors in the first place. > >> The releva

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
Tom Lane wrote: > And it would break the code. The whole point here is that the > message must be sent indivisibly. If the new code splits the message, it would previously have been truncated. Is that less broken? -Kevin -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.or

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
Robert Haas writes: > On Tue, Oct 18, 2011 at 10:06 AM, Peter Eisentraut wrote: >> No, I believe we are OK everywhere else.  We are only ignoring the >> result in cases where we are trying to report errors in the first place. > The relevant code is: > while (len > PIPE_MAX_PAYLOAD) > {

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
"Kevin Grittner" wrote: > http://archives.postgresql.org/pgsql-hackers/2011-02/msg01719.php Although, it being a quick example of the general idea, I have an obvious bug there -- the write location would have to be "buffer + t". I think Noah might have also posted some example code a month o

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
Robert Haas wrote: > Which it seems to me we could change by doing rc = write(). Then > if rc <= 0, we bail out. If not, we add and subtract rc, rather > than PIPE_MAX_PAYLOAD. Something along the general lines of this?: http://archives.postgresql.org/pgsql-hackers/2011-02/msg01719.php >

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Robert Haas
On Tue, Oct 18, 2011 at 10:06 AM, Peter Eisentraut wrote: > No, I believe we are OK everywhere else.  We are only ignoring the > result in cases where we are trying to report errors in the first place. The relevant code is: while (len > PIPE_MAX_PAYLOAD) { p.proto.is_last = (dest

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Peter Eisentraut
On tis, 2011-10-18 at 09:32 -0400, Tom Lane wrote: > Andrew Dunstan writes: > > It is a pity we can't just tell the compiler to turn off the warning in > > a particular case. > > I haven't tested, but won't an explicit cast to void silence the > warning? > > (void) fwrite(...); No, tried

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
Tom Lane wrote: > I think that what Kevin was on about was something else entirely, > namely whether we need to retry writes to disk. I would phrase it that we need to *continue* a write to disk if the OS chooses to write a portion of it and return to the caller with the number actually writte

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
Peter Eisentraut writes: > On tis, 2011-10-18 at 01:00 -0700, Jeff Davis wrote: >> I'm not sure if these can/should be fixed or not, but here are the >> compiler warnings I'm getting on gcc and clang on ubuntu 11.10 with -O2. >> The gcc ones are mostly new. > They are expected with gcc 4.6. Ther

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Tom Lane
Andrew Dunstan writes: > It is a pity we can't just tell the compiler to turn off the warning in > a particular case. I haven't tested, but won't an explicit cast to void silence the warning? (void) fwrite(...); There are places, notably the calls in elog.c, where ignoring write failur

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Andrew Dunstan
On 10/18/2011 09:03 AM, Kevin Grittner wrote: Jeff Davis wrote: I'm not sure if these can/should be fixed or not, but here are the compiler warnings I'm getting on gcc and clang on ubuntu 11.10 with -O2. elog.c: In function ‘write_pipe_chunks’: elog.c:2479:8: warning: ignoring return valu

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Robert Haas
On Tue, Oct 18, 2011 at 9:03 AM, Kevin Grittner wrote: > Jeff Davis  wrote: > >> I'm not sure if these can/should be fixed or not, but here are the >> compiler warnings I'm getting on gcc and clang on ubuntu 11.10 with >> -O2. > >> elog.c: In function ‘write_pipe_chunks’: >> elog.c:2479:8: warning

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Kevin Grittner
Jeff Davis wrote: > I'm not sure if these can/should be fixed or not, but here are the > compiler warnings I'm getting on gcc and clang on ubuntu 11.10 with > -O2. > elog.c: In function ‘write_pipe_chunks’: > elog.c:2479:8: warning: ignoring return value of ‘write’, declared > with attribute w

Re: [HACKERS] new compiler warnings

2011-10-18 Thread Peter Eisentraut
On tis, 2011-10-18 at 01:00 -0700, Jeff Davis wrote: > I'm not sure if these can/should be fixed or not, but here are the > compiler warnings I'm getting on gcc and clang on ubuntu 11.10 with -O2. > The gcc ones are mostly new. They are expected with gcc 4.6. There isn't anything we can do about

[HACKERS] new compiler warnings

2011-10-18 Thread Jeff Davis
I'm not sure if these can/should be fixed or not, but here are the compiler warnings I'm getting on gcc and clang on ubuntu 11.10 with -O2. The gcc ones are mostly new. GCC $ gcc --version gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1 Copyright (C) 2011 Fr

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian writes: > > I can remove this warning by casting the pointer to (void *), rather > > than (const void *) because that is what the prototype uses on my system > > uses (libz.so.1.1.4): > > > ZEXTERN int ZEXPORTgzwrite OF((gzFile file, > >

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Tom Lane
Bruce Momjian writes: > I can remove this warning by casting the pointer to (void *), rather > than (const void *) because that is what the prototype uses on my system > uses (libz.so.1.1.4): > ZEXTERN int ZEXPORTgzwrite OF((gzFile file, > const voidp buf, unsig

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Bruce Momjian
Bruce Momjian wrote: > Bruce Momjian wrote: > > Robert Haas wrote: > > > I recently started getting these: > > > > > > plpython.c: In function ?PLy_output?: > > > plpython.c:3468: warning: format not a string literal and no format > > > arguments > > > plpython.c: In function ?PLy_elog?: > > > pl

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Tom Lane
Bruce Momjian writes: >> And I see this warning: >> >> compress_io.c:597: warning: passing arg 2 of `gzwrite' discards >> qualifiers from pointer target type > I can remove this warning by casting the pointer to (void *), rather > than (const void *) because that is what the prototype uses on my

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Bruce Momjian
Bruce Momjian wrote: > Robert Haas wrote: > > I recently started getting these: > > > > plpython.c: In function ?PLy_output?: > > plpython.c:3468: warning: format not a string literal and no format > > arguments > > plpython.c: In function ?PLy_elog?: > > plpython.c:3620: warning: format not a st

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Robert Haas
On Wed, Jan 26, 2011 at 5:20 PM, Peter Eisentraut wrote: > On ons, 2011-01-26 at 17:00 -0500, Robert Haas wrote: >> More to the point, regardless of whether the warning is reasonable or >> not, there's tangible value in a warning-free build, which we have had >> on most of the systems I use until

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Tom Lane
Peter Eisentraut writes: > It turns out you need -Wformat-security with newer GCC versions. Ah-hah. > We might want to add that to the standard options set. +1. Probably this will require an extra configure test, but even so it's well worthwhile. regards, tom lane --

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Peter Eisentraut
On ons, 2011-01-26 at 17:00 -0500, Robert Haas wrote: > More to the point, regardless of whether the warning is reasonable or > not, there's tangible value in a warning-free build, which we have had > on most of the systems I use until recently. I don't disagree that the warnings are valid. I'd j

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Tom Lane
Robert Haas writes: > But I think I did get it on a recently-updated Fedora 13 box also, I > can check if it's important. F-13 doesn't show it for me. I get the impression from these results that maybe gcc versions >= about 4.4 have been tweaked to not show it ... which doesn't really seem like

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Robert Haas
On Wed, Jan 26, 2011 at 4:50 PM, Tom Lane wrote: > Peter Eisentraut writes: >> On ons, 2011-01-26 at 06:33 -0500, Robert Haas wrote: >>> I recently started getting these: >>> >>> plpython.c: In function ‘PLy_output’: >>> plpython.c:3468: warning: format not a string literal and no format >>> arg

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Tom Lane
Peter Eisentraut writes: > On ons, 2011-01-26 at 06:33 -0500, Robert Haas wrote: >> I recently started getting these: >> >> plpython.c: In function ‘PLy_output’: >> plpython.c:3468: warning: format not a string literal and no format arguments >> plpython.c: In function ‘PLy_elog’: >> plpy

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Robert Haas
On Wed, Jan 26, 2011 at 4:20 PM, Peter Eisentraut wrote: > On ons, 2011-01-26 at 06:33 -0500, Robert Haas wrote: >> I recently started getting these: >> >> plpython.c: In function ‘PLy_output’: >> plpython.c:3468: warning: format not a string literal and no format arguments >> plpython.c: In funct

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Peter Eisentraut
On ons, 2011-01-26 at 06:33 -0500, Robert Haas wrote: > I recently started getting these: > > plpython.c: In function ‘PLy_output’: > plpython.c:3468: warning: format not a string literal and no format arguments > plpython.c: In function ‘PLy_elog’: > plpython.c:3620: warning: format not a string

Re: [HACKERS] new compiler warnings

2011-01-26 Thread Bruce Momjian
Robert Haas wrote: > I recently started getting these: > > plpython.c: In function ?PLy_output?: > plpython.c:3468: warning: format not a string literal and no format arguments > plpython.c: In function ?PLy_elog?: > plpython.c:3620: warning: format not a string literal and no format arguments > p

[HACKERS] new compiler warnings

2011-01-26 Thread Robert Haas
I recently started getting these: plpython.c: In function ‘PLy_output’: plpython.c:3468: warning: format not a string literal and no format arguments plpython.c: In function ‘PLy_elog’: plpython.c:3620: warning: format not a string literal and no format arguments plpython.c:3627: warning: format n