This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

"first use this function" incorrect for C++


This patch corrects the error message for undeclared identifiers in
C++.  I guess the message was copied from the C parser, and "first use
this function" meant "if the identifier is a function, you must call
(= use) it, to create an implicit declaration" and not "first use of
the identifier in this function".  Even if my interpretation is
incorrect, the error message is confusing ("use" certainly looks like
verb, not a known to me in that phrase).  At least we could print "in
this function" instead of "this function".

While we are at it, do you think the undeclared_variable_notice
explanation is really necessary?  Further errors concerning the
identifier are suppressed, but so are other diagnostics that could be
required if there was a proper declaration.

2003-08-31  Florian Weimer  <fw@deneb.enyo.de>

	* lex.c (unqualified_name_lookup_error): "first use this function"
	is confusing for C++.

--- orig/gcc/cp/lex.c
+++ mod/gcc/cp/lex.c
@@ -659,7 +659,7 @@
 	{
 	  static int undeclared_variable_notice;
 
-	  error ("`%D' undeclared (first use this function)", name);
+	  error ("`%D' undeclared", name);
 
 	  if (! undeclared_variable_notice)
 	    {




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]