Add a test case for skip with inlined functions
[deliverable/binutils-gdb.git] / intl / libgnuintl.h
index f6138affb5918fa9ab980b7bcf58ed22c3a41f13..7616d6fc0827c63d0fe0bd8f6fc7e7eca1458c65 100644 (file)
@@ -112,12 +112,24 @@ 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 defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && !(defined __clang__ && __clang__ && __clang_major__ >= 3) && 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);
-static inline char *gettext (const char *__msgid)
+extern char *libintl_gettext (const char *__msgid)
+       _INTL_MAY_RETURN_STRING_ARG (1);
+static inline
+_INTL_MAY_RETURN_STRING_ARG (1)
+char *gettext (const char *__msgid)
 {
   return libintl_gettext (__msgid);
 }
@@ -126,14 +138,18 @@ static inline char *gettext (const char *__msgid)
 # define gettext libintl_gettext
 #endif
 extern char *gettext _INTL_PARAMS ((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);
-static inline char *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
+_INTL_MAY_RETURN_STRING_ARG (2)
+char *dgettext (const char *__domainname, const char *__msgid)
 {
   return libintl_dgettext (__domainname, __msgid);
 }
@@ -143,16 +159,19 @@ static inline char *dgettext (const char *__domainname, const char *__msgid)
 #endif
 extern char *dgettext _INTL_PARAMS ((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);
-static inline char *dcgettext (const char *__domainname, const char *__msgid,
-                              int __category)
+                               int __category)
+       _INTL_MAY_RETURN_STRING_ARG (2);
+static inline
+_INTL_MAY_RETURN_STRING_ARG (2)
+char *dcgettext (const char *__domainname, const char *__msgid, int __category)
 {
   return libintl_dcgettext (__domainname, __msgid, __category);
 }
@@ -163,7 +182,8 @@ static inline char *dcgettext (const char *__domainname, const char *__msgid,
 extern char *dcgettext _INTL_PARAMS ((const char *__domainname,
                                      const char *__msgid,
                                      int __category))
-       _INTL_ASM (libintl_dcgettext);
+       _INTL_ASM (libintl_dcgettext)
+       _INTL_MAY_RETURN_STRING_ARG (2);
 #endif
 
 
@@ -171,9 +191,12 @@ extern char *dcgettext _INTL_PARAMS ((const char *__domainname,
    number N.  */
 #ifdef _INTL_REDIRECT_INLINE
 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)
+                              unsigned long int __n)
+       _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
+static inline
+_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2)
+char *ngettext (const char *__msgid1, const char *__msgid2,
+               unsigned long int __n)
 {
   return libintl_ngettext (__msgid1, __msgid2, __n);
 }
@@ -184,16 +207,20 @@ static inline char *ngettext (const char *__msgid1, const char *__msgid2,
 extern char *ngettext _INTL_PARAMS ((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);
-static inline char *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
+_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3)
+char *dngettext (const char *__domainname, const char *__msgid1,
+                const char *__msgid2, unsigned long int __n)
 {
   return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
 }
@@ -205,7 +232,8 @@ extern char *dngettext _INTL_PARAMS ((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
@@ -213,10 +241,13 @@ extern char *dngettext _INTL_PARAMS ((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);
-static inline char *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
+_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3)
+char *dcngettext (const char *__domainname,
+                 const char *__msgid1, const char *__msgid2,
+                 unsigned long int __n, int __category)
 {
   return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
 }
@@ -229,7 +260,8 @@ extern char *dcngettext _INTL_PARAMS ((const char *__domainname,
                                       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
 
 
This page took 0.026059 seconds and 4 git commands to generate.