Re: [HACKERS] [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros

2009-07-22 Thread Robert Haas
On Mon, Jul 20, 2009 at 3:14 AM, Jeremy Kerrj...@ozlabs.org wrote: That code is not broken as it stands, and doesn't appear to really gain anything from the proposed change.  Why should we risk any portability questions when the code isn't going to get either simpler or shorter? OK, after

Re: [HACKERS] [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros

2009-07-20 Thread Jeremy Kerr
Hi Tom, That code is not broken as it stands, and doesn't appear to really gain anything from the proposed change. Why should we risk any portability questions when the code isn't going to get either simpler or shorter? OK, after attempting a macro version of this, we end up with: #define

Re: [HACKERS] [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros

2009-07-19 Thread Jeremy Kerr
Hi Robert, Perhaps we should use macros. I was trying to avoid macros, as this means we lose type- and syntax- checking at the call-site, and end up with slightly messier code. However, I understand that this is probably personal preference for me :) How about just 'static' functions? (ie,

Re: [HACKERS] [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros

2009-07-19 Thread Tom Lane
Jeremy Kerr j...@ozlabs.org writes: However, I'd rather make decisions on data, rather than guessing. Is the actual problem here that some compilers just don't support the 'inline' keyword? I think Alvaro's complaint is unfounded --- we already have logic to #define inline as empty if the

Re: [HACKERS] [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros

2009-07-19 Thread Jeremy Kerr
Tom, However, I think the whole patch is pretty useless. That code is not broken as it stands, and doesn't appear to really gain anything from the proposed change. Why should we risk any portability questions when the code isn't going to get either simpler or shorter? This patch clears the

Re: [HACKERS] [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros

2009-07-19 Thread Tom Lane
Jeremy Kerr j...@ozlabs.org writes: We also need disable_sigpipe to be called when it's not the start of a block, hence the separate type definition. So break that macro into two (variable definition and code). regards, tom lane -- Sent via pgsql-hackers mailing list

Re: [HACKERS] [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros

2009-07-14 Thread Alvaro Herrera
Jeremy Kerr wrote: Also, since we don't need to declare variables in the macros, we can change the code to be implemented as static inlines. Does this work in compilers other than GCC? I think we use some kludges to protect against them ... see pg_list.h for the canonical example. -- Alvaro

Re: [HACKERS] [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros

2009-07-14 Thread Jeremy Kerr
Hi, Alvaro, Does this work in compilers other than GCC? I think we use some kludges to protect against them ... see pg_list.h for the canonical example. As I understand it, we're not using static inlines in pg_list.h to prevent multiple objects from exporting the same symbols if the

Re: [HACKERS] [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros

2009-07-14 Thread Robert Haas
On Tue, Jul 14, 2009 at 8:42 PM, Jeremy Kerrj...@ozlabs.org wrote: Hi, Alvaro, Does this work in compilers other than GCC?  I think we use some kludges to protect against them ... see pg_list.h for the canonical example. As I understand it, we're not using static inlines in pg_list.h to

[HACKERS] [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros

2009-06-30 Thread Jeremy Kerr
Currently, the sigpipe-masking code in libpq is implemented as a set of macros, which depend on declaring local variables. This change adds a (private) struct sigpipe_info to contain the compile-dependent data required for sigpipe masking and restoring. The caller can then declare a struct