>
> > The recent changes in the tracing code are unfortunately not portable.
> >
> > #define PRINTF(args...) tprintf(TRACE_ALL, args)
> >
> > is not accepted by all compilers. Is there another way to express this ?
> > Is my AIX xlc Version 3.1.4 the only one with this problem ?
>
> Yikes, that is certainly not standard C. I have never seen that before.
> Looks like a GNU-ism. I nice one, but still a GNU-ism.
Sorry, I didn't know it is a GNU extension. I have written this patch
which should fix the problem. Let me know if you still have problems.
*** src/include/utils/trace.h.orig Tue Aug 25 23:43:47 1998
--- src/include/utils/trace.h Mon Aug 31 22:35:47 1998
***************
*** 26,31 ****
--- 26,32 ----
#define TIMESTAMP_SIZE 0
#endif
+ extern int tprintf1(const char *fmt, ...);
extern int tprintf(int flag, const char *fmt, ...);
extern int eprintf(const char *fmt, ...);
extern int option_flag(int flag);
***************
*** 70,78 ****
extern int pg_options[NUM_PG_OPTIONS];
! #define PRINTF(args...) tprintf(TRACE_ALL, args)
#define EPRINTF(args...) eprintf(args)
#define TPRINTF(flag, args...) tprintf(flag, args)
#endif /* TRACE_H */
--- 71,85 ----
extern int pg_options[NUM_PG_OPTIONS];
! #ifdef __GNUC__
! #define PRINTF(args...) tprintf1(args)
#define EPRINTF(args...) eprintf(args)
#define TPRINTF(flag, args...) tprintf(flag, args)
+ #else
+ #define PRINTF tprintf1
+ #define EPRINTF eprintf
+ #define TPRINTF tprintf
+ #endif
#endif /* TRACE_H */
*** src/backend/utils/misc/trace.c.orig Tue Aug 25 23:43:47 1998
--- src/backend/utils/misc/trace.c Mon Aug 31 22:36:10 1998
***************
*** 126,131 ****
--- 126,159 ----
}
/*
+ * Print a timestamp and a message to stdout or to syslog.
+ */
+ int
+ tprintf1(const char *fmt, ... )
+ {
+ va_list ap;
+ char line[ELOG_MAXLEN+TIMESTAMP_SIZE+1];
+
+ va_start(ap, fmt);
+ #ifdef ELOG_TIMESTAMPS
+ strcpy(line, tprintf_timestamp());
+ #endif
+ vsprintf(line+TIMESTAMP_SIZE, fmt, ap);
+ va_end(ap);
+
+ #ifdef USE_SYSLOG
+ write_syslog(LOG_INFO, line+TIMESTAMP_SIZE);
+ #endif
+
+ if (UseSyslog <= 1) {
+ puts(line);
+ fflush(stdout);
+ }
+
+ return 1;
+ }
+
+ /*
* Print a timestamp and a message to stderr.
*/
int
--
Massimo Dal Zotto
+----------------------------------------------------------------------+
| Massimo Dal Zotto email: dz@cs.unitn.it |
| Via Marconi, 141 phone: ++39-461-534251 |
| 38057 Pergine Valsugana (TN) www: http://www.cs.unitn.it/~dz/ |
| Italy pgp: finger dz@tango.cs.unitn.it |
+----------------------------------------------------------------------+