Skip to content

Commit caad817

Browse files
committed
Add fprintf() custom version to libpgport.
Document use of macros for pg_printf functions. Bump major versions of all interfaces to handle movement of get_progname from libpq to libpgport in 8.0, and probably other libpgport changes in 8.1.
1 parent 3bc6bdf commit caad817

File tree

12 files changed

+64
-26
lines changed

12 files changed

+64
-26
lines changed

src/backend/bootstrap/bootscanner.l

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.38 2004/12/31 21:59:34 pgsql Exp $
12+
* $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.39 2005/03/11 19:13:42 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -42,6 +42,7 @@
4242

4343

4444
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
45+
#undef fprintf
4546
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
4647

4748

src/backend/parser/scan.l

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Portions Copyright (c) 1994, Regents of the University of California
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.120 2005/02/22 04:36:22 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.121 2005/03/11 19:13:42 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -28,6 +28,7 @@
2828

2929

3030
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
31+
#undef fprintf
3132
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
3233

3334
extern YYSTYPE yylval;

src/backend/utils/misc/guc-file.l

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.29 2005/01/01 05:43:08 momjian Exp $
7+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.30 2005/03/11 19:13:42 momjian Exp $
88
*/
99

1010
%{
@@ -19,6 +19,7 @@
1919
#include "utils/guc.h"
2020

2121
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
22+
#undef fprintf
2223
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
2324

2425
static unsigned ConfigFileLineno;

src/include/port.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.71 2005/03/11 17:20:34 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.72 2005/03/11 19:13:42 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -112,17 +112,27 @@ extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
112112
extern int pg_snprintf(char *str, size_t count, const char *fmt,...)
113113
/* This extension allows gcc to check the format string */
114114
__attribute__((format(printf, 3, 4)));
115+
extern int pg_fprintf(FILE *stream, const char *fmt,...)
116+
/* This extension allows gcc to check the format string */
117+
__attribute__((format(printf, 2, 3)));
115118
extern int pg_printf(const char *fmt,...)
116119
/* This extension allows gcc to check the format string */
117120
__attribute__((format(printf, 1, 2)));
118121

122+
/*
123+
* The GCC-specific code below prevents the __attribute__(... 'printf')
124+
* above from being replaced, and this is required because gcc doesn't
125+
* know anything about pg_printf.
126+
*/
119127
#ifdef __GNUC__
120-
#define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
128+
#define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
121129
#define snprintf(...) pg_snprintf(__VA_ARGS__)
130+
#define fprintf(...) pg_fprintf(__VA_ARGS__)
122131
#define printf(...) pg_printf(__VA_ARGS__)
123132
#else
124133
#define vsnprintf pg_vsnprintf
125134
#define snprintf pg_snprintf
135+
#define fprintf pg_fprintf
126136
#define printf pg_printf
127137
#endif
128138
#endif

src/interfaces/ecpg/compatlib/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.19 2005/01/18 05:00:15 momjian Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.20 2005/03/11 19:13:42 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -13,8 +13,8 @@ top_builddir = ../../../..
1313
include $(top_builddir)/src/Makefile.global
1414

1515
NAME= ecpg_compat
16-
SO_MAJOR_VERSION= 1
17-
SO_MINOR_VERSION= 2
16+
SO_MAJOR_VERSION= 2
17+
SO_MINOR_VERSION= 0
1818
DLTYPE= library
1919

2020
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) \

src/interfaces/ecpg/ecpglib/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.31 2005/01/26 19:24:01 tgl Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.32 2005/03/11 19:13:42 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -13,8 +13,8 @@ top_builddir = ../../../..
1313
include $(top_builddir)/src/Makefile.global
1414

1515
NAME= ecpg
16-
SO_MAJOR_VERSION= 4
17-
SO_MINOR_VERSION= 3
16+
SO_MAJOR_VERSION= 5
17+
SO_MINOR_VERSION= 0
1818
DLTYPE= library
1919

2020
override CPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/interfaces/ecpg/include \

src/interfaces/ecpg/pgtypeslib/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.24 2005/01/18 05:00:23 momjian Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.25 2005/03/11 19:13:43 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -13,8 +13,8 @@ top_builddir = ../../../..
1313
include $(top_builddir)/src/Makefile.global
1414

1515
NAME= pgtypes
16-
SO_MAJOR_VERSION= 1
17-
SO_MINOR_VERSION= 3
16+
SO_MAJOR_VERSION= 2
17+
SO_MINOR_VERSION= 0
1818
DLTYPE= library
1919

2020
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include \

src/interfaces/ecpg/preproc/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1998-2005, PostgreSQL Global Development Group
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.112 2005/01/25 12:51:31 meskes Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.113 2005/03/11 19:13:43 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -13,8 +13,8 @@ subdir = src/interfaces/ecpg/preproc
1313
top_builddir = ../../../..
1414
include $(top_builddir)/src/Makefile.global
1515

16-
MAJOR_VERSION=3
17-
MINOR_VERSION=2
16+
MAJOR_VERSION= 4
17+
MINOR_VERSION= 0
1818
PATCHLEVEL=1
1919

2020
override CPPFLAGS := -I$(srcdir)/../include -I$(srcdir) $(CPPFLAGS) \

src/interfaces/libpq/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.128 2005/01/26 19:24:02 tgl Exp $
8+
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.129 2005/03/11 19:13:43 momjian Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -16,8 +16,8 @@ include $(top_builddir)/src/Makefile.global
1616

1717
# shared library parameters
1818
NAME= pq
19-
SO_MAJOR_VERSION= 3
20-
SO_MINOR_VERSION= 3
19+
SO_MAJOR_VERSION= 4
20+
SO_MINOR_VERSION= 0
2121
DLTYPE= library
2222

2323
override CPPFLAGS := -DFRONTEND -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port

src/pl/plpgsql/src/scan.l

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* procedural language
55
*
66
* IDENTIFICATION
7-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.39 2005/02/22 07:18:24 neilc Exp $
7+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.40 2005/03/11 19:13:43 momjian Exp $
88
*
99
* This software is copyrighted by Jan Wieck - Hamburg.
1010
*
@@ -45,6 +45,7 @@
4545
#define YY_READ_BUF_SIZE 16777216
4646

4747
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
48+
#undef fprintf
4849
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
4950

5051
/* Handles to the buffer that the lexer uses internally */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy