Re: Rethinking MemoryContext creation

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Rethinking MemoryContext creation
Date: 2017-12-11 17:42:51
Message-ID: CA+TgmoZx=248OF_KWp8zDHH+pZjOh3i5MW_r0qo3XF5U19oZjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 11, 2017 at 12:36 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> [ thinks... ] If we wanted to go that way, one thing we could do to
> help extension authors (and ourselves) is to define the proposed
> AllocSetContextCreate macro to include
>
> StaticAssertExpr(__builtin_constant_p(name))
>
> on compilers that have __builtin_constant_p. Now, that only helps
> people using gcc and gcc-alikes, but that's a large fraction of
> developers I should think. (I tested this and it does seem to
> correctly recognize string literals as constants.)

I like that idea. I think that would provide good protection not only
for third-party developers but for core developers.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-12-11 17:46:20 Re: [HACKERS] Custom compression methods
Previous Message Alexander Korotkov 2017-12-11 17:41:05 Re: [HACKERS] Custom compression methods