| From: | Andrew Dunstan <andrew(at)dunslane(dot)net> | 
|---|---|
| To: | Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov> | 
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndQuadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org | 
| Subject: | Re: Re: [COMMITTERS] pgsql: Fix blatantly uninitialized variable in recent commit. | 
| Date: | 2011-02-17 19:04:59 | 
| Message-ID: | 4D5D715B.2090201@dunslane.net | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-committers pgsql-hackers | 
On 02/17/2011 12:54 PM, Kevin Grittner wrote:
> Andrew Dunstan<andrew(at)dunslane(dot)net>  wrote:
>
>> Ugh. Isn't there some sort of pragma or similar we can use to shut
>> it up?
>
> If that fails, maybe use some function like the below?  That would
> also have the advantage of not relying on assumptions beyond the
> documented API, which I tend to feel good about no matter how sure I
> am that the implementation details upon which I'm relying won't
> change.
>
> No claims that this is good final form, especially when it comes to
> using ssize_t, but just trying to get across the general idea:
>
> void
> write_completely_ignore_errors(int filedes, const void *buffer,
>                                 size_t size)
> {
>      size_t t = 0;
>      while (t<  size)
>      {
>          ssize_t n = write(filedes, buffer, size - t);
>          if (n<= 0)
>              break;
>          t += n;
>      }
> }
In a very modern gcc, where we seem to be getting the errors from, maybe
    |#pragma GCC diagnostic push
    |#pragma GCC diagnostic ignored "-Wunused-result"
    write( ...);
    #pragma GCC diagnostic pop
would work. See 
<http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas>
cheers
andrew
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2011-02-17 19:24:48 | pgsql: Remove doc mention about read committed in upsert example. | 
| Previous Message | Bruce Momjian | 2011-02-17 18:37:05 | pgsql: Document that plpgsql upsert example can fail if insert triggers | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2011-02-17 19:24:47 | Re: remove upsert example from docs | 
| Previous Message | Hitoshi Harada | 2011-02-17 19:04:01 | Re: COPY ENCODING revisited |