Re: [Proposal] Level4 Warnings show many shadow vars

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Ranier Vilela <ranier_gyn(at)hotmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [Proposal] Level4 Warnings show many shadow vars
Date: 2019-12-09 21:38:04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2019-12-09 11:59:23 -0500, Robert Haas wrote:
>> On Mon, Dec 9, 2019 at 11:48 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> The only thing I think is really a substantial bug risk here is your
>>> point about our own macros referencing our own global variables.
>>> We might be better off fixing that in a localized way by establishing
>>> a policy that any such macros should be converted to static inlines.

>> That would be a lot of work, but it would probably have some side
>> benefits, like making things more type-safe.

> It's also not always possible in C99, as we have plenty macros with
> essentially dynamic types. And there's no typeof() in standard C,
> unfortunately (C11's _Generic can help, but isn't great either).

How much overlap is there between macros referencing global variables
and macros with indeterminate types? Not much I bet. I'd mostly
be worried about things like CHECK_FOR_INTERRUPTS().

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2019-12-09 21:49:42 Re: [Proposal] Level4 Warnings show many shadow vars
Previous Message Greg Stark 2019-12-09 21:36:15 Re: VACUUM memory management