Re: Re: [COMMITTERS] pgsql: Add macros wrapping all usage of gcc's __attribute__.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Add macros wrapping all usage of gcc's __attribute__.
Date: 2015-03-26 15:27:32
Message-ID: 8058.1427383652@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2015-03-25 19:11:06 -0400, Tom Lane wrote:
>> I think this is a bad idea, because it's going to look like heck after
>> pgindent gets through with it. Do we actually need decoration on the
>> function definitions?

> Hm, I guess it should not look any worse than before?

It does, because pgindent treats "pg_attribute_noreturn" differently
than it treated "__attribute__((noreturn))". Before you'd end up
with something like

void
__attribute__((noreturn))
plpgsql_yyerror(const char *message)
{

pgindent forced the __attribute__(()) bit onto its own line, whether you
wrote it that way or not, but it doesn't look *too* awful. But now that
becomes:

void
pg_attribute_noreturn
plpgsql_yyerror(const char *message)
{

The best you can get is to manually put the noreturn back onto the
"void" line, but you still end up with:

void pg_attribute_noreturn
plpgsql_yyerror(const char *message)
{

So this is just ugly. Maybe we could teach pgindent not to do that,
but I'm doubtful.

> ... That said, I see little reason
> to add the noreturn thingy to the definition and not the declaration for
> those. It actually looks to me like there's a declaration for
> replication_yyerror, but a plain yyerror is used instead in repl_scanner.l?

Right.

Also, even in the context of extern declarations, it seems to be a lot
easier to get pgindent not to mess with your layout if
"pg_attribute_noreturn" is replaced with "pg_attribute_noreturn()".
I see no particular reason not to add parens to the macro, do you?

Being the one complaining, I'll go do the legwork to clean this up.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-03-26 16:00:35 pgsql: Suppress some unused-variable complaints in new LOCK_DEBUG code.
Previous Message Andres Freund 2015-03-26 13:19:55 Re: [COMMITTERS] pgsql: Add macros wrapping all usage of gcc's __attribute__.

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2015-03-26 15:54:29 Re: controlling psql's use of the pager a bit more
Previous Message Tom Lane 2015-03-26 15:10:34 Re: controlling psql's use of the pager a bit more