Re: Support pg_attribute_aligned and noreturn in MSVC

Поиск
Список
Период
Сортировка
От James Coleman
Тема Re: Support pg_attribute_aligned and noreturn in MSVC
Дата
Msg-id CAAaqYe_hV6Qp53uJ2p_XPjB1tMQ6G2Jy3Hpq+HxsjH+urLqgyQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Support pg_attribute_aligned and noreturn in MSVC  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: Support pg_attribute_aligned and noreturn in MSVC
Список pgsql-hackers
On Mon, Sep 19, 2022 at 8:21 PM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Mon, Sep 19, 2022 at 06:21:58PM -0400, James Coleman wrote:
> > It turns out that MSVC supports both noreturn [2] [3] and alignment
> > [4] [5] attributes, so this patch adds support for those. MSVC also
> > supports a form of packing, but the implementation as I can tell
> > requires wrapping the entire struct (with a push/pop declaration set)
> > [6], which doesn't seem to match the style of macros we're using for
> > packing in other compilers, so I opted not to implement that
> > attribute.
>
> Interesting.  Thanks for the investigation.
>
> +/*
> + * MSVC supports aligned and noreturn
> + * Packing is also possible but only by wrapping the entire struct definition
> + * which doesn't fit into our current macro declarations.
> + */
> +#elif defined(_MSC_VER)
> +#define pg_attribute_aligned(a) __declspec(align(a))
> +#define pg_attribute_noreturn() __declspec(noreturn)
>  #else
> Nit: I think that the comment should be in the elif block for Visual.

I was following the style of the comment outside the "if", but I'm not
attached to that style, so changed in this version.

> pg_attribute_aligned() could be used in generic-msvc.h's
> pg_atomic_uint64 as it uses now align.

Added.

> Shouldn't HAVE_PG_ATTRIBUTE_NORETURN be set for the MSVC case as well?

Yes, fixed.

James Coleman

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Support pg_attribute_aligned and noreturn in MSVC
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Support tls-exporter as channel binding for TLSv1.3