Re: Fix for clashing #defines of ERROR

Lists: pgsql-patches
From: Gerhard Häring <haering_python(at)gmx(dot)de>
To: pgsql-patches(at)postgresql(dot)org
Subject: Fix for clashing #defines of ERROR
Date: 2001-08-27 19:03:46
Message-ID: 3B8A9992.2070706@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

This fixes clashing defines of ERROR. On win32, winapi.h is included, which
includes windows.h, which #defines ERROR to 0. PostgreSQL's logging functions
define ERROR to -1. This patch redefines ERROR to -1 to avoid current or
future breakage of the logging functions.

Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))

Attachment Content-Type Size
win32_error_define_clash.dif text/plain 514 bytes

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gerhard Häring <haering_python(at)gmx(dot)de>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Fix for clashing #defines of ERROR
Date: 2001-09-03 23:47:42
Message-ID: 200109032347.f83Nlgl02467@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

> This fixes clashing defines of ERROR. On win32, winapi.h is included, which
> includes windows.h, which #defines ERROR to 0. PostgreSQL's logging functions
> define ERROR to -1. This patch redefines ERROR to -1 to avoid current or
> future breakage of the logging functions.
>
> Gerhard
> --
> mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
> web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage
> public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
> reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))

> diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/include/libpq/pqcomm.h ./src/include/libpq/pqcomm.h
> *** ../pgsql_HEAD/src/include/libpq/pqcomm.h Mon Aug 27 20:43:58 2001
> --- ./src/include/libpq/pqcomm.h Mon Aug 27 20:46:56 2001
> ***************
> *** 19,24 ****
> --- 19,28 ----
> #include <sys/types.h>
> #ifdef WIN32
> #include <winsock.h>
> + /* workaround for clashing defines of "ERROR" */
> + #ifdef ELOG_H
> + #define ERROR (-1)
> + #endif
> #else /* not WIN32 */
> #include <sys/socket.h>
> #ifdef HAVE_SYS_UN_H
>

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gerhard Häring <haering_python(at)gmx(dot)de>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Fix for clashing #defines of ERROR
Date: 2001-09-06 03:18:44
Message-ID: 200109060318.f863Iin06212@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


I have applied the patch with the addition of an #undef before the
#define. (Tom recommended.) Thanks.

> This fixes clashing defines of ERROR. On win32, winapi.h is included, which
> includes windows.h, which #defines ERROR to 0. PostgreSQL's logging functions
> define ERROR to -1. This patch redefines ERROR to -1 to avoid current or
> future breakage of the logging functions.
>
> Gerhard
> --
> mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
> web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage
> public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
> reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))

> diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/include/libpq/pqcomm.h ./src/include/libpq/pqcomm.h
> *** ../pgsql_HEAD/src/include/libpq/pqcomm.h Mon Aug 27 20:43:58 2001
> --- ./src/include/libpq/pqcomm.h Mon Aug 27 20:46:56 2001
> ***************
> *** 19,24 ****
> --- 19,28 ----
> #include <sys/types.h>
> #ifdef WIN32
> #include <winsock.h>
> + /* workaround for clashing defines of "ERROR" */
> + #ifdef ELOG_H
> + #define ERROR (-1)
> + #endif
> #else /* not WIN32 */
> #include <sys/socket.h>
> #ifdef HAVE_SYS_UN_H
>

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026