Re: [HACKERS] Warnings in compile

2009-06-03 Thread Bruce Momjian
Tom Lane wrote: > Michael Meskes writes: > > On Mon, May 25, 2009 at 10:19:40AM -0400, Tom Lane wrote: > >> That sounds both dangerous and against our coding conventions. The > >> standard way to do that is "do { ... } while (0)" > > > Which won't work here as the macros have continue and break

Re: [HACKERS] Warnings in compile

2009-05-29 Thread Michael Meskes
On Mon, May 25, 2009 at 12:10:49PM -0400, Tom Lane wrote: > [ thinks for a bit... ] What might be both safe and warning-free > is to code an explicit empty statement, viz macro body as > > if (1) { ... } else ((void) 0) I just tried this and yes, it quietens gcc and probably is at least as

Re: [HACKERS] Warnings in compile

2009-05-25 Thread Tom Lane
Michael Meskes writes: > On Mon, May 25, 2009 at 12:10:49PM -0400, Tom Lane wrote: >> Consider >> >> if (...) >> macro; >> else >> something-else; > Sure, but some/most/all macros are called as > MACRO; > No real reason there it seems. Well, they are calle

Re: [HACKERS] Warnings in compile

2009-05-25 Thread Michael Meskes
On Mon, May 25, 2009 at 12:10:49PM -0400, Tom Lane wrote: > Consider > > if (...) > macro; > else > something-else; > ... Sure, but some/most/all macros are called as MACRO; No real reason there it seems. > [ thinks for a bit... ] What might be both sa

Re: [HACKERS] Warnings in compile

2009-05-25 Thread Tom Lane
Michael Meskes writes: > On Mon, May 25, 2009 at 11:27:27AM -0400, Tom Lane wrote: >> You can't just remove the "else", or it's unsafe; > But why? What does this empty else accomplish? Consider if (...) macro; else something-else; Without the "el

Re: [HACKERS] Warnings in compile

2009-05-25 Thread Michael Meskes
On Mon, May 25, 2009 at 11:27:27AM -0400, Tom Lane wrote: > Oh, right, that was Bruce's "improvement" of the COPY code. I was less > than thrilled with it, but didn't have an easy alternative. > > You can't just remove the "else", or it's unsafe; and I'm afraid that But why? What does this empty

Re: [HACKERS] Warnings in compile

2009-05-25 Thread Tom Lane
Michael Meskes writes: > On Mon, May 25, 2009 at 10:19:40AM -0400, Tom Lane wrote: >> That sounds both dangerous and against our coding conventions. The >> standard way to do that is "do { ... } while (0)" > Which won't work here as the macros have continue and break commands in them. Oh, right

Re: [HACKERS] Warnings in compile

2009-05-25 Thread Michael Meskes
On Mon, May 25, 2009 at 10:19:40AM -0400, Tom Lane wrote: > Michael Meskes writes: > > - some combination of signed and unsigned: ~ 600 > > Are we really sure that *all* compilers out there do handle this > > correctly? > > The behavior is spelled out in the C spec, and always has been. You >

Re: [HACKERS] Warnings in compile

2009-05-25 Thread Tom Lane
Michael Meskes writes: > - some combination of signed and unsigned: ~ 600 > Are we really sure that *all* compilers out there do handle this correctly? The behavior is spelled out in the C spec, and always has been. You might as well worry if they handle "if" correctly. > There are some #de

[HACKERS] Warnings in compile

2009-05-25 Thread Michael Meskes
Hi, sitting here on my flight back I went through the list of all warnings gcc spits out when using -Wextra. There are a whole lot of them (~ 1700) that mostly (except one) fall into one of four classes: - unused parameters: ~ 600 - some combination of signed and unsigned: ~ 600 Are we really s