Re: pg_bsd_indent compiles bytecode

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me>, Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_bsd_indent compiles bytecode
Date: 2020-06-30 01:27:48
Message-ID: 445644.1593480468@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
>> The way that pg_bsd_indent defines its variables isn't standard C, as
>> far as I can tell, which explains the errors I was getting. All the
>> individual files include indent_globs.h, which declares/defines a bunch
>> of variables. Since it doesn't use extern, they'll all end up as full
>> definitions in each .o when -fno-common is used (the default now), hence
>> the multiple definition errors. The only reason it works with -fcommon
>> is that they'll end up processed as weak symbols and 'deduplicated' at
>> link time.

> Ugh. I agree that's pretty bogus, even if there's anything in the
> C standard that allows it. I'll put it on my to-do list.

I pushed the attached patch to the pg_bsd_indent repo. Perhaps Piotr
would like to absorb it into upstream.

I don't intend to mark pg_bsd_indent with a new release number for
this --- for people who successfully compiled, it's the same as before.

regards, tom lane

Attachment Content-Type Size
fix-dup-globals-in-pg_bsd_indent.patch text/x-diff 11.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-06-30 01:38:44 Re: pg_bsd_indent compiles bytecode
Previous Message Andres Freund 2020-06-30 01:17:29 Re: More efficient RI checks - take 2