Re: Support pg_attribute_aligned and noreturn in MSVC
От | Michael Paquier |
---|---|
Тема | Re: Support pg_attribute_aligned and noreturn in MSVC |
Дата | |
Msg-id | YykHiEBq3DmRajUt@paquier.xyz обсуждение исходный текст |
Ответ на | Support pg_attribute_aligned and noreturn in MSVC (James Coleman <jtc331@gmail.com>) |
Ответы |
Re: Support pg_attribute_aligned and noreturn in MSVC
|
Список | pgsql-hackers |
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. pg_attribute_aligned() could be used in generic-msvc.h's pg_atomic_uint64 as it uses now align. Shouldn't HAVE_PG_ATTRIBUTE_NORETURN be set for the MSVC case as well? -- Michael
Вложения
В списке pgsql-hackers по дате отправления: