Re: replicating DROP commands across servers

From: David Rowley <dgrowley(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, "Brightwell, Adam" <adam(dot)brightwell(at)crunchydatasolutions(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: replicating DROP commands across servers
Date: 2014-12-24 14:08:50
Message-ID: CAHoyFK9uQoRwXXhBNjqFsfxAManouC5hvkxU2_9dZ5YY5xufLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 25 December 2014 at 00:34, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:

> On 2014-12-24 21:54:20 +1300, David Rowley wrote:
> > On 24 December 2014 at 07:41, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
> > wrote:
> >
> > > I have pushed patches 0001 through 0004, with some revisions. Only the
> > > final part is missing.
> > >
> > >
> > Hi Alvaro,
> >
> > Would you be able to commit the attached? It just fixes a new compiler
> > warning that I'm seeing on MSVC.
> >
> > src\backend\parser\parse_type.c(795): warning C4715:
> 'typeStringToTypeName'
> > : not all control paths return a value [D:\Postgres\a\postgres.vcxproj]
>
> Pushed.
>
> Thanks

> I really wonder if we can't make msvc reliably recognize this kind of
> scenario - especially this case is pretty trivial?
>
> Which of:
> #if defined(HAVE__BUILTIN_UNREACHABLE) && !defined(USE_ASSERT_CHECKING)
> #define pg_unreachable() __builtin_unreachable()
> #elif defined(_MSC_VER) && !defined(USE_ASSERT_CHECKING)
> #define pg_unreachable() __assume(0)
> #else
> #define pg_unreachable() abort()
> #endif
>
>
I don't think the problem is here. The problem is the the elevel being set
to a variable in the elog macro to prevent the multiple evaluation problem,
then since it does int elevel_ = elevel ... if (elevel_ >= ERROR) that's
not constant, or at least the microsoft compiler is not smart enough to see
that it is.

The attached patch removes the warning, but likely can't be used in case
someone somewhere is doing elog(var++, "my error");

Compiling with the attached shaves almost 1% off the size of postgres.exe:

before; 5,882,368 bytes
after: 5,830,656 bytes

I've been trawling around to try to see if anything
like __builtin_constant_p() exists for MSVC, but so far I've not found
anything useful.

Kind Regards

David Rowley

Attachment Content-Type Size
elog_hacks.diff text/plain 1.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-12-24 14:15:34 Re: Commit timestamp abbreviations
Previous Message nikita.y.volkov 2014-12-24 14:01:53 BUG #12330: ACID is broken for unique constraints