Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitca43050

Browse files
committed
Add documentation on the use of *printf() macros and libintl.
Backpatch to 8.1.X.
1 parent73f47aa commitca43050

File tree

3 files changed

+63
-16
lines changed

3 files changed

+63
-16
lines changed

‎configure

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13894,11 +13894,31 @@ fi
1389413894
# have all the features we need --- see below.
1389513895

1389613896
if test "$PORTNAME" = "win32"; then
13897-
# Win32 gets this built unconditionally
13898-
# libintl versions prior to 0.13 use the native *printf functions.
13899-
# Win32 *printf does not understand %$, so on Win32 using pre-0.13 libintl
13900-
# it is necessary to use the pg versions of *printf to properly process
13901-
# NLS strings that use the %$ format.
13897+
# Win32 gets snprintf.c built unconditionally.
13898+
#
13899+
# To properly translate all NLS languages strings, we must support the
13900+
# *printf() %$ format, which allows *printf() arguments to be selected
13901+
# by position in the translated string.
13902+
#
13903+
# libintl versions < 0.13 use the native *printf() functions, and Win32
13904+
# *printf() doesn't understand %$, so we must use our /port versions,
13905+
# which do understand %$. libintl versions >= 0.13 include their own
13906+
# *printf versions on Win32. The libintl 0.13 release note text is:
13907+
#
13908+
# C format strings with positions, as they arise when a translator
13909+
# needs to reorder a sentence, are now supported on all platforms.
13910+
# On those few platforms (NetBSD and Woe32) for which the native
13911+
# printf()/fprintf()/... functions don't support such format
13912+
# strings, replacements are provided through <libintl.h>.
13913+
#
13914+
# We could use libintl >= 0.13's *printf() if we were sure that we had
13915+
# a litint >= 0.13 at runtime, but seeing that there is no clean way
13916+
# to guarantee that, it is best to just use our own, so we are sure to
13917+
# get %$ support. In include/port.h we disable the *printf() macros
13918+
# that might have been defined by libintl.
13919+
#
13920+
# We do this unconditionally whether NLS is used or not so we are sure
13921+
# that all Win32 libraries and binaries behave the same.
1390213922
pgac_need_repl_snprintf=yes
1390313923
else
1390413924
pgac_need_repl_snprintf=no
@@ -17158,9 +17178,12 @@ fi
1715817178
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
1715917179
fi
1716017180

17181+
# --------------------
17182+
# Run tests below here
17183+
# --------------------
1716117184

1716217185
# Force use of our snprintf if system's doesn't do arg control
17163-
#This feature is needed by NLS
17186+
#See comment above at snprintf test for details.
1716417187
if test "$enable_nls" = yes -a "$pgac_need_repl_snprintf" = no; then
1716517188
echo "$as_me:$LINENO: checking whether printf supports argument control" >&5
1716617189
echo $ECHO_N "checking whether printf supports argument control... $ECHO_C" >&6

‎configure.in

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.435 2005/12/0604:53:02 momjian Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.436 2005/12/0618:35:09 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -858,11 +858,31 @@ fi
858858
# have all the features we need --- see below.
859859

860860
if test "$PORTNAME" = "win32"; then
861-
# Win32 gets this built unconditionally
862-
# libintl versions prior to 0.13 use the native *printf functions.
863-
# Win32 *printf does not understand %$, so on Win32 using pre-0.13 libintl
864-
# it is necessary to use the pg versions of *printf to properly process
865-
# NLS strings that use the %$ format.
861+
# Win32 gets snprintf.c built unconditionally.
862+
#
863+
# To properly translate all NLS languages strings, we must support the
864+
# *printf() %$ format, which allows *printf() arguments to be selected
865+
# by position in the translated string.
866+
#
867+
# libintl versions < 0.13 use the native *printf() functions, and Win32
868+
# *printf() doesn't understand %$, so we must use our /port versions,
869+
# which do understand %$. libintl versions >= 0.13 include their own
870+
# *printf versions on Win32. The libintl 0.13 release note text is:
871+
#
872+
# C format strings with positions, as they arise when a translator
873+
# needs to reorder a sentence, are now supported on all platforms.
874+
# On those few platforms (NetBSD and Woe32) for which the native
875+
# printf()/fprintf()/... functions don't support such format
876+
# strings, replacements are provided through <libintl.h>.
877+
#
878+
# We could use libintl >= 0.13's *printf() if we were sure that we had
879+
# a litint >= 0.13 at runtime, but seeing that there is no clean way
880+
# to guarantee that, it is best to just use our own, so we are sure to
881+
# get %$ support. In include/port.h we disable the *printf() macros
882+
# that might have been defined by libintl.
883+
#
884+
# We do this unconditionally whether NLS is used or not so we are sure
885+
# that all Win32 libraries and binaries behave the same.
866886
pgac_need_repl_snprintf=yes
867887
else
868888
pgac_need_repl_snprintf=no
@@ -1059,9 +1079,12 @@ AC_MSG_ERROR([[
10591079
*** for the exact reason.]])],
10601080
[AC_MSG_RESULT([cross-compiling])])
10611081

1082+
# --------------------
1083+
# Run tests below here
1084+
# --------------------
10621085

10631086
# Force use of our snprintf if system's doesn't do arg control
1064-
#This feature is needed by NLS
1087+
#See comment above at snprintf test for details.
10651088
if test "$enable_nls" = yes -a "$pgac_need_repl_snprintf" = no; then
10661089
PGAC_FUNC_PRINTF_ARG_CONTROL
10671090
if test $pgac_cv_printf_arg_control != yes ; then

‎src/include/port.h

Lines changed: 4 additions & 3 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.86 2005/12/0605:13:46 tgl Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.87 2005/12/0618:35:10 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -115,8 +115,9 @@ extern unsigned char pg_tolower(unsigned char ch);
115115
#ifdefUSE_REPL_SNPRINTF
116116

117117
/*
118-
* Some versions of libintl try to replace printf and friends with macros;
119-
* if we are doing likewise, make sure our versions win.
118+
* Versions of libintl >= 0.13 try to replace printf() and friends with
119+
* macros to their own versions that understand the %$ format. We do the
120+
* same, so disable their macros, if they exist.
120121
*/
121122
#ifdefvsnprintf
122123
#undef vsnprintf

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp