Re: make pg_attribute_noreturn() work for msvc?

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: make pg_attribute_noreturn() work for msvc?
Date: 2019-11-12 23:15:28
Message-ID: 30433.1573600528@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> It's worthwhile to note - I forgot this - that noreturn actually has
> been standardized in C11 and C++11. For C11 the keyword is _Noreturn,
> with a convenience macro 'noreturn' defined in stdnoreturn.h.

> For C++11, the syntax is (please don't get an aneurysm...):
> [[ noreturn ]] void funcname(params)...
> (yes, the [[]] are actually part of the syntax, not some BNF like thing)

Egad. I'd *want* to hide that under a macro :-(

> While it looks tempting to just use 'noreturn', and backfill it if the
> current environment doesn't support it, I think that's a bit too
> dangerous, because it will tend to break other code like
> __attribute__((noreturn)) and _declspec(noreturn). As there's plenty
> other software using either or both of these, I don't think it's worth
> going there.

Agreed, defining noreturn is too dangerous, it'll have to be
pg_noreturn. Or maybe use _Noreturn? But that feels ugly too.

Anyway, I still like the idea of merging the void keyword in with
that.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-11-12 23:20:56 Re: checking my understanding of TupleDesc
Previous Message Andres Freund 2019-11-12 23:13:02 Re: checking my understanding of TupleDesc