Re: [HACKERS] datetime.h defines like PM conflict with externallibraries

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [HACKERS] datetime.h defines like PM conflict with externallibraries
Дата
Msg-id 20171003203644.mhe74zwrouwxxfw4@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: [HACKERS] datetime.h defines like PM conflict with externallibraries  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Ответы Re: [HACKERS] datetime.h defines like PM conflict with external libraries  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On 2017-10-03 16:34:38 -0400, Andrew Dunstan wrote:
> On 10/03/2017 03:00 PM, Andres Freund wrote:
> > Hi,
> >
> > In my llvm jit work I'd to
> >
> > #undef PM
> > /* include some llvm headers */
> > #define PM 1
> >
> > because llvm has a number of functions which have an argument named PM.
> > Now that works, but it's fairly ugly. Perhaps it would be a good idea to
> > name these defines in a manner that's slightly less likely to conflict?
> >
> > Alternatively we could use #pragma push_macro() around the includes, but
> > that'd be a new dependency.
> >
> > Better ideas?

> AFAICT at a quick glance these are only used in a couple of files. Maybe
> the defs need to be floated off to a different header with more limited
> inclusion?

Why not just rename them to PG_PM etc? If we force potential external
users to do some changes, we can use more unique names just as well -
the effort to adapt won't be meaningfully higher... IMNSHO there's not
much excuse for defining macros like PM globally.

- Andres


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: [HACKERS] datetime.h defines like PM conflict with externallibraries
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] datetime.h defines like PM conflict with external libraries