summaryrefslogtreecommitdiffstats
path: root/intl/libgnuintl.h.in
diff options
context:
space:
mode:
Diffstat (limited to 'intl/libgnuintl.h.in')
-rw-r--r--intl/libgnuintl.h.in64
1 files changed, 50 insertions, 14 deletions
diff --git a/intl/libgnuintl.h.in b/intl/libgnuintl.h.in
index d1df17e..5e1ccd6 100644
--- a/intl/libgnuintl.h.in
+++ b/intl/libgnuintl.h.in
@@ -1,5 +1,5 @@
/* Message catalogs for internationalization.
- Copyright (C) 1995-1997, 2000-2004 Free Software Foundation, Inc.
+ Copyright (C) 1995-1997, 2000-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -52,6 +52,11 @@ extern "C" {
#endif
+/* Version number: (major<<16) + (minor<<8) + subminor */
+#define LIBINTL_VERSION 0x001000
+extern int libintl_version;
+
+
/* We redirect the functions to those prefixed with "libintl_". This is
necessary, because some systems define gettext/textdomain/... in the C
library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
@@ -83,7 +88,7 @@ extern "C" {
If he doesn't, we choose the method. A third possible method is
_INTL_REDIRECT_ASM, supported only by GCC. */
#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
-# if __GNUC__ >= 2 && !defined __APPLE_CC__ && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
+# if __GNUC__ >= 2 && !(__APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
# define _INTL_REDIRECT_ASM
# else
# ifdef __cplusplus
@@ -102,11 +107,21 @@ extern "C" {
# define _INTL_ASM(cname)
#endif
+/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
+ its n-th argument literally. This enables GCC to warn for example about
+ printf (gettext ("foo %y")). */
+#if __GNUC__ >= 3 && !(__APPLE_CC__ > 1 && defined __cplusplus)
+# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
+#else
+# define _INTL_MAY_RETURN_STRING_ARG(n)
+#endif
+
/* Look up MSGID in the current default message catalog for the current
LC_MESSAGES locale. If not found, returns MSGID itself (the default
text). */
#ifdef _INTL_REDIRECT_INLINE
-extern char *libintl_gettext (const char *__msgid);
+extern char *libintl_gettext (const char *__msgid)
+ _INTL_MAY_RETURN_STRING_ARG (1);
static inline char *gettext (const char *__msgid)
{
return libintl_gettext (__msgid);
@@ -116,13 +131,15 @@ static inline char *gettext (const char *__msgid)
# define gettext libintl_gettext
#endif
extern char *gettext (const char *__msgid)
- _INTL_ASM (libintl_gettext);
+ _INTL_ASM (libintl_gettext)
+ _INTL_MAY_RETURN_STRING_ARG (1);
#endif
/* Look up MSGID in the DOMAINNAME message catalog for the current
LC_MESSAGES locale. */
#ifdef _INTL_REDIRECT_INLINE
-extern char *libintl_dgettext (const char *__domainname, const char *__msgid);
+extern char *libintl_dgettext (const char *__domainname, const char *__msgid)
+ _INTL_MAY_RETURN_STRING_ARG (2);
static inline char *dgettext (const char *__domainname, const char *__msgid)
{
return libintl_dgettext (__domainname, __msgid);
@@ -132,14 +149,16 @@ static inline char *dgettext (const char *__domainname, const char *__msgid)
# define dgettext libintl_dgettext
#endif
extern char *dgettext (const char *__domainname, const char *__msgid)
- _INTL_ASM (libintl_dgettext);
+ _INTL_ASM (libintl_dgettext)
+ _INTL_MAY_RETURN_STRING_ARG (2);
#endif
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
locale. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
- int __category);
+ int __category)
+ _INTL_MAY_RETURN_STRING_ARG (2);
static inline char *dcgettext (const char *__domainname, const char *__msgid,
int __category)
{
@@ -151,7 +170,8 @@ static inline char *dcgettext (const char *__domainname, const char *__msgid,
#endif
extern char *dcgettext (const char *__domainname, const char *__msgid,
int __category)
- _INTL_ASM (libintl_dcgettext);
+ _INTL_ASM (libintl_dcgettext)
+ _INTL_MAY_RETURN_STRING_ARG (2);
#endif
@@ -159,7 +179,8 @@ extern char *dcgettext (const char *__domainname, const char *__msgid,
number N. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
- unsigned long int __n);
+ unsigned long int __n)
+ _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
static inline char *ngettext (const char *__msgid1, const char *__msgid2,
unsigned long int __n)
{
@@ -171,14 +192,16 @@ static inline char *ngettext (const char *__msgid1, const char *__msgid2,
#endif
extern char *ngettext (const char *__msgid1, const char *__msgid2,
unsigned long int __n)
- _INTL_ASM (libintl_ngettext);
+ _INTL_ASM (libintl_ngettext)
+ _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
#endif
/* Similar to `dgettext' but select the plural form corresponding to the
number N. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
- const char *__msgid2, unsigned long int __n);
+ const char *__msgid2, unsigned long int __n)
+ _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
static inline char *dngettext (const char *__domainname, const char *__msgid1,
const char *__msgid2, unsigned long int __n)
{
@@ -191,7 +214,8 @@ static inline char *dngettext (const char *__domainname, const char *__msgid1,
extern char *dngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
unsigned long int __n)
- _INTL_ASM (libintl_dngettext);
+ _INTL_ASM (libintl_dngettext)
+ _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
#endif
/* Similar to `dcgettext' but select the plural form corresponding to the
@@ -199,7 +223,8 @@ extern char *dngettext (const char *__domainname,
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dcngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
- unsigned long int __n, int __category);
+ unsigned long int __n, int __category)
+ _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
static inline char *dcngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
unsigned long int __n, int __category)
@@ -213,10 +238,13 @@ static inline char *dcngettext (const char *__domainname,
extern char *dcngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
unsigned long int __n, int __category)
- _INTL_ASM (libintl_dcngettext);
+ _INTL_ASM (libintl_dcngettext)
+ _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
#endif
+#ifndef IN_LIBGLOCALE
+
/* Set the current default message catalog to DOMAINNAME.
If DOMAINNAME is null, return the current default.
If DOMAINNAME is "", reset to the default of "messages". */
@@ -271,6 +299,8 @@ extern char *bind_textdomain_codeset (const char *__domainname,
_INTL_ASM (libintl_bind_textdomain_codeset);
#endif
+#endif /* IN_LIBGLOCALE */
+
/* Support for format strings with positions in *printf(), following the
POSIX/XSI specification.
@@ -300,6 +330,12 @@ extern int fprintf (FILE *, const char *, ...);
extern int vfprintf (FILE *, const char *, va_list);
#undef printf
+#if defined __NetBSD__ || defined __CYGWIN__ || defined __MINGW32__
+/* Don't break __attribute__((format(printf,M,N))).
+ This redefinition is only possible because the libc in NetBSD, Cygwin,
+ mingw does not have a function __printf__. */
+# define libintl_printf __printf__
+#endif
#define printf libintl_printf
extern int printf (const char *, ...);
#undef vprintf