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]

Re: C++/ObjC identifiers charset conversion cleanup


Original Mail: http://gcc.gnu.org/ml/gcc-patches/2009-05/msg00198.html

Am Dienstag, den 05.05.2009, 21:25 +0000 schrieb Joseph S. Myers:
> The ObjC changes are straightforward, and the changes to
> objc_lookup_protocol to have two full diagnostic sentences instead of
> building up a diagnostic from fragments make the code simpler as well
> as making it i18n-friendly and making it work with extended
> identifiers.

[snip]

> Bootstrapped with no regressions on x86_64-unknown-linux-gnu,
> including Obj-C++.  OK to commit?

I'm not an ObjC(++) maintainer (cc'ed them) but I the patch looks good
to me wrt ObjC... thanks for the i18n cleanups!

If you can point to some analogous C test cases, I could try to come up
with something for ObjC that tests many of the code paths.

[snip]

> objc:
> 2009-05-05  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* objc-act.c: Include intl.h.
> 	(objc_lookup_protocol): Use complete sentences for diagnostics
> 	with %qE for identifiers and translating results of
> 	gen_type_name_0 to locale character set.
> 	(objc_check_decl, check_protocol_recursively,
> 	lookup_and_install_protocols, objc_build_string_object,
> 	objc_get_class_reference, objc_declare_alias, objc_declare_class,
> 	objc_get_class_ivars, error_with_ivar, check_duplicates,
> 	objc_finish_message_expr, objc_build_protocol_expr,
> 	objc_build_selector_expr, build_ivar_reference, objc_add_method,
> 	add_category, add_instance_variable, objc_is_public,
> 	check_methods, check_methods_accessible, check_protocol,
> 	start_class, finish_class, start_protocol, really_start_method,
> 	get_super_receiver, objc_lookup_ivar): Use %E and %qE for
> 	identifiers in diagnostics.  Translate generated text to locale
> 	character set as needed.
> 	(check_protocol, check_protocols): Change name parameter to type
> 	tree.
> 	(lang_report_error_function): Remove.

[snip]

> Index: objc/objc-act.c
> ===================================================================
> --- objc/objc-act.c	(revision 147123)
> +++ objc/objc-act.c	(working copy)
> @@ -69,6 +69,7 @@ along with GCC; see the file COPYING3.  
>  #include "debug.h"
>  #include "target.h"
>  #include "diagnostic.h"
> +#include "intl.h"
>  #include "cgraph.h"
>  #include "tree-iterator.h"
>  #include "libfuncs.h"
> @@ -980,17 +981,17 @@ objc_lookup_protocol (tree proto, tree c
>  
>    if (warn)
>      {
> -      strcpy (errbuf, class_type ? "class \'" : "type \'");
> +      *errbuf = 0;
>        gen_type_name_0 (class_type ? typ : TYPE_POINTER_TO (typ));
> -      strcat (errbuf, "\' does not ");
>        /* NB: Types 'id' and 'Class' cannot reasonably be described as
>  	 "implementing" a given protocol, since they do not have an
>  	 implementation.  */
> -      strcat (errbuf, class_type ? "implement" : "conform to");
> -      strcat (errbuf, " the \'");
> -      strcat (errbuf, IDENTIFIER_POINTER (PROTOCOL_NAME (proto)));
> -      strcat (errbuf, "\' protocol");
> -      warning (0, errbuf);
> +      if (class_type)
> +	warning (0, "class %qs does not implement the %qE protocol",
> +		 identifier_to_locale (errbuf), PROTOCOL_NAME (proto));
> +      else
> +	warning (0, "type %qs does not conform to the %qE protocol",
> +		 identifier_to_locale (errbuf), PROTOCOL_NAME (proto));
>      }
>  
>    return false;
> @@ -1338,8 +1339,8 @@ objc_check_decl (tree decl)
>    if (TREE_CODE (type) != RECORD_TYPE)
>      return;
>    if (OBJC_TYPE_NAME (type) && (type = objc_is_class_name (OBJC_TYPE_NAME (type))))
> -    error ("statically allocated instance of Objective-C class %qs",
> -	   IDENTIFIER_POINTER (type));
> +    error ("statically allocated instance of Objective-C class %qE",
> +	   type);
>  }
>  
>  /* Construct a PROTOCOLS-qualified variant of INTERFACE, where INTERFACE may
> @@ -1415,8 +1416,8 @@ check_protocol_recursively (tree proto, 
>  	pp = lookup_protocol (pp);
>  
>        if (pp == proto)
> -	fatal_error ("protocol %qs has circular dependency",
> -		     IDENTIFIER_POINTER (PROTOCOL_NAME (pp)));
> +	fatal_error ("protocol %qE has circular dependency",
> +		     PROTOCOL_NAME (pp));
>        if (pp)
>  	check_protocol_recursively (proto, PROTOCOL_LIST (pp));
>      }
> @@ -1440,8 +1441,8 @@ lookup_and_install_protocols (tree proto
>  	return_value = chainon (return_value,
>  				build_tree_list (NULL_TREE, p));
>        else if (ident != error_mark_node)
> -	error ("cannot find protocol declaration for %qs",
> -	       IDENTIFIER_POINTER (ident));
> +	error ("cannot find protocol declaration for %qE",
> +	       ident);
>      }
>  
>    return return_value;
> @@ -1904,17 +1905,17 @@ objc_build_string_object (tree string)
>        if (!constant_string_class
>  	  || !(constant_string_type
>  	       = CLASS_STATIC_TEMPLATE (constant_string_class)))
> -	error ("cannot find interface declaration for %qs",
> -	       IDENTIFIER_POINTER (constant_string_id));
> +	error ("cannot find interface declaration for %qE",
> +	       constant_string_id);
>        /* The NSConstantString/NXConstantString ivar layout is now known.  */
>        else if (!check_string_class_template ())
> -	error ("interface %qs does not have valid constant string layout",
> -	       IDENTIFIER_POINTER (constant_string_id));
> +	error ("interface %qE does not have valid constant string layout",
> +	       constant_string_id);
>        /* For the NeXT runtime, we can generate a literal reference
>  	 to the string class, don't need to run a constructor.  */
>        else if (flag_next_runtime && !setup_string_decl ())
> -	error ("cannot find reference tag for class %qs",
> -	       IDENTIFIER_POINTER (constant_string_id));
> +	error ("cannot find reference tag for class %qE",
> +	       constant_string_id);
>        else
>  	{
>  	  string_layout_checked = 1;  /* Success!  */
> @@ -2753,8 +2754,8 @@ objc_get_class_reference (tree ident)
>  
>    if (local_scope || !(ident = objc_is_class_name (ident)))
>      {
> -      error ("%qs is not an Objective-C class name or alias",
> -	     IDENTIFIER_POINTER (orig_ident));
> +      error ("%qE is not an Objective-C class name or alias",
> +	     orig_ident);
>        return error_mark_node;
>      }
>  
> @@ -2886,9 +2887,9 @@ objc_declare_alias (tree alias_ident, tr
>  #endif /* OBJCPLUS */
>  
>    if (!(underlying_class = objc_is_class_name (class_ident)))
> -    warning (0, "cannot find class %qs", IDENTIFIER_POINTER (class_ident));
> +    warning (0, "cannot find class %qE", class_ident);
>    else if (objc_is_class_name (alias_ident))
> -    warning (0, "class %qs already exists", IDENTIFIER_POINTER (alias_ident));
> +    warning (0, "class %qE already exists", alias_ident);
>    else
>      {
>        /* Implement @compatibility_alias as a typedef.  */
> @@ -2932,8 +2933,8 @@ objc_declare_class (tree ident_list)
>  	      if (!TYPE_HAS_OBJC_INFO (type)
>  		  || !TYPE_OBJC_INTERFACE (type))
>  		{
> -		  error ("%qs redeclared as different kind of symbol",
> -			 IDENTIFIER_POINTER (ident));
> +		  error ("%qE redeclared as different kind of symbol",
> +			 ident);
>  		  error ("previous declaration of %q+D",
>  			 record);
>  		}
> @@ -3354,8 +3355,8 @@ objc_get_class_ivars (tree class_name)
>    if (interface)
>      return get_class_ivars (interface, true);
>  
> -  error ("cannot find interface declaration for %qs",
> -	 IDENTIFIER_POINTER (class_name));
> +  error ("cannot find interface declaration for %qE",
> +	 class_name);
>  
>    return error_mark_node;
>  }
> @@ -4970,7 +4971,7 @@ static void
>  error_with_ivar (const char *message, tree decl)
>  {
>    error ("%J%s %qs", decl,
> -         message, gen_declaration (decl));
> +         message, identifier_to_locale (gen_declaration (decl)));
>  
>  }
>  
> @@ -6103,23 +6104,23 @@ check_duplicates (hash hsh, int methods,
>  	    {
>  	      bool type = TREE_CODE (meth) == INSTANCE_METHOD_DECL;
>  
> -	      warning (0, "multiple methods named %<%c%s%> found",
> +	      warning (0, "multiple methods named %<%c%E%> found",
>  		       (is_class ? '+' : '-'),
> -		       IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
> +		       METHOD_SEL_NAME (meth));
>  	      inform (0, "%Jusing %<%c%s%>", meth,
>  		      (type ? '-' : '+'),
> -		      gen_method_decl (meth));
> +		      identifier_to_locale (gen_method_decl (meth)));
>  	    }
>  	  else
>  	    {
>  	      bool type = TREE_CODE (meth) == INSTANCE_METHOD_DECL;
>  
> -	      warning (0, "multiple selectors named %<%c%s%> found",
> +	      warning (0, "multiple selectors named %<%c%E%> found",
>  		       (is_class ? '+' : '-'),
> -		       IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
> +		       METHOD_SEL_NAME (meth));
>  	      inform (0, "%Jfound %<%c%s%>", meth,
>  		      (type ? '-' : '+'),
> -		      gen_method_decl (meth));
> +		      identifier_to_locale (gen_method_decl (meth)));
>  	    }
>  
>  	  for (loop = hsh->list; loop; loop = loop->next)
> @@ -6128,7 +6129,7 @@ check_duplicates (hash hsh, int methods,
>  
>  	      inform (0, "%Jalso found %<%c%s%>", loop->value, 
>  		      (type ? '-' : '+'),
> -		      gen_method_decl (loop->value));
> +		      identifier_to_locale (gen_method_decl (loop->value)));
>  	    }
>          }
>      }
> @@ -6340,8 +6341,8 @@ objc_finish_message_expr (tree receiver,
>  	{
>  	  if (!CLASS_SUPER_NAME (implementation_template))
>  	    {
> -	      error ("no super class declared in @interface for %qs",
> -		     IDENTIFIER_POINTER (CLASS_NAME (implementation_template)));
> +	      error ("no super class declared in @interface for %qE",
> +		     CLASS_NAME (implementation_template));
>  	      return error_mark_node;
>  	    }
>  	  rtype = lookup_interface (CLASS_SUPER_NAME (implementation_template));
> @@ -6378,9 +6379,8 @@ objc_finish_message_expr (tree receiver,
>  		= lookup_method_in_protocol_list (rprotos, sel_name, 0);
>  
>  	      if (method_prototype)
> -		warning (0, "found %<-%s%> instead of %<+%s%> in protocol(s)",
> -			 IDENTIFIER_POINTER (sel_name),
> -			 IDENTIFIER_POINTER (sel_name));
> +		warning (0, "found %<-%E%> instead of %<+%E%> in protocol(s)",
> +			 sel_name, sel_name);
>  	    }
>  	}
>      }
> @@ -6438,7 +6438,7 @@ objc_finish_message_expr (tree receiver,
>        else
>  	{
>  	  warning (0, "invalid receiver type %qs",
> -		   gen_type_name (orig_rtype));
> +		   identifier_to_locale (gen_type_name (orig_rtype)));
>  	  /* After issuing the "invalid receiver" warning, perform method
>  	     lookup as if we were messaging 'id'.  */
>  	  rtype = rprotos = NULL_TREE;
> @@ -6452,9 +6452,9 @@ objc_finish_message_expr (tree receiver,
>    if (!method_prototype)
>      {
>        if (rprotos)
> -	warning (0, "%<%c%s%> not found in protocol(s)",
> +	warning (0, "%<%c%E%> not found in protocol(s)",
>  		 (class_tree ? '+' : '-'),
> -		 IDENTIFIER_POINTER (sel_name));
> +		 sel_name);
>  
>        if (!rtype)
>  	method_prototype
> @@ -6466,17 +6466,17 @@ objc_finish_message_expr (tree receiver,
>        static bool warn_missing_methods = false;
>  
>        if (rtype)
> -	warning (0, "%qs may not respond to %<%c%s%>",
> -		 IDENTIFIER_POINTER (OBJC_TYPE_NAME (rtype)),
> +	warning (0, "%qE may not respond to %<%c%E%>",
> +		 OBJC_TYPE_NAME (rtype),
>  		 (class_tree ? '+' : '-'),
> -		 IDENTIFIER_POINTER (sel_name));
> +		 sel_name);
>        /* If we are messaging an 'id' or 'Class' object and made it here,
>  	 then we have failed to find _any_ instance or class method,
>  	 respectively.  */
>        else
> -	warning (0, "no %<%c%s%> method found",
> +	warning (0, "no %<%c%E%> method found",
>  		 (class_tree ? '+' : '-'),
> -		 IDENTIFIER_POINTER (sel_name));
> +		 sel_name);
>  
>        if (!warn_missing_methods)
>  	{
> @@ -6616,8 +6616,8 @@ objc_build_protocol_expr (tree protoname
>  
>    if (!p)
>      {
> -      error ("cannot find protocol declaration for %qs",
> -	     IDENTIFIER_POINTER (protoname));
> +      error ("cannot find protocol declaration for %qE",
> +	     protoname);
>        return error_mark_node;
>      }
>  
> @@ -6716,7 +6716,7 @@ objc_build_selector_expr (tree selnameli
>        /* If still not found, print out a warning.  */
>        if (!hsh)
>  	{
> -	  warning (0, "undeclared selector %qs", IDENTIFIER_POINTER (selname));
> +	  warning (0, "undeclared selector %qE", selname);
>  	}
>      }
>  
> @@ -6758,8 +6758,8 @@ build_ivar_reference (tree id)
>  	 to an instance variable.  It's better to catch the cases
>  	 where this is done unknowingly than to support the above
>  	 paradigm.  */
> -      warning (0, "instance variable %qs accessed in class method",
> -	       IDENTIFIER_POINTER (id));
> +      warning (0, "instance variable %qE accessed in class method",
> +	       id);
>        self_decl = convert (objc_instance_type, self_decl); /* cast */
>      }
>  
> @@ -6992,9 +6992,9 @@ objc_add_method (tree klass, tree method
>        if ((TREE_CODE (klass) == CLASS_INTERFACE_TYPE
>  	   || TREE_CODE (klass) == CATEGORY_INTERFACE_TYPE)
>  	  && !comp_proto_with_proto (method, mth, 1))
> -	error ("duplicate declaration of method %<%c%s%>",
> +	error ("duplicate declaration of method %<%c%E%>",
>  		is_class ? '+' : '-',
> -		IDENTIFIER_POINTER (METHOD_SEL_NAME (mth)));
> +		METHOD_SEL_NAME (mth));
>      }
>  
>    if (is_class)
> @@ -7053,9 +7053,9 @@ add_category (tree klass, tree category)
>  
>    if (cat)
>      {
> -      warning (0, "duplicate interface declaration for category %<%s(%s)%>",
> -	       IDENTIFIER_POINTER (CLASS_NAME (klass)),
> -	       IDENTIFIER_POINTER (CLASS_SUPER_NAME (category)));
> +      warning (0, "duplicate interface declaration for category %<%E(%E)%>",
> +	       CLASS_NAME (klass),
> +	       CLASS_SUPER_NAME (category));
>      }
>    else
>      {
> @@ -7074,8 +7074,8 @@ add_instance_variable (tree klass, int v
>  {
>    tree field_type = TREE_TYPE (field_decl);
>    const char *ivar_name = DECL_NAME (field_decl)
> -			  ? IDENTIFIER_POINTER (DECL_NAME (field_decl))
> -			  : "<unnamed>";
> +			  ? identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (field_decl)))
> +			  : _("<unnamed>");
>  
>  #ifdef OBJCPLUS
>    if (TREE_CODE (field_type) == REFERENCE_TYPE)
> @@ -7106,7 +7106,7 @@ add_instance_variable (tree klass, int v
>  	  || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (field_type)
>  	  || TYPE_POLYMORPHIC_P (field_type)))
>      {
> -      const char *type_name = IDENTIFIER_POINTER (OBJC_TYPE_NAME (field_type));
> +      tree type_name = OBJC_TYPE_NAME (field_type);
>  
>        if (flag_objc_call_cxx_cdtors)
>          {
> @@ -7116,13 +7116,13 @@ add_instance_variable (tree klass, int v
>  	  if (TYPE_NEEDS_CONSTRUCTING (field_type)
>  	      && !TYPE_HAS_DEFAULT_CONSTRUCTOR (field_type))
>  	    {
> -	      warning (0, "type %qs has no default constructor to call",
> +	      warning (0, "type %qE has no default constructor to call",
>  		       type_name);
>  
>  	      /* If we cannot call a constructor, we should also avoid
>  		 calling the destructor, for symmetry.  */
>  	      if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (field_type))
> -		warning (0, "destructor for %qs shall not be run either",
> +		warning (0, "destructor for %qE shall not be run either",
>  			 type_name);
>  	    }
>          }
> @@ -7134,8 +7134,8 @@ add_instance_variable (tree klass, int v
>  	    {
>  	      /* Vtable pointers are Real Bad(tm), since Obj-C cannot
>  		 initialize them.  */
> -	      error ("type %qs has virtual member functions", type_name);
> -	      error ("illegal aggregate type %qs specified "
> +	      error ("type %qE has virtual member functions", type_name);
> +	      error ("illegal aggregate type %qE specified "
>  		     "for instance variable %qs",
>  		     type_name, ivar_name);
>  	      /* Return class as is without adding this ivar.  */
> @@ -7145,9 +7145,9 @@ add_instance_variable (tree klass, int v
>  	  /* User-defined constructors and destructors are not known to Obj-C
>  	     and hence will not be called.  This may or may not be a problem. */
>  	  if (TYPE_NEEDS_CONSTRUCTING (field_type))
> -	    warning (0, "type %qs has a user-defined constructor", type_name);
> +	    warning (0, "type %qE has a user-defined constructor", type_name);
>  	  if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (field_type))
> -	    warning (0, "type %qs has a user-defined destructor", type_name);
> +	    warning (0, "type %qE has a user-defined destructor", type_name);
>  
>  	  if (!warn_cxx_ivars)
>  	    {
> @@ -7231,8 +7231,8 @@ objc_is_public (tree expr, tree identifi
>  
>  	  if (!klass)
>  	    {
> -	      error ("cannot find interface declaration for %qs",
> -		     IDENTIFIER_POINTER (OBJC_TYPE_NAME (basetype)));
> +	      error ("cannot find interface declaration for %qE",
> +		     OBJC_TYPE_NAME (basetype));
>  	      return 0;
>  	    }
>  
> @@ -7260,8 +7260,8 @@ objc_is_public (tree expr, tree identifi
>  		      int priv = is_private (decl);
>  
>  		      if (priv)
> -			error ("instance variable %qs is declared private",
> -			       IDENTIFIER_POINTER (DECL_NAME (decl)));
> +			error ("instance variable %qE is declared private",
> +			       DECL_NAME (decl));
>  
>  		      return !priv;
>  		    }
> @@ -7271,15 +7271,15 @@ objc_is_public (tree expr, tree identifi
>  		 non-@public ivars.  We will let this slide for now...  */
>  	      if (!objc_method_context)
>  	      {
> -		warning (0, "instance variable %qs is %s; "
> +		warning (0, "instance variable %qE is %s; "
>  			 "this will be a hard error in the future",
> -			 IDENTIFIER_POINTER (identifier),
> +			 identifier,
>  			 TREE_PRIVATE (decl) ? "@private" : "@protected");
>  		return 1;
>  	      }
>  
> -	      error ("instance variable %qs is declared %s",
> -		     IDENTIFIER_POINTER (identifier),
> +	      error ("instance variable %qE is declared %s",
> +		     identifier,
>  		     TREE_PRIVATE (decl) ? "private" : "protected");
>  	      return 0;
>  	    }
> @@ -7304,17 +7304,17 @@ check_methods (tree chain, tree list, in
>  	    {
>  	      if (TREE_CODE (objc_implementation_context)
>  		  == CLASS_IMPLEMENTATION_TYPE)
> -		warning (0, "incomplete implementation of class %qs",
> -			 IDENTIFIER_POINTER (CLASS_NAME (objc_implementation_context)));
> +		warning (0, "incomplete implementation of class %qE",
> +			 CLASS_NAME (objc_implementation_context));
>  	      else if (TREE_CODE (objc_implementation_context)
>  		       == CATEGORY_IMPLEMENTATION_TYPE)
> -		warning (0, "incomplete implementation of category %qs",
> -			 IDENTIFIER_POINTER (CLASS_SUPER_NAME (objc_implementation_context)));
> +		warning (0, "incomplete implementation of category %qE",
> +			 CLASS_SUPER_NAME (objc_implementation_context));
>  	      first = 0;
>  	    }
>  
> -	  warning (0, "method definition for %<%c%s%> not found",
> -		   mtype, IDENTIFIER_POINTER (METHOD_SEL_NAME (chain)));
> +	  warning (0, "method definition for %<%c%E%> not found",
> +		   mtype, METHOD_SEL_NAME (chain));
>  	}
>  
>        chain = TREE_CHAIN (chain);
> @@ -7392,18 +7392,16 @@ check_methods_accessible (tree chain, tr
>  	    {
>  	      if (TREE_CODE (objc_implementation_context)
>  		  == CLASS_IMPLEMENTATION_TYPE)
> -		warning (0, "incomplete implementation of class %qs",
> -			 IDENTIFIER_POINTER
> -			   (CLASS_NAME (objc_implementation_context)));
> +		warning (0, "incomplete implementation of class %qE",
> +			 CLASS_NAME (objc_implementation_context));
>  	      else if (TREE_CODE (objc_implementation_context)
>  		       == CATEGORY_IMPLEMENTATION_TYPE)
> -		warning (0, "incomplete implementation of category %qs",
> -			 IDENTIFIER_POINTER
> -			   (CLASS_SUPER_NAME (objc_implementation_context)));
> +		warning (0, "incomplete implementation of category %qE",
> +			 CLASS_SUPER_NAME (objc_implementation_context));
>  	      first = 0;
>  	    }
> -	  warning (0, "method definition for %<%c%s%> not found",
> -		   mtype, IDENTIFIER_POINTER (METHOD_SEL_NAME (chain)));
> +	  warning (0, "method definition for %<%c%E%> not found",
> +		   mtype, METHOD_SEL_NAME (chain));
>  	}
>  
>        chain = TREE_CHAIN (chain); /* next method...  */
> @@ -7416,7 +7414,7 @@ check_methods_accessible (tree chain, tr
>     with any protocols that P inherits.  */
>  
>  static void
> -check_protocol (tree p, const char *type, const char *name)
> +check_protocol (tree p, const char *type, tree name)
>  {
>    if (TREE_CODE (p) == PROTOCOL_INTERFACE_TYPE)
>      {
> @@ -7443,8 +7441,8 @@ check_protocol (tree p, const char *type
>  	}
>  
>        if (!f1 || !f2)
> -	warning (0, "%s %qs does not fully implement the %qs protocol",
> -		 type, name, IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
> +	warning (0, "%s %qE does not fully implement the %qE protocol",
> +		 type, name, PROTOCOL_NAME (p));
>      }
>  
>    /* Check protocols recursively.  */
> @@ -7472,7 +7470,7 @@ check_protocol (tree p, const char *type
>     in PROTO_LIST.  */
>  
>  static void
> -check_protocols (tree proto_list, const char *type, const char *name)
> +check_protocols (tree proto_list, const char *type, tree name)
>  {
>    for ( ; proto_list; proto_list = TREE_CHAIN (proto_list))
>      {
> @@ -7520,9 +7518,9 @@ start_class (enum tree_code code, tree c
>  
>        if (!super || !lookup_interface (super))
>  	{
> -	  error ("cannot find interface declaration for %qs, superclass of %qs",
> -		 IDENTIFIER_POINTER (super ? super : super_name),
> -		 IDENTIFIER_POINTER (class_name));
> +	  error ("cannot find interface declaration for %qE, superclass of %qE",
> +		 super ? super : super_name,
> +		 class_name);
>  	  super_name = NULL_TREE;
>  	}
>        else
> @@ -7536,8 +7534,8 @@ start_class (enum tree_code code, tree c
>    if (! objc_is_class_name (class_name)
>        && (decl = lookup_name (class_name)))
>      {
> -      error ("%qs redeclared as different kind of symbol",
> -	     IDENTIFIER_POINTER (class_name));
> +      error ("%qE redeclared as different kind of symbol",
> +	     class_name);
>        error ("previous declaration of %q+D",
>  	     decl);
>      }
> @@ -7550,8 +7548,8 @@ start_class (enum tree_code code, tree c
>          for (chain = implemented_classes; chain; chain = TREE_CHAIN (chain))
>             if (TREE_VALUE (chain) == class_name)
>  	     {
> -	       error ("reimplementation of class %qs",
> -		      IDENTIFIER_POINTER (class_name));
> +	       error ("reimplementation of class %qE",
> +		      class_name);
>  	       return error_mark_node;
>  	     }
>          implemented_classes = tree_cons (NULL_TREE, class_name,
> @@ -7567,8 +7565,8 @@ start_class (enum tree_code code, tree c
>  
>        if (!(implementation_template = lookup_interface (class_name)))
>          {
> -	  warning (0, "cannot find interface declaration for %qs",
> -		   IDENTIFIER_POINTER (class_name));
> +	  warning (0, "cannot find interface declaration for %qE",
> +		   class_name);
>  	  add_class (implementation_template = objc_implementation_context,
>  		     class_name);
>          }
> @@ -7580,11 +7578,12 @@ start_class (enum tree_code code, tree c
>  	  && (super_name != CLASS_SUPER_NAME (implementation_template)))
>          {
>  	  tree previous_name = CLASS_SUPER_NAME (implementation_template);
> -          const char *const name =
> -	    previous_name ? IDENTIFIER_POINTER (previous_name) : "";
> -	  error ("conflicting super class name %qs",
> -		 IDENTIFIER_POINTER (super_name));
> -	  error ("previous declaration of %qs", name);
> +	  error ("conflicting super class name %qE",
> +		 super_name);
> +	  if (previous_name)
> +	    error ("previous declaration of %qE", previous_name);
> +	  else
> +	    error ("previous declaration");
>          }
>  
>        else if (! super_name)
> @@ -7598,11 +7597,11 @@ start_class (enum tree_code code, tree c
>      {
>        if (lookup_interface (class_name))
>  #ifdef OBJCPLUS
> -	error ("duplicate interface declaration for class %qs",
> +	error ("duplicate interface declaration for class %qE",
>  #else
> -	warning (0, "duplicate interface declaration for class %qs",
> +	warning (0, "duplicate interface declaration for class %qE",
>  #endif
> -        IDENTIFIER_POINTER (class_name));
> +        class_name);
>        else
>          add_class (klass, class_name);
>  
> @@ -7621,8 +7620,8 @@ start_class (enum tree_code code, tree c
>  
>        if (!(class_category_is_assoc_with = lookup_interface (class_name)))
>  	{
> -	  error ("cannot find interface declaration for %qs",
> -		 IDENTIFIER_POINTER (class_name));
> +	  error ("cannot find interface declaration for %qE",
> +		 class_name);
>  	  exit (FATAL_EXIT_CODE);
>  	}
>        else
> @@ -7646,8 +7645,8 @@ start_class (enum tree_code code, tree c
>  
>        if (!(implementation_template = lookup_interface (class_name)))
>          {
> -	  error ("cannot find interface declaration for %qs",
> -		 IDENTIFIER_POINTER (class_name));
> +	  error ("cannot find interface declaration for %qE",
> +		 class_name);
>  	  exit (FATAL_EXIT_CODE);
>          }
>      }
> @@ -7741,7 +7740,7 @@ finish_class (tree klass)
>  	  if (CLASS_PROTOCOL_LIST (implementation_template))
>  	    check_protocols (CLASS_PROTOCOL_LIST (implementation_template),
>  			     "class",
> -			     IDENTIFIER_POINTER (CLASS_NAME (objc_implementation_context)));
> +			     CLASS_NAME (objc_implementation_context));
>  	}
>      }
>  
> @@ -7760,7 +7759,7 @@ finish_class (tree klass)
>  	  if (CLASS_PROTOCOL_LIST (category))
>  	    check_protocols (CLASS_PROTOCOL_LIST (category),
>  			     "category",
> -			     IDENTIFIER_POINTER (CLASS_SUPER_NAME (objc_implementation_context)));
> +			     CLASS_SUPER_NAME (objc_implementation_context));
>  	}
>      }
>  }
> @@ -7854,8 +7853,8 @@ start_protocol (enum tree_code code, tre
>      }
>    else
>      {
> -      warning (0, "duplicate declaration for protocol %qs",
> -	       IDENTIFIER_POINTER (name));
> +      warning (0, "duplicate declaration for protocol %qE",
> +	       name);
>      }
>    return protocol;
>  }
> @@ -8684,10 +8683,10 @@ really_start_method (tree method,
>  
>  	      warning (0, "%Jconflicting types for %<%c%s%>", method,
>  		       (type ? '-' : '+'),
> -		       gen_method_decl (method));
> +		       identifier_to_locale (gen_method_decl (method)));
>  	      inform (0, "%Jprevious declaration of %<%c%s%>", proto,
>  		      (type ? '-' : '+'),
> -		      gen_method_decl (proto));
> +		      identifier_to_locale (gen_method_decl (proto)));
>  	    }
>  	}
>        else
> @@ -8771,8 +8770,8 @@ get_super_receiver (void)
>  	  /* Barf if super used in a category of Object.  */
>  	  if (!super_name)
>  	    {
> -	      error ("no super class declared in interface for %qs",
> -		    IDENTIFIER_POINTER (CLASS_NAME (implementation_template)));
> +	      error ("no super class declared in interface for %qE",
> +		     CLASS_NAME (implementation_template));
>  	      return error_mark_node;
>  	    }
>  
> @@ -8866,22 +8865,6 @@ objc_finish_method_definition (tree fnde
>      warning (0, "method possibly missing a [super dealloc] call");
>  }
>  
> -#if 0
> -int
> -lang_report_error_function (tree decl)
> -{
> -  if (objc_method_context)
> -    {
> -      fprintf (stderr, "In method %qs\n",
> -	       IDENTIFIER_POINTER (METHOD_SEL_NAME (objc_method_context)));
> -      return 1;
> -    }
> -
> -  else
> -    return 0;
> -}
> -#endif
> -
>  /* Given a tree DECL node, produce a printable description of it in the given
>     buffer, overwriting the buffer.  */
>  
> @@ -9493,8 +9476,8 @@ objc_lookup_ivar (tree other, tree id)
>        && !DECL_FILE_SCOPE_P (other))
>  #endif
>      {
> -      warning (0, "local declaration of %qs hides instance variable",
> -	       IDENTIFIER_POINTER (id));
> +      warning (0, "local declaration of %qE hides instance variable",
> +	       id);
>  
>        return other;
>      }




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