From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgreSQL.org
Subject: Further simplification of c.h's #include section
Date: Wed, 15 Nov 2017 10:51:20 -0500
Message-ID: <29650.1510761080@sss.pgh.pa.us> (raw)
Yesterday's commit 91aec93e6 got rid of quite a bit of unprincipled cruft
that had accumulated in c.h's #include section. It occurs to me that we
could clean it up some more, eliminating almost all the Windows-specific
hacking there, by doing this:
1. Move what's currently in src/include/port/win32.h (a/k/a
pg_config_os.h) to a new file, say src/include/port/win32_2.h.
2. Move these bits of c.h into win32.h:
#if defined(_WIN32) && !defined(WIN32)
#define WIN32
#endif
#if _MSC_VER >= 1400 || defined(HAVE_CRTDEFS_H)
#define errcode __msvc_errcode
#include <crtdefs.h>
#undef errcode
#endif
3. Then the #include for pg_config_os.h just becomes unconditional and
uncluttered.
4. Below the system #includes, where we have
#if defined(WIN32) || defined(__CYGWIN__)
/* We have to redefine some system functions after they are included above. */
#include "pg_config_os.h"
#endif
I'd propose just changing that to include "port/win32_2.h".
Aside from being cleaner, this would provide a clear framework for other
platforms to inject code both before and after the system headers.
To make that happen, we'd have to set up pg_config_os_2.h symlinks and
replace the above-quoted bit with #include "pg_config_os_2.h". I don't
feel a need to make that happen right now, but it'd be straightforward
to do it if we need to.
Once that's done, there might be reason to rethink the division of
code between win32.h and win32_2.h, but not being a Windows hacker
I'm not qualified to do that.
Thoughts, objections?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: Further simplification of c.h's #include section
In-Reply-To: <29650.1510761080@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox