Commit a4c75ece authored by Neil Conway's avatar Neil Conway

Fix a few macro definitions to ensure that unary minus is enclosed in

parentheses. This avoids possible operator precedence problems, and
is consistent with most of the macro definitions in the tree.
parent b98b75eb
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* formatting.c * formatting.c
* *
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.93 2005/07/23 14:25:33 momjian Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.94 2005/07/27 12:44:09 neilc Exp $
* *
* *
* Portions Copyright (c) 1999-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1999-2005, PostgreSQL Global Development Group
...@@ -292,7 +292,7 @@ typedef struct ...@@ -292,7 +292,7 @@ typedef struct
#define NUM_F_PLUS_POST (1 << 12) #define NUM_F_PLUS_POST (1 << 12)
#define NUM_F_MINUS_POST (1 << 13) #define NUM_F_MINUS_POST (1 << 13)
#define NUM_LSIGN_PRE -1 #define NUM_LSIGN_PRE (-1)
#define NUM_LSIGN_POST 1 #define NUM_LSIGN_POST 1
#define NUM_LSIGN_NONE 0 #define NUM_LSIGN_NONE 0
...@@ -384,27 +384,27 @@ typedef struct ...@@ -384,27 +384,27 @@ typedef struct
yysz; /* is it YY or YYYY ? */ yysz; /* is it YY or YYYY ? */
} TmFromChar; } TmFromChar;
#define ZERO_tmfc( _X ) memset(_X, 0, sizeof(TmFromChar)) #define ZERO_tmfc(_X) memset(_X, 0, sizeof(TmFromChar))
/* ---------- /* ----------
* Debug * Debug
* ---------- * ----------
*/ */
#ifdef DEBUG_TO_FROM_CHAR #ifdef DEBUG_TO_FROM_CHAR
#define DEBUG_TMFC( _X ) \ #define DEBUG_TMFC(_X) \
elog(DEBUG_elog_output, "TMFC:\nhh %d\nam %d\npm %d\nmi %d\nss %d\nssss %d\nd %d\ndd %d\nddd %d\nmm %d\nms: %d\nyear %d\nbc %d\niw %d\nww %d\nw %d\ncc %d\nq %d\nj %d\nus: %d\nyysz: %d", \ elog(DEBUG_elog_output, "TMFC:\nhh %d\nam %d\npm %d\nmi %d\nss %d\nssss %d\nd %d\ndd %d\nddd %d\nmm %d\nms: %d\nyear %d\nbc %d\niw %d\nww %d\nw %d\ncc %d\nq %d\nj %d\nus: %d\nyysz: %d", \
(_X)->hh, (_X)->am, (_X)->pm, (_X)->mi, (_X)->ss, \ (_X)->hh, (_X)->am, (_X)->pm, (_X)->mi, (_X)->ss, \
(_X)->ssss, (_X)->d, (_X)->dd, (_X)->ddd, (_X)->mm, (_X)->ms, \ (_X)->ssss, (_X)->d, (_X)->dd, (_X)->ddd, (_X)->mm, (_X)->ms, \
(_X)->year, (_X)->bc, (_X)->iw, (_X)->ww, (_X)->w, \ (_X)->year, (_X)->bc, (_X)->iw, (_X)->ww, (_X)->w, \
(_X)->cc, (_X)->q, (_X)->j, (_X)->us, (_X)->yysz); (_X)->cc, (_X)->q, (_X)->j, (_X)->us, (_X)->yysz);
#define DEBUG_TM( _X ) \ #define DEBUG_TM(_X) \
elog(DEBUG_elog_output, "TM:\nsec %d\nyear %d\nmin %d\nwday %d\nhour %d\nyday %d\nmday %d\nnisdst %d\nmon %d\n",\ elog(DEBUG_elog_output, "TM:\nsec %d\nyear %d\nmin %d\nwday %d\nhour %d\nyday %d\nmday %d\nnisdst %d\nmon %d\n",\
(_X)->tm_sec, (_X)->tm_year,\ (_X)->tm_sec, (_X)->tm_year,\
(_X)->tm_min, (_X)->tm_wday, (_X)->tm_hour, (_X)->tm_yday,\ (_X)->tm_min, (_X)->tm_wday, (_X)->tm_hour, (_X)->tm_yday,\
(_X)->tm_mday, (_X)->tm_isdst, (_X)->tm_mon) (_X)->tm_mday, (_X)->tm_isdst, (_X)->tm_mon)
#else #else
#define DEBUG_TMFC( _X ) #define DEBUG_TMFC(_X)
#define DEBUG_TM( _X ) #define DEBUG_TM(_X)
#endif #endif
/* ---------- /* ----------
...@@ -422,14 +422,14 @@ typedef struct TmToChar ...@@ -422,14 +422,14 @@ typedef struct TmToChar
#define tmtcTzn(_X) ((_X)->tzn) #define tmtcTzn(_X) ((_X)->tzn)
#define tmtcFsec(_X) ((_X)->fsec) #define tmtcFsec(_X) ((_X)->fsec)
#define ZERO_tm( _X ) \ #define ZERO_tm(_X) \
do { \ do { \
(_X)->tm_sec = (_X)->tm_year = (_X)->tm_min = (_X)->tm_wday = \ (_X)->tm_sec = (_X)->tm_year = (_X)->tm_min = (_X)->tm_wday = \
(_X)->tm_hour = (_X)->tm_yday = (_X)->tm_isdst = 0; \ (_X)->tm_hour = (_X)->tm_yday = (_X)->tm_isdst = 0; \
(_X)->tm_mday = (_X)->tm_mon = 1; \ (_X)->tm_mday = (_X)->tm_mon = 1; \
} while(0) } while(0)
#define ZERO_tmtc( _X ) \ #define ZERO_tmtc(_X) \
do { \ do { \
ZERO_tm( tmtcTm(_X) ); \ ZERO_tm( tmtcTm(_X) ); \
tmtcFsec(_X) = 0; \ tmtcFsec(_X) = 0; \
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.65 2005/06/21 20:45:44 tgl Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.66 2005/07/27 12:44:10 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#define GZCLOSE(fh) fclose(fh) #define GZCLOSE(fh) fclose(fh)
#define GZWRITE(p, s, n, fh) (fwrite(p, s, n, fh) * (s)) #define GZWRITE(p, s, n, fh) (fwrite(p, s, n, fh) * (s))
#define GZREAD(p, s, n, fh) fread(p, s, n, fh) #define GZREAD(p, s, n, fh) fread(p, s, n, fh)
#define Z_DEFAULT_COMPRESSION -1 #define Z_DEFAULT_COMPRESSION (-1)
typedef struct _z_stream typedef struct _z_stream
{ {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* Copyright (c) 2003-2005, PostgreSQL Global Development Group * Copyright (c) 2003-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.14 2005/01/01 20:44:26 tgl Exp $ * $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.15 2005/07/27 12:44:10 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -31,15 +31,15 @@ ...@@ -31,15 +31,15 @@
/* Various macros that ought to be in <netdb.h>, but might not be */ /* Various macros that ought to be in <netdb.h>, but might not be */
#ifndef EAI_FAIL #ifndef EAI_FAIL
#define EAI_BADFLAGS -1 #define EAI_BADFLAGS (-1)
#define EAI_NONAME -2 #define EAI_NONAME (-2)
#define EAI_AGAIN -3 #define EAI_AGAIN (-3)
#define EAI_FAIL -4 #define EAI_FAIL (-4)
#define EAI_FAMILY -6 #define EAI_FAMILY (-6)
#define EAI_SOCKTYPE -7 #define EAI_SOCKTYPE (-7)
#define EAI_SERVICE -8 #define EAI_SERVICE (-8)
#define EAI_MEMORY -10 #define EAI_MEMORY (-10)
#define EAI_SYSTEM -11 #define EAI_SYSTEM (-11)
#endif #endif
#ifndef AI_PASSIVE #ifndef AI_PASSIVE
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/rusagestub.h,v 1.15 2004/12/31 22:03:19 pgsql Exp $ * $PostgreSQL: pgsql/src/include/rusagestub.h,v 1.16 2005/07/27 12:44:10 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <limits.h> /* for CLK_TCK */ #include <limits.h> /* for CLK_TCK */
#define RUSAGE_SELF 0 #define RUSAGE_SELF 0
#define RUSAGE_CHILDREN -1 #define RUSAGE_CHILDREN (-1)
struct rusage struct rusage
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment