From: Bruce Momjian Date: Mon, 27 Sep 2004 23:24:45 +0000 (+0000) Subject: Add new macro as shorthand for MS VC and Borland C++: X-Git-Tag: REL8_0_0BETA4~264 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e1c8b37afb5669542272585245b0706fcad174da;p=postgresql Add new macro as shorthand for MS VC and Borland C++: + #if defined(_MSC_VER) || defined(__BORLANDC__) + #define WIN32_CLIENT_ONLY + #endif --- diff --git a/src/backend/libpq/ip.c b/src/backend/libpq/ip.c index 78a6372854..74bcda8eb1 100644 --- a/src/backend/libpq/ip.c +++ b/src/backend/libpq/ip.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.28 2004/08/29 05:06:43 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.29 2004/09/27 23:24:30 momjian Exp $ * * This file and the IPV6 implementation were initially provided by * Nigel Kukard , Linux Based Systems Design @@ -20,8 +20,7 @@ /* This is intended to be used in both frontend and backend, so use c.h */ #include "c.h" -#if !defined(_MSC_VER) && !defined(__BORLANDC__) - +#ifndef WIN32_CLIENT_ONLY #include #include #include @@ -34,8 +33,7 @@ #endif #include #include -#endif /* !defined(_MSC_VER) && - * !defined(__BORLANDC__) */ +#endif #include "libpq/ip.h" diff --git a/src/backend/utils/mb/encnames.c b/src/backend/utils/mb/encnames.c index 634861a205..a3260fd61c 100644 --- a/src/backend/utils/mb/encnames.c +++ b/src/backend/utils/mb/encnames.c @@ -2,7 +2,7 @@ * Encoding names and routines for work with it. All * in this file is shared bedween FE and BE. * - * $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.19 2004/09/17 21:59:57 petere Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.20 2004/09/27 23:24:33 momjian Exp $ */ #ifdef FRONTEND #include "postgres_fe.h" @@ -13,7 +13,7 @@ #include "utils/builtins.h" #endif -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#ifndef WIN32_CLIENT_ONLY #include #endif diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index f434725269..ede51f2f13 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2004, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.51 2004/08/29 05:06:54 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.52 2004/09/27 23:24:35 momjian Exp $ */ #include "postgres_fe.h" #include "common.h" @@ -12,7 +12,7 @@ #include #include -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#ifndef WIN32_CLIENT_ONLY #include #endif diff --git a/src/include/c.h b/src/include/c.h index fcdf6b404b..861b11ce0d 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/c.h,v 1.176 2004/09/27 22:11:22 momjian Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.177 2004/09/27 23:24:37 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -54,6 +54,10 @@ #include "pg_config_manual.h" /* must be after pg_config.h */ #if !defined(WIN32) && !defined(__CYGWIN__) #include "pg_config_os.h" /* must be before any system header files */ +#else +#if defined(_MSC_VER) || defined(__BORLANDC__) +#define WIN32_CLIENT_ONLY +#endif #endif #include "postgres_ext.h" @@ -76,7 +80,7 @@ #endif #if defined(WIN32) || defined(__CYGWIN__) -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#ifndef WIN32_CLIENT_ONLY /* We have to redefine some system functions after they are included above */ #include "pg_config_os.h" #else diff --git a/src/include/getaddrinfo.h b/src/include/getaddrinfo.h index 893e7106c7..f4bc4410ce 100644 --- a/src/include/getaddrinfo.h +++ b/src/include/getaddrinfo.h @@ -15,14 +15,14 @@ * * Copyright (c) 2003, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.12 2003/11/29 22:40:53 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.13 2004/09/27 23:24:37 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef GETADDRINFO_H #define GETADDRINFO_H -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#ifndef WIN32_CLIENT_ONLY #include #include #endif diff --git a/src/include/port.h b/src/include/port.h index 2c789fe4b3..e60bc60f02 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -6,16 +6,17 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/port.h,v 1.62 2004/09/27 20:37:20 momjian Exp $ + * $PostgreSQL: pgsql/src/include/port.h,v 1.63 2004/09/27 23:24:37 momjian Exp $ * *------------------------------------------------------------------------- */ -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#ifndef WIN32_CLIENT_ONLY /* for thread.c */ #include #include #endif + #include /* non-blocking */ @@ -169,7 +170,7 @@ extern int pgunlink(const char *path); extern int pgsymlink(const char *oldpath, const char *newpath); /* Include this first so later includes don't see these defines */ -#ifdef _MSC_VER +#ifdef WIN32_CLIENT_ONLY #include #endif @@ -183,7 +184,7 @@ extern bool rmtree(char *path, bool rmtopdir); #ifdef WIN32 /* open() replacement to allow delete of held files */ -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#ifndef WIN32_CLIENT_ONLY extern int win32_open(const char *, int,...); #define open(a,b,...) win32_open(a,b,##__VA_ARGS__) @@ -242,7 +243,7 @@ extern double rint(double x); #endif #ifndef HAVE_INET_ATON -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#ifndef WIN32_CLIENT_ONLY #include #include #endif diff --git a/src/include/port/win32.h b/src/include/port/win32.h index b2ebdd4e3f..7c85043e70 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.33 2004/09/14 03:50:17 tgl Exp $ */ +/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.34 2004/09/27 23:24:40 momjian Exp $ */ /* undefine and redefine after #include */ #undef mkdir @@ -31,7 +31,7 @@ #define DLLIMPORT __declspec (dllimport) #endif -#elif defined(WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__)) /* not CYGWIN or MingW */ +#elif defined(WIN32_CLIENT_ONLY) #if defined(_DLL) #define DLLIMPORT __declspec (dllexport) diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index 212f7a63cd..12022dc9da 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -23,7 +23,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.110 2004/08/29 05:07:00 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.111 2004/09/27 23:24:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -34,7 +34,7 @@ #include #include -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#ifndef WIN32_CLIENT_ONLY #include #include #endif diff --git a/src/port/getaddrinfo.c b/src/port/getaddrinfo.c index 906e161080..59da098f85 100644 --- a/src/port/getaddrinfo.c +++ b/src/port/getaddrinfo.c @@ -12,7 +12,7 @@ * Copyright (c) 2003, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.12 2003/11/29 19:52:13 pgsql Exp $ + * $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.13 2004/09/27 23:24:45 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,7 @@ /* This is intended to be used in both frontend and backend, so use c.h */ #include "c.h" -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#ifndef WIN32_CLIENT_ONLY #include #include #include diff --git a/src/port/inet_aton.c b/src/port/inet_aton.c index 9b099cc549..521e61dcf9 100644 --- a/src/port/inet_aton.c +++ b/src/port/inet_aton.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/port/inet_aton.c,v 1.6 2003/11/29 22:41:31 pgsql Exp $ +/* $PostgreSQL: pgsql/src/port/inet_aton.c,v 1.7 2004/09/27 23:24:45 momjian Exp $ * * This inet_aton() function was taken from the GNU C library and * incorporated into Postgres for those systems which do not have this @@ -44,7 +44,7 @@ #include "c.h" -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#ifndef WIN32_CLIENT_ONLY #include #include #endif diff --git a/src/port/thread.c b/src/port/thread.c index 96610f9f5a..f950e419a1 100644 --- a/src/port/thread.c +++ b/src/port/thread.c @@ -7,7 +7,7 @@ * * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/port/thread.c,v 1.25 2004/08/29 05:07:02 momjian Exp $ + * $PostgreSQL: pgsql/src/port/thread.c,v 1.26 2004/09/27 23:24:45 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,7 @@ #include #include -#if defined(WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__)) +#ifdef WIN32_CLIENT_ONLY #undef ERROR #else #include