Mail Archives: djgpp/2000/09/01/12:51:13
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> said:
> > Date: Fri, 1 Sep 2000 08:00:44 +0200 (MET DST)
> > From: Gisle Vanem <giva AT bgnett DOT no>
> >
> > extern int (*__printf) (const char *fmt, ...)
> > #ifdef __GNUC__
> > __attribute__((format(printf,1,2)))
> > #endif
> > ;
> >
> > Where '__printf' points to either a stdio or a conio-type function.
> >
> > But gcc 2.95.2 doesn't seem to allow such '__attribute__' for a pointer;
> >
> > "argument format specified for non-function `__printf'"
>
> Did you try to put __attribute__ inside the parens in (*__printf)?
Tried it, but doesn't work;
extern int (*__printf __attribute__((format(printf,1,2))))
(const char *fmt, ...);
or
extern int (*__printf) __attribute__((format(printf,1,2)))
(const char *fmt, ...);
> If that doesn't help either, try using a typedef.
Did work either:
typedef int (*PrintFunc) (const char *fmt, ...);
extern PrintFunc __printf __attribute__((format(printf,1,2)));
or
typedef int (*PrintFunc) (const char *fmt, ...)
__attribute__((format(printf,1,2)));
extern PrintFunc __printf;
Gisle V.
- Raw text -