[PATCH RFA] testsuite/gdb.c++/templates.cc printf() patch

Kevin Buettner kevinb@cygnus.com
Mon Jan 29 17:57:00 GMT 2001


I request approval for committing the patch below.

On the project upon which I'm working at the moment, the declaration
of printf to return nothing (void) conflicts with gcc's internal
declaration of printf.  I am not able to reproduce this problem
using externally available sources at the moment, but I was told
that in the (recent) past, the "net" gcc development sources did
indeed exhibit this behavior too.  I was also informed that it was
unclear what the ultimate direction of gcc would be with regard to
these internal declarations, but that it would be best to modify
the gdb testsuite to avoid conflicts regardless of the decision.

Anyway, the version of gcc that I'm using for my project reports
a warning along the following lines:

printf.cc: In function `void printf(const char*, ...)':
printf.cc:2: warning: new declaration `void printf(const char*, ...)'
printf.cc:2: warning: ambiguates built-in declaration `int printf(const char*, 
   ...)'

Okay to commit?

	* gdb.c++/templates.cc (printf): Change definition to return
	``int'' instead of ``void'' to avoid conflicts with possible
	internal compiler declarations.

Index: testsuite/gdb.c++/templates.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/templates.cc,v
retrieving revision 1.3
diff -u -p -r1.3 templates.cc
--- templates.cc	2000/06/05 20:47:28	1.3
+++ templates.cc	2001/01/30 01:27:03
@@ -283,7 +283,7 @@ void h(long double = 4.33e33)
 { }
 #endif
 */
-void printf(const char *format, ... )
+int printf(const char *format, ... )
 {
     // elipsis
 }



More information about the Gdb-patches mailing list