1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-23 01:22:45 +02:00

Flag the L_() function with attribute format_arg.

* agent/agent.h (LunderscorePROTO): New.
* common/util.h (GNUPG_GCC_ATTR_FORMAT_ARG): New.
* common/i18n.h (GNUPG_GCC_ATTR_FORMAT_ARG): New. Use for
i18n_localegettext.  Expand LunderscorePROTO.
* agent/genkey.c (check_passphrase_constraints): Use xtryasprintf
again to keep the old translations.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-06-30 22:28:41 +02:00
parent e76d4c05b2
commit 232af382e5
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
4 changed files with 26 additions and 3 deletions

View File

@ -301,6 +301,10 @@ typedef int (*lookup_ttl_t)(const char *hexgrip);
the connection. The macro LunderscoreIMPL is used by i18n to
actually define the inline function when needed. */
#define L_(a) agent_Lunderscore (ctrl, (a))
#define LunderscorePROTO \
static inline const char *agent_Lunderscore (ctrl_t ctrl, \
const char *string) \
GNUPG_GCC_ATTR_FORMAT_ARG(2);
#define LunderscoreIMPL \
static inline const char * \
agent_Lunderscore (ctrl_t ctrl, const char *string) \

View File

@ -271,8 +271,9 @@ check_passphrase_constraints (ctrl_t ctrl, const char *pw,
goto leave;
}
msg3 = xtrystrdup (L_("A passphrase may not be a known term or match%0A"
"certain pattern."));
msg3 = xtryasprintf
(L_("A passphrase may not be a known term or match%%0A"
"certain pattern."));
if (!msg3)
{
err = gpg_error_from_syserror ();

View File

@ -38,14 +38,24 @@
# endif
#endif /*!USE_SIMPLE_GETTEXT*/
#ifndef GNUPG_GCC_ATTR_FORMAT_ARG
#if __GNUC__ >= 3 /* Actually 2.8 but testing the major is easier. */
# define GNUPG_GCC_ATTR_FORMAT_ARG(a) __attribute__ ((__format_arg__ (a)))
#else
# define GNUPG_GCC_ATTR_FORMAT_ARG(a)
#endif
#endif
void i18n_init (void);
char *i18n_switchto_utf8 (void);
void i18n_switchback (char *saved_codeset);
const char *i18n_utf8 (const char *string);
const char *i18n_localegettext (const char *lc_messages, const char *string);
const char *i18n_localegettext (const char *lc_messages, const char *string)
GNUPG_GCC_ATTR_FORMAT_ARG(2);
/* If a module wants a local L_() fucntion we define it here. */
#ifdef LunderscoreIMPL
LunderscorePROTO
LunderscoreIMPL
#endif

View File

@ -153,6 +153,14 @@
/* GCC attributes. */
#ifndef GNUPG_GCC_ATTR_FORMAT_ARG
#if __GNUC__ >= 3 /* Actually 2.8 but testing the major is easier. */
# define GNUPG_GCC_ATTR_FORMAT_ARG(a) __attribute__ ((__format_arg__ (a)))
#else
# define GNUPG_GCC_ATTR_FORMAT_ARG(a)
#endif
#endif
#if __GNUC__ >= 4
# define GNUPG_GCC_A_SENTINEL(a) __attribute__ ((sentinel(a)))
#else