Date: Fri, 1 Sep 2000 12:41:27 +0200 (CEST) Message-Id: <200009011041.MAA65728@login-2.eunet.no> From: "Gisle Vanem" To: djgpp AT delorie DOT com Cc: eliz AT is DOT elta DOT co DOT il Subject: Re: __attribute__ for pointers X-Mailer: Watt/POP Reply-To: djgpp AT delorie DOT com From: "Eli Zaretskii" said: > > Date: Fri, 1 Sep 2000 08:00:44 +0200 (MET DST) > > From: Gisle Vanem > > > > 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.