This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Unrecog attribute func handling change request + patch
- To: egcs at cygnus dot com
- Subject: Unrecog attribute func handling change request + patch
- From: Mumit Khan <khan at xraylith dot wisc dot edu>
- Date: Mon, 02 Feb 1998 17:06:14 -0600
While using a different stdio implementation that defines printf, etc
as macros, I ran into a problem where GCC flags unrecognized attribute
functions as errors. This seems rather too harsh, and I suggest warning
the user instead; after all, this is an extension.
To see the problem, use gas/as.h for example:
#if (__GNUC__ >= 2) && !defined(VMS)
/* for use with -Wformat */
#define PRINTF_LIKE(FCN) void FCN (const char *format, ...) \
__attribute__ ((format (printf, 1, 2)))
#else
/* ... */
#endif
SFIO (Safe/Fast I/O Library by David G. Korn and Kiem-Phong Vo) defines
printf to be _stdprintf, so any code using this library and writing code
like above, and there's lots of it, will fail.
Here's a patch:
Sun Feb 1 17:05:26 1998 Mumit Khan <khan@xraylith.wisc.edu>
* c-common.c (decl_attributes): Flag unrecognized attribute
functions as warnings instead of as errors.
Index: c-common.c
===================================================================
RCS file: /usr/local/src/CVSROOT/egcs/gcc/c-common.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 c-common.c
--- c-common.c 1997/12/20 18:10:20 1.1.1.1
+++ c-common.c 1998/02/02 23:00:21
@@ -645,8 +645,8 @@ decl_attributes (node, attributes, prefi
is_scan = 1;
else if (TREE_CODE (format_type) == IDENTIFIER_NODE)
{
- error ("`%s' is an unrecognized format function type",
- IDENTIFIER_POINTER (format_type));
+ warning ("`%s' is an unrecognized format function type",
+ IDENTIFIER_POINTER (format_type));
continue;
}
else
Regards,
Mumit -- khan@xraylith.wisc.edu
http://www.xraylith.wisc.edu/~khan/