public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Unrecog attribute func handling change request + patch
@ 1998-02-02 17:14 Mumit Khan
  1998-02-04  2:25 ` Andreas Schwab
  1998-02-05 22:09 ` Jeffrey A Law
  0 siblings, 2 replies; 4+ messages in thread
From: Mumit Khan @ 1998-02-02 17:14 UTC (permalink / raw)
  To: egcs

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-02-05 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-02 17:14 Unrecog attribute func handling change request + patch Mumit Khan
1998-02-04  2:25 ` Andreas Schwab
1998-02-04  7:17   ` Mumit Khan
1998-02-05 22:09 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).