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]

C identifiers cleanup for extended identifiers


This patch cleans up most identifiers handling in the C front end to
handle extended identifiers properly.  Subsequent patches are intended
to address C++, ObjC, the language-independent compiler and cpplib.

Identifiers in diagnostics are converted to the locale character set
(most commonly by using %qE to print IDENTIFIER_NODEs).  Identifiers
in debugging dumps are left untouched on the basis that using the
internal character set is fine in such messages which are not subject
to i18n or seen by normal users.

The basic principle behind finding places that need to change is
checking uses of IDENTIFIER_POINTER - and of the decl_printable_name
langhook, which returns strings in the internal character set.  The
test ucnid-9.c covers __func__ semantics required by C99 (already
correctly implemented without this patch, but not tested).  The other
new tests cover representative diagnostics affected by this patch.

I haven't yet fixed c-aux-info.c (where my inclination is to make
-aux-info output always use UCNs and document it as such).  In
addition, the C front end encodes the names of named asm operands into
strings which get passed out of the front end that way, and so the
"undefined named operand" diagnostic will need to translate its string
although not obviously dealing with identifiers if the code is
examined locally.

In the process of cleaning this up there are some i18n improvements;
in particular, untranslated "type name" strings are no longer embedded
in diagnostics by grokdeclarator, with separate diagnostics being used
instead for the cases of abstract declarators.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Applied
to mainline.

2009-05-04  Joseph Myers  <joseph@codesourcery.com>

	* c-common.c (handle_mode_attribute): Use %qE for identifiers in
	diagnostics.
	* c-decl.c (check_bitfield_type_and_width): Make orig_name a tree
	and pass value to identifier_to_locale.
	(warn_variable_length_array): Make name a tree.
	(grokdeclarator): Separate diagnostic texts for named and unnamed
	declarators.  Use %qE for named declarators.
	* c-parser.c (c_lex_one_token): Use %qE for identifiers in
	diagnostics.
	* c-pragma.c (pop_alignment, handle_pragma_pack): Use %qE for
	identifiers in diagnostics.
	* c-typeck.c (push_member_name, start_init): Pass identifiers to
	identifier_to_locale.  Mark "anonymous" strings for translation.

testsuite:
2009-05-04  Joseph Myers  <joseph@codesourcery.com>

	* gcc.dg/ucnid-8.c, gcc.dg/ucnid-9.c, gcc.dg/ucnid-10.c: New
	tests.
	* gcc.dg/declspec-9.c, gcc.dg/declspec-10.c, gcc.dg/declspec-11.c:
	Update expected errors.

Index: testsuite/gcc.dg/ucnid-8.c
===================================================================
--- testsuite/gcc.dg/ucnid-8.c	(revision 0)
+++ testsuite/gcc.dg/ucnid-8.c	(revision 0)
@@ -0,0 +1,14 @@
+/* Verify diagnostics for extended identifiers refer to UCNs (in the C
+   locale).  Further tests of C front-end diagnostics.  */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -fextended-identifiers -Wvla" } */
+
+int a __attribute__((__mode__(\u00e9))); /* { dg-error "unknown machine mode '\\\\U000000e9'" } */
+struct s1 { int \u00e9 : 0; }; /* { dg-error "zero width for bit-field '\\\\U000000e9'" } */
+
+void f (int b) { int \u00e9[b]; } /* { dg-warning "variable length array '\\\\U000000e9'" } */
+
+void g (static int \u00e9); /* { dg-error "storage class specified for parameter '\\\\U000000e9'" } */
+
+struct s2 { int \u00e1; } \u00e9 = { { 0 } }; /* { dg-warning "braces around scalar initializer" } */
+/* { dg-warning "near initialization for '\\\\U000000e9\\.\\\\U000000e1'" "UCN diag" { target *-*-* } 13 } */
Index: testsuite/gcc.dg/declspec-10.c
===================================================================
--- testsuite/gcc.dg/declspec-10.c	(revision 147096)
+++ testsuite/gcc.dg/declspec-10.c	(working copy)
@@ -9,11 +9,11 @@ auto void f0 (void) {} /* { dg-warning "
 register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */
 typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */
 
-void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f4 (extern int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f3 (auto int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f4 (extern int); /* { dg-error "storage class specified for unnamed parameter" } */
 void f5 (register int);
-void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f7 (typedef int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f6 (static int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
 
 auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
 register int y; /* { dg-warning "file-scope declaration of 'y' specifies 'register'" } */
Index: testsuite/gcc.dg/declspec-9.c
===================================================================
--- testsuite/gcc.dg/declspec-9.c	(revision 147096)
+++ testsuite/gcc.dg/declspec-9.c	(working copy)
@@ -10,11 +10,11 @@ auto void f0 (void) {} /* { dg-warning "
 register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */
 typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */
 
-void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f4 (extern int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f3 (auto int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f4 (extern int); /* { dg-error "storage class specified for unnamed parameter" } */
 void f5 (register int);
-void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f7 (typedef int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f6 (static int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
 
 auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
 register int y;
Index: testsuite/gcc.dg/ucnid-9.c
===================================================================
--- testsuite/gcc.dg/ucnid-9.c	(revision 0)
+++ testsuite/gcc.dg/ucnid-9.c	(revision 0)
@@ -0,0 +1,24 @@
+/* Test __func__ with extended identifiers and character set
+   conversions.  */
+/* { dg-do run } */
+/* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
+/* { dg-options "-std=c99 -fextended-identifiers -fexec-charset=ISO-8859-1" } */
+/* { dg-require-iconv "ISO-8859-1" } */
+
+extern int strcmp (const char *, const char *);
+extern void abort (void);
+extern void exit (int);
+
+void
+\u00e9 (void)
+{
+  if (strcmp (__func__, "\u00e9") != 0)
+    abort ();
+}
+
+int
+main (void)
+{
+  \u00e9 ();
+  exit (0);
+}
Index: testsuite/gcc.dg/declspec-11.c
===================================================================
--- testsuite/gcc.dg/declspec-11.c	(revision 147096)
+++ testsuite/gcc.dg/declspec-11.c	(working copy)
@@ -9,11 +9,11 @@ auto void f0 (void) {} /* { dg-error "fu
 register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */
 typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */
 
-void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f4 (extern int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f3 (auto int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f4 (extern int); /* { dg-error "storage class specified for unnamed parameter" } */
 void f5 (register int);
-void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f7 (typedef int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f6 (static int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
 
 auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
 register int y; /* { dg-error "file-scope declaration of 'y' specifies 'register'" } */
Index: testsuite/gcc.dg/ucnid-10.c
===================================================================
--- testsuite/gcc.dg/ucnid-10.c	(revision 0)
+++ testsuite/gcc.dg/ucnid-10.c	(revision 0)
@@ -0,0 +1,8 @@
+/* Verify diagnostics for extended identifiers refer to UCNs (in the C
+   locale).  Test #pragma pack diagnostics.  */
+/* { dg-do compile { target *-*-linux* *-*-cygwin* powerpc*-*-eabi* } } */
+/* { dg-options "-std=gnu99 -fextended-identifiers" } */
+
+#pragma pack(push)
+#pragma pack(pop, \u00f3) /* { dg-warning "pop, \\\\U000000f3.*push, \\\\U000000f3" } */
+#pragma pack(\u00e7) /* { dg-warning "unknown action '\\\\U000000e7'" } */
Index: c-decl.c
===================================================================
--- c-decl.c	(revision 147096)
+++ c-decl.c	(working copy)
@@ -3894,12 +3894,14 @@ flexible_array_type_p (tree type)
 /* Performs sanity checks on the TYPE and WIDTH of the bit-field NAME,
    replacing with appropriate values if they are invalid.  */
 static void
-check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
+check_bitfield_type_and_width (tree *type, tree *width, tree orig_name)
 {
   tree type_mv;
   unsigned int max_width;
   unsigned HOST_WIDE_INT w;
-  const char *name = orig_name ? orig_name: _("<anonymous>");
+  const char *name = (orig_name
+		      ? identifier_to_locale (IDENTIFIER_POINTER (orig_name))
+		      : _("<anonymous>"));
 
   /* Detect and ignore out of range field width and process valid
      field widths.  */
@@ -3967,7 +3969,7 @@ check_bitfield_type_and_width (tree *typ
 /* Print warning about variable length array if necessary.  */
 
 static void
-warn_variable_length_array (const char *name, tree size)
+warn_variable_length_array (tree name, tree size)
 {
   int const_size = TREE_CONSTANT (size);
 
@@ -3976,7 +3978,8 @@ warn_variable_length_array (const char *
       if (const_size)
 	{
 	  if (name)
-	    pedwarn (input_location, OPT_Wvla, "ISO C90 forbids array %qs whose size "
+	    pedwarn (input_location, OPT_Wvla,
+		     "ISO C90 forbids array %qE whose size "
 		     "can%'t be evaluated",
 		     name);
 	  else
@@ -3986,7 +3989,8 @@ warn_variable_length_array (const char *
       else
 	{
 	  if (name) 
-	    pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array %qs",
+	    pedwarn (input_location, OPT_Wvla,
+		     "ISO C90 forbids variable length array %qE",
 		     name);
 	  else
 	    pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array");
@@ -3998,7 +4002,7 @@ warn_variable_length_array (const char *
         {
 	  if (name)
 	    warning (OPT_Wvla,
-		     "the size of array %qs can"
+		     "the size of array %qE can"
 		     "%'t be evaluated", name);
 	  else
 	    warning (OPT_Wvla,
@@ -4008,7 +4012,7 @@ warn_variable_length_array (const char *
 	{
 	  if (name)
 	    warning (OPT_Wvla,
-		     "variable length array %qs is used",
+		     "variable length array %qE is used",
 		     name);
 	  else
 	    warning (OPT_Wvla,
@@ -4098,7 +4102,7 @@ grokdeclarator (const struct c_declarato
   int restrictp;
   int volatilep;
   int type_quals = TYPE_UNQUALIFIED;
-  const char *name, *orig_name;
+  tree name = NULL_TREE;
   bool funcdef_flag = false;
   bool funcdef_syntax = false;
   int size_varies = 0;
@@ -4126,10 +4130,9 @@ grokdeclarator (const struct c_declarato
     funcdef_flag = true, decl_context = NORMAL;
 
   /* Look inside a declarator for the name being declared
-     and get it as a string, for an error message.  */
+     and get it as an IDENTIFIER_NODE, for an error message.  */
   {
     const struct c_declarator *decl = declarator;
-    name = 0;
 
     while (decl)
       switch (decl->kind)
@@ -4147,16 +4150,21 @@ grokdeclarator (const struct c_declarato
 
 	case cdk_id:
 	  if (decl->u.id)
-	    name = IDENTIFIER_POINTER (decl->u.id);
+	    name = decl->u.id;
 	  decl = 0;
 	  break;
 
 	default:
 	  gcc_unreachable ();
 	}
-    orig_name = name;
     if (name == 0)
-      name = "type name";
+      {
+	gcc_assert (decl_context == PARM
+		    || decl_context == TYPENAME
+		    || (decl_context == FIELD
+			&& declarator->kind == cdk_id));
+	gcc_assert (!initialized);
+      }
   }
 
   /* A function definition's declarator must have the form of
@@ -4178,7 +4186,10 @@ grokdeclarator (const struct c_declarato
       && current_scope == file_scope
       && variably_modified_type_p (type, NULL_TREE))
     {
-      error ("variably modified %qs at file scope", name);
+      if (name)
+	error ("variably modified %qE at file scope", name);
+      else
+	error ("variably modified field at file scope");
       type = integer_type_node;
     }
 
@@ -4194,9 +4205,16 @@ grokdeclarator (const struct c_declarato
       if ((warn_implicit_int || warn_return_type || flag_isoc99)
 	  && funcdef_flag)
 	warn_about_return_type = 1;
-      else 
-	pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int, 
-		     "type defaults to %<int%> in declaration of %qs", name);
+      else
+	{
+	  if (name)
+	    pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int, 
+			 "type defaults to %<int%> in declaration of %qE",
+			 name);
+	  else
+	    pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int, 
+			 "type defaults to %<int%> in type name");
+	}
     }
 
   /* Adjust the type if a bit-field is being declared,
@@ -4270,11 +4288,17 @@ grokdeclarator (const struct c_declarato
 	  switch (decl_context)
 	    {
 	    case FIELD:
-	      error ("storage class specified for structure field %qs",
-		     name);
+	      if (name)
+		error ("storage class specified for structure field %qE",
+		       name);
+	      else
+		error ("storage class specified for structure field");
 	      break;
 	    case PARM:
-	      error ("storage class specified for parameter %qs", name);
+	      if (name)
+		error ("storage class specified for parameter %qE", name);
+	      else
+		error ("storage class specified for unnamed parameter");
 	      break;
 	    default:
 	      error ("storage class specified for typename");
@@ -4294,26 +4318,26 @@ grokdeclarator (const struct c_declarato
            /* It is fine to have 'extern const' when compiling at C
               and C++ intersection.  */
            if (!(warn_cxx_compat && constp))
-             warning (0, "%qs initialized and declared %<extern%>", name);
+             warning (0, "%qE initialized and declared %<extern%>", name);
          }
       else
-	error ("%qs has both %<extern%> and initializer", name);
+	error ("%qE has both %<extern%> and initializer", name);
     }
   else if (current_scope == file_scope)
     {
       if (storage_class == csc_auto)
-	error ("file-scope declaration of %qs specifies %<auto%>", name);
+	error ("file-scope declaration of %qE specifies %<auto%>", name);
       if (pedantic && storage_class == csc_register)
 	pedwarn (input_location, OPT_pedantic,
-		 "file-scope declaration of %qs specifies %<register%>", name);
+		 "file-scope declaration of %qE specifies %<register%>", name);
     }
   else
     {
       if (storage_class == csc_extern && funcdef_flag)
-	error ("nested function %qs declared %<extern%>", name);
+	error ("nested function %qE declared %<extern%>", name);
       else if (threadp && storage_class == csc_none)
 	{
-	  error ("function-scope %qs implicitly auto and declared "
+	  error ("function-scope %qE implicitly auto and declared "
 		 "%<__thread%>",
 		 name);
 	  threadp = false;
@@ -4407,13 +4431,19 @@ grokdeclarator (const struct c_declarato
 
 	    if (VOID_TYPE_P (type))
 	      {
-		error ("declaration of %qs as array of voids", name);
+		if (name)
+		  error ("declaration of %qE as array of voids", name);
+		else
+		  error ("declaration of type name as array of voids");
 		type = error_mark_node;
 	      }
 
 	    if (TREE_CODE (type) == FUNCTION_TYPE)
 	      {
-		error ("declaration of %qs as array of functions", name);
+		if (name)
+		  error ("declaration of %qE as array of functions", name);
+		else
+		  error ("declaration of type name as array of functions");
 		type = error_mark_node;
 	      }
 
@@ -4444,22 +4474,34 @@ grokdeclarator (const struct c_declarato
 
 		if (!INTEGRAL_TYPE_P (TREE_TYPE (size)))
 		  {
-		    error ("size of array %qs has non-integer type", name);
+		    if (name)
+		      error ("size of array %qE has non-integer type", name);
+		    else
+		      error ("size of unnamed array has non-integer type");
 		    size = integer_one_node;
 		  }
 
 		size = c_fully_fold (size, false, &size_maybe_const);
 
 		if (pedantic && size_maybe_const && integer_zerop (size))
-		  pedwarn (input_location, OPT_pedantic,
-			   "ISO C forbids zero-size array %qs", name);
+		  {
+		    if (name)
+		      pedwarn (input_location, OPT_pedantic,
+			       "ISO C forbids zero-size array %qE", name);
+		    else
+		      pedwarn (input_location, OPT_pedantic,
+			       "ISO C forbids zero-size array");
+		  }
 
 		if (TREE_CODE (size) == INTEGER_CST && size_maybe_const)
 		  {
 		    constant_expression_warning (size);
 		    if (tree_int_cst_sgn (size) < 0)
 		      {
-			error ("size of array %qs is negative", name);
+			if (name)
+			  error ("size of array %qE is negative", name);
+			else
+			  error ("size of unnamed array is negative");
 			size = integer_one_node;
 		      }
 		    /* Handle a size folded to an integer constant but
@@ -4474,16 +4516,17 @@ grokdeclarator (const struct c_declarato
 			if ((decl_context == NORMAL || decl_context == FIELD)
 			    && current_scope == file_scope)
 			  pedwarn (input_location, 0,
-				   "variably modified %qs at file scope", name);
+				   "variably modified %qE at file scope",
+				   name);
 			else
 			  this_size_varies = size_varies = 1;
-			warn_variable_length_array (orig_name, size);
+			warn_variable_length_array (name, size);
 		      }
 		  }
 		else if ((decl_context == NORMAL || decl_context == FIELD)
 			 && current_scope == file_scope)
 		  {
-		    error ("variably modified %qs at file scope", name);
+		    error ("variably modified %qE at file scope", name);
 		    size = integer_one_node;
 		  }
 		else
@@ -4492,7 +4535,7 @@ grokdeclarator (const struct c_declarato
 		       nonconstant even if it is (eg) a const variable
 		       with known value.  */
 		    this_size_varies = size_varies = 1;
-		    warn_variable_length_array (orig_name, size);
+		    warn_variable_length_array (name, size);
 		  }
 
 		if (integer_zerop (size) && !this_size_varies)
@@ -4533,7 +4576,10 @@ grokdeclarator (const struct c_declarato
 		    if (TREE_CODE (itype) == INTEGER_CST
 			&& TREE_OVERFLOW (itype))
 		      {
-			error ("size of array %qs is too large", name);
+			if (name)
+			  error ("size of array %qE is too large", name);
+			else
+			  error ("size of unnamed array is too large");
 			type = error_mark_node;
 			continue;
 		      }
@@ -4686,12 +4732,20 @@ grokdeclarator (const struct c_declarato
 	    /* Warn about some types functions can't return.  */
 	    if (TREE_CODE (type) == FUNCTION_TYPE)
 	      {
-		error ("%qs declared as function returning a function", name);
+		if (name)
+		  error ("%qE declared as function returning a function",
+			 name);
+		else
+		  error ("type name declared as function "
+			 "returning a function");
 		type = integer_type_node;
 	      }
 	    if (TREE_CODE (type) == ARRAY_TYPE)
 	      {
-		error ("%qs declared as function returning an array", name);
+		if (name)
+		  error ("%qE declared as function returning an array", name);
+		else
+		  error ("type name declared as function returning an array");
 		type = integer_type_node;
 	      }
 
@@ -4806,7 +4860,7 @@ grokdeclarator (const struct c_declarato
 
   /* Check the type and width of a bit-field.  */
   if (bitfield)
-    check_bitfield_type_and_width (&type, width, orig_name);
+    check_bitfield_type_and_width (&type, width, name);
 
   /* Did array size calculations overflow?  */
 
@@ -4815,7 +4869,10 @@ grokdeclarator (const struct c_declarato
       && TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST
       && TREE_OVERFLOW (TYPE_SIZE_UNIT (type)))
     {
-      error ("size of array %qs is too large", name);
+      if (name)
+	error ("size of array %qE is too large", name);
+      else
+	error ("size of unnamed array is too large");
       /* If we proceed with the array type as it is, we'll eventually
 	 crash in tree_low_cst().  */
       type = error_mark_node;
@@ -4880,7 +4937,7 @@ grokdeclarator (const struct c_declarato
 		    && !(storage_class == csc_static
 			 || storage_class == csc_register)))))
     {
-      error ("variable or field %qs declared void", name);
+      error ("variable or field %qE declared void", name);
       type = integer_type_node;
     }
 
@@ -4958,13 +5015,13 @@ grokdeclarator (const struct c_declarato
 
 	if (TREE_CODE (type) == FUNCTION_TYPE)
 	  {
-	    error ("field %qs declared as a function", name);
+	    error ("field %qE declared as a function", name);
 	    type = build_pointer_type (type);
 	  }
 	else if (TREE_CODE (type) != ERROR_MARK
 		 && !COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (type))
 	  {
-	    error ("field %qs has incomplete type", name);
+	    error ("field %qE has incomplete type", name);
 	    type = error_mark_node;
 	  }
 	type = c_build_qualified_type (type, type_quals);
@@ -4981,7 +5038,7 @@ grokdeclarator (const struct c_declarato
       {
 	if (storage_class == csc_register || threadp)
 	  {
-	    error ("invalid storage class for function %qs", name);
+	    error ("invalid storage class for function %qE", name);
 	   }
 	else if (current_scope != file_scope)
 	  {
@@ -4991,10 +5048,11 @@ grokdeclarator (const struct c_declarato
 	       GCC allows 'auto', perhaps with 'inline', to support
 	       nested functions.  */
 	    if (storage_class == csc_auto)
-		pedwarn (input_location, OPT_pedantic, "invalid storage class for function %qs", name);
+		pedwarn (input_location, OPT_pedantic,
+			 "invalid storage class for function %qE", name);
 	    else if (storage_class == csc_static)
 	      {
-		error ("invalid storage class for function %qs", name);
+		error ("invalid storage class for function %qE", name);
 		if (funcdef_flag)
 		  storage_class = declspecs->storage_class = csc_none;
 		else
Index: c-typeck.c
===================================================================
--- c-typeck.c	(revision 147096)
+++ c-typeck.c	(working copy)
@@ -5146,7 +5146,9 @@ static void
 push_member_name (tree decl)
 {
   const char *const string
-    = DECL_NAME (decl) ? IDENTIFIER_POINTER (DECL_NAME (decl)) : "<anonymous>";
+    = (DECL_NAME (decl)
+       ? identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl)))
+       : _("<anonymous>"));
   PUSH_SPELLING (SPELLING_MEMBER, string, u.s);
 }
 
@@ -5765,13 +5767,13 @@ start_init (tree decl, tree asmspec_tree
 	       || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
 	       || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE
 	       || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE));
-      locus = IDENTIFIER_POINTER (DECL_NAME (decl));
+      locus = identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl)));
     }
   else
     {
       require_constant_value = 0;
       require_constant_elements = 0;
-      locus = "(anonymous)";
+      locus = _("(anonymous)");
     }
 
   constructor_stack = 0;
Index: c-pragma.c
===================================================================
--- c-pragma.c	(revision 147096)
+++ c-pragma.c	(working copy)
@@ -112,8 +112,8 @@ pop_alignment (tree id)
 	  }
       if (entry == NULL)
 	warning (OPT_Wpragmas, "\
-#pragma pack(pop, %s) encountered without matching #pragma pack(push, %s)"
-		 , IDENTIFIER_POINTER (id), IDENTIFIER_POINTER (id));
+#pragma pack(pop, %E) encountered without matching #pragma pack(push, %E)"
+		 , id, id);
     }
 
   entry = alignment_stack->prev;
@@ -179,7 +179,7 @@ handle_pragma_pack (cpp_reader * ARG_UNU
       else if (!strcmp (op, "pop"))
 	action = pop;
       else
-	GCC_BAD2 ("unknown action %qs for %<#pragma pack%> - ignored", op);
+	GCC_BAD2 ("unknown action %qE for %<#pragma pack%> - ignored", x);
 
       while ((token = pragma_lex (&x)) == CPP_COMMA)
 	{
Index: c-common.c
===================================================================
--- c-common.c	(revision 147096)
+++ c-common.c	(working copy)
@@ -6379,15 +6379,16 @@ handle_mode_attribute (tree *node, tree 
 		       int ARG_UNUSED (flags), bool *no_add_attrs)
 {
   tree type = *node;
+  tree ident = TREE_VALUE (args);
 
   *no_add_attrs = true;
 
-  if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE)
+  if (TREE_CODE (ident) != IDENTIFIER_NODE)
     warning (OPT_Wattributes, "%qE attribute ignored", name);
   else
     {
       int j;
-      const char *p = IDENTIFIER_POINTER (TREE_VALUE (args));
+      const char *p = IDENTIFIER_POINTER (ident);
       int len = strlen (p);
       enum machine_mode mode = VOIDmode;
       tree typefm;
@@ -6427,7 +6428,7 @@ handle_mode_attribute (tree *node, tree 
 
       if (mode == VOIDmode)
 	{
-	  error ("unknown machine mode %qs", p);
+	  error ("unknown machine mode %qE", ident);
 	  return NULL_TREE;
 	}
 
Index: c-parser.c
===================================================================
--- c-parser.c	(revision 147096)
+++ c-parser.c	(working copy)
@@ -222,8 +222,8 @@ c_lex_one_token (c_parser *parser, c_tok
 	      {
 		warning_at (token->location,
 			    OPT_Wc___compat,
-			    "identifier %qs conflicts with C++ keyword",
-			    IDENTIFIER_POINTER (token->value));
+			    "identifier %qE conflicts with C++ keyword",
+			    token->value);
 	      }
 	    else if (c_dialect_objc ())
 	      {

-- 
Joseph S. Myers
joseph@codesourcery.com


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