diff options
author | Bruno Haible <bruno@clisp.org> | 2005-08-26 11:30:05 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:12:48 +0200 |
commit | 218c0530c789cfb33572db153b8166b0de62254f (patch) | |
tree | 53238bc329e6f7cfff4161d4dcb1f38b8fbdce86 /gettext-runtime | |
parent | bce30c19bfb2bc312ee40c3b66c71b93290081ce (diff) | |
download | external_gettext-218c0530c789cfb33572db153b8166b0de62254f.zip external_gettext-218c0530c789cfb33572db153b8166b0de62254f.tar.gz external_gettext-218c0530c789cfb33572db153b8166b0de62254f.tar.bz2 |
Support for improved format string checking by GCC.
Diffstat (limited to 'gettext-runtime')
-rw-r--r-- | gettext-runtime/intl/ChangeLog | 6 | ||||
-rw-r--r-- | gettext-runtime/intl/libgnuintl.h.in | 33 |
2 files changed, 33 insertions, 6 deletions
diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index 87cc8ec..3d20e17 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,9 @@ +2005-08-25 Bruno Haible <bruno@clisp.org> + + * libintl.glibc: Update from current glibc. + * libgnuintl.h.in (_INTL_MAY_RETURN_STRING_ARG): New macro. + (gettext, dgettext, dcgettext, ngettext, dngettext, dcngettext): + 2005-08-21 Bruno Haible <bruno@clisp.org> * lock.h: Add multiple inclusion guard. diff --git a/gettext-runtime/intl/libgnuintl.h.in b/gettext-runtime/intl/libgnuintl.h.in index d0df699..1743a27 100644 --- a/gettext-runtime/intl/libgnuintl.h.in +++ b/gettext-runtime/intl/libgnuintl.h.in @@ -107,12 +107,22 @@ extern int libintl_version; # 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 +# 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); static inline char *gettext (const char *__msgid) + _INTL_MAY_RETURN_STRING_ARG (1) { return libintl_gettext (__msgid); } @@ -121,7 +131,8 @@ 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 @@ -129,6 +140,7 @@ extern char *gettext (const char *__msgid) #ifdef _INTL_REDIRECT_INLINE extern char *libintl_dgettext (const char *__domainname, const char *__msgid); static inline char *dgettext (const char *__domainname, const char *__msgid) + _INTL_MAY_RETURN_STRING_ARG (2) { return libintl_dgettext (__domainname, __msgid); } @@ -137,7 +149,8 @@ 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 @@ -147,6 +160,7 @@ extern char *libintl_dcgettext (const char *__domainname, const char *__msgid, int __category); static inline char *dcgettext (const char *__domainname, const char *__msgid, int __category) + _INTL_MAY_RETURN_STRING_ARG (2) { return libintl_dcgettext (__domainname, __msgid, __category); } @@ -156,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 @@ -167,6 +182,7 @@ extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2, unsigned long int __n); static inline char *ngettext (const char *__msgid1, const char *__msgid2, unsigned long int __n) + _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2) { return libintl_ngettext (__msgid1, __msgid2, __n); } @@ -176,7 +192,8 @@ 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 @@ -186,6 +203,7 @@ extern char *libintl_dngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n); static inline char *dngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n) + _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3) { return libintl_dngettext (__domainname, __msgid1, __msgid2, __n); } @@ -196,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 @@ -208,6 +227,7 @@ extern char *libintl_dcngettext (const char *__domainname, static inline char *dcngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n, int __category) + _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3) { return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category); } @@ -218,7 +238,8 @@ 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 |