Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: problem with "#define printf libintl_printf" in "libintl.h"

8 views
Skip to first unread message

Bruno Haible

unread,
Jun 16, 2006, 11:43:11 AM6/16/06
to Henry Nelson, bug-gnu...@gnu.org
Hello,

Henry Nelson wrote:
> When I compile programs that will link to both libintl and libslang,
> warnings occur like:
> /usr/local/include/slang.h:899: warning: `libintl_printf' is an unrecognized
> format function type

This warning is harmless; the only effect is that you get less gcc
warnings about buggy code.

You can get rid of this warning by changing /usr/local/include/slang.h
to use

_SLATTRIBUTE_((__format__(__printf__,a,b)))

instead of

_SLATTRIBUTE_((format(printf,a,b)))

> If I also try to link with libiconv, then a fatal error will occur.

More details, please?

> Would it be possible to not redefine printf in "libintl.h"?

Depends on the system / OS and programming language (C or C++?) that
you are using. On which system are you seeing the problems?

Bruno


Henry Nelson

unread,
Jun 16, 2006, 5:11:31 AM6/16/06
to bug-gnu...@gnu.org
When I compile programs that will link to both libintl and libslang,
warnings occur like:
/usr/local/include/slang.h:899: warning: `libintl_printf' is an unrecognized
format function type

If I also try to link with libiconv, then a fatal error will occur.

Would it be possible to not redefine printf in "libintl.h"?

Thank you for any help with this problem.

--
henry n.

PS. The lines in slang.h which lead to warnings/errors are:
899
SL_EXTERN void SLang_verror (int, char *, ...) SLATTRIBUTE_PRINTF(2,3);
995
SL_EXTERN void SLang_vmessage (char *, ...) SLATTRIBUTE_PRINTF(1,2);
1002
SL_EXTERN void SLang_exit_error (char *, ...) SLATTRIBUTE_((format (printf, 1, 2
), noreturn));
1686
SL_EXTERN void SLsmg_printf (char *, ...) SLATTRIBUTE_PRINTF(1,2);


Henry Nelson

unread,
Jun 16, 2006, 6:23:24 PM6/16/06
to Bruno Haible, bug-gnu...@gnu.org
On Fri, Jun 16, 2006 at 05:43:11PM +0200, Bruno Haible wrote:
> Henry Nelson wrote:
> > When I compile programs that will link to both libintl and libslang,
> > warnings occur like:
> > /usr/local/include/slang.h:899: warning: `libintl_printf' is an unrecognized
> > format function type
[...]

> > If I also try to link with libiconv, then a fatal error will occur.
>
> More details, please?

Let me gather more information, and get back to you on this.

> > Would it be possible to not redefine printf in "libintl.h"?
>

> Depends on the system / OS and programming language (C or C++?) that
> you are using. On which system are you seeing the problems?

uname -sr => NetBSD 3.0.0_STABLE
gcc --version => gcc (GCC) 3.3.3 (NetBSD nb3 20040520)

The applications where this conflict applies (for me personally) are mutt
and lynx.

--
henry n.


Bruno Haible

unread,
Jun 20, 2006, 8:02:27 AM6/20/06
to Henry Nelson, bug-gnu...@gnu.org
Henry Nelson wrote:
> > > /usr/local/include/slang.h:899: warning: `libintl_printf' is an unrecognized
> > > format function type
> uname -sr => NetBSD 3.0.0_STABLE
> gcc --version => gcc (GCC) 3.3.3 (NetBSD nb3 20040520)

Find attached a workaround. Thanks for the report.

Bruno


2006-06-19 Bruno Haible <br...@clisp.org>

* libgnuintl.h.in (libintl_printf): Define to __printf__ on NetBSD.
Reported by Henry Nelson <ne...@yuba.ne.jp>.

diff -r -c3 --exclude='*.po*' --exclude='*.info*' --exclude='*_*.html' --exclude='*.*.html' --exclude='*.[13]' --exclude='*.1.in' --exclude=Makefile.in --exclude=aclocal.m4 --exclude=configure --exclude=version.texi --exclude=stamp-vti --exclude='po-*-gen*.[ch]' --exclude='*.o' --exclude='*.lo' --exclude='*.gmo' --exclude=ABOUT-NLS --exclude='javadoc[12]' --exclude=CVS gettext-cvs/gettext-runtime/intl/libgnuintl.h.in gettext-6/gettext-runtime/intl/libgnuintl.h.in
*** gettext-cvs/gettext-runtime/intl/libgnuintl.h.in Wed May 17 00:38:10 2006
--- gettext-6/gettext-runtime/intl/libgnuintl.h.in Tue Jun 20 02:11:11 2006
***************
*** 330,335 ****
--- 330,340 ----
extern int vfprintf (FILE *, const char *, va_list);

#undef printf
+ #ifdef __NetBSD__
+ /* Don't break __attribute__((format(printf,M,N))). This redefinition is only
+ possible because NetBSD's libc does not have a function __printf__. */
+ # define libintl_printf __printf__
+ #endif
#define printf libintl_printf
extern int printf (const char *, ...);
#undef vprintf


0 new messages