Re: Further simplification of c.h's #include section

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Further simplification of c.h's #include section
Дата
Msg-id 7561.1510784531@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Further simplification of c.h's #include section  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Further simplification of c.h's #include section
Список pgsql-hackers
I wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Wed, Nov 15, 2017 at 4:32 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> How do you feel about "win32_more.h"?

>> Seems morally equivalent to what you had before.  I think what I would
>> be looking for is a filename that somehow conveys what the difference
>> is between what should go in the existing file and what should go in
>> the new file.  If we don't know, maybe we should find out before we
>> change things.

> Well, the point is whether it gets included before or after the key
> system header files.  "win32_post_headers.h", perhaps?

Actually, on closer inspection, it seems like there's no need for
a windows-specific #include right there at all.  We could move
almost everything that's currently in win32.h to be done in port.h,
at the bottom of c.h rather than at the top.  The only exception
is stuff that would affect #if decisions taken in c.h itself, which
it looks like is only PGDLLIMPORT/PGDLLEXPORT, and those two could
perfectly well be declared before importing system headers.

Now, dropping everything in win32.h into port.h is surely no improvement,
but it seems like we could move all that stuff to a new file
"win32_port.h" and have the bottom of c.h look like

/* Windows-specific compatibility functions */
#if defined(WIN32) || defined(__CYGWIN__)
#include "win32_port.h"
#endif

/* Generic compatibility functions */
#include "port.h"

or else make the new file a sub-include of port.h.

There's also some fair-size stanzas in port.h that could arguably
be moved into win32_port.h if we did it like this.  I think the
parts that are #if WIN32 something #else something-else #endif
are fine as-is, but the parts that are just WIN32 without any
corresponding non-Windows code could be moved.

Thoughts?
        regards, tom lane


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

Предыдущее
От: Dmitry Dolgov
Дата:
Сообщение: Re: [HACKERS] [PATCH] Generic type subscripting
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] Timeline ID in backup_label file