Re: make pg_attribute_noreturn() work for msvc? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: make pg_attribute_noreturn() work for msvc?
Date
Msg-id 30433.1573600528@sss.pgh.pa.us
Whole thread Raw
In response to Re: make pg_attribute_noreturn() work for msvc?  (Andres Freund <andres@anarazel.de>)
Responses Re: make pg_attribute_noreturn() work for msvc?
List pgsql-hackers
Andres Freund <andres@anarazel.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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: checking my understanding of TupleDesc
Next
From: Tom Lane
Date:
Subject: Re: checking my understanding of TupleDesc