public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Patch: FYI: avoid use of C++ keywords in gcc/java
@ 2008-06-24 13:02 Tom Tromey
  2008-06-26  2:30 ` Ben Elliston
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2008-06-24 13:02 UTC (permalink / raw)
  To: Gcc Patch List

I'm checking this in on the trunk.

The gcj front end has some variables whose names conflict with C++
keywords.  This patch renames them all.  In my opinion the result is
not any less clear than what is there already.

I am checking this in on the trunk because Kaveh's patch is already
there, and this nicely complements it -- I looked at the gcc-in-cxx
branch but it would be simpler to work there after his patch has been
merged over.

My method was to temporarily put this into a common header:

#pragma GCC poison class typename try catch private public protected explicit namespace export friend operator template this throw typeid typeof using virtual new

That covered all the C++ keywords I thought would be likely to be
used.  So, it is possible I missed an 'int reinterpret_cast;'
somewhere.

This actually catches too many, because we use token pasting where one
token is 'new'.  I would not be averse to renaming these uses if
someone wants to do the work of putting this into system.h.

I bootstrapped and regtested this on x86-64 (compile farm).

Tom

gcc/java/ChangeLog:
2008-06-24  Tom Tromey  <tromey@redhat.com>

	* jcf-path.c (jcf_path_init): Don't name variable 'try'.
	* expr.c (add_type_assertion): Rename argument.
	(build_java_arrayaccess): Don't name variable 'throw'.
	(ARRAY_NEW_MULTI): Don't name variable 'class'.
	* jcf-io.c (find_class): Don't name variable 'class'.
	* mangle.c (compression_table_add): Don't name variable 'new'.
	* constants.c (cpool_for_class): Rename argument.
	(alloc_constant_fieldref): Likewise.
	* jcf-parse.c (handle_innerclass_attribute): Don't name variable
	'class'.
	(read_class): Likewise.
	(parse_zip_file_entries): Likewise.
	(process_zip_dir): Likewise.
	* decl.c (java_mark_class_local): Rename argument.
	* class.c (GEN_TABLE): Use type_name, not typename.
	(gen_indirect_dispatch_tables): Likewise.
	(add_field): Rename argument.
	(is_compiled_class): Likewise.
	(safe_layout_class): Likewise.
	(emit_assertion_table): Likewise.
	* typeck.c (has_method): Rename argument.

Index: gcc/java/typeck.c
===================================================================
--- gcc/java/typeck.c	(revision 137041)
+++ gcc/java/typeck.c	(working copy)
@@ -1,5 +1,5 @@
 /* Handle types for the GNU compiler for the Java(TM) language.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -691,11 +691,11 @@
 		    method_signature, build_java_signature);
 }
 
-/* Return true iff CLASS (or its ancestors) has a method METHOD_NAME.  */
+/* Return true iff KLASS (or its ancestors) has a method METHOD_NAME.  */
 int
-has_method (tree class, tree method_name)
+has_method (tree klass, tree method_name)
 {
-  return lookup_do (class, SEARCH_INTERFACE,
+  return lookup_do (klass, SEARCH_INTERFACE,
 		    method_name, NULL_TREE,
 		    build_null_signature) != NULL_TREE;
 }
Index: gcc/java/class.c
===================================================================
--- gcc/java/class.c	(revision 137041)
+++ gcc/java/class.c	(working copy)
@@ -412,11 +412,12 @@
 #define GEN_TABLE(TABLE, NAME, TABLE_TYPE, TYPE)			\
 do									\
 {									\
-  const char *typename = IDENTIFIER_POINTER (mangled_classname ("", TYPE)); \
-  char *buf = (char *) alloca (strlen (typename) + strlen (#NAME "_syms_") + 1); \
+  const char *type_name = IDENTIFIER_POINTER (mangled_classname ("", TYPE)); \
+  char *buf = (char *) alloca (strlen (type_name)			\
+                               + strlen (#NAME "_syms_") + 1);		\
   tree decl;								\
 									\
-  sprintf (buf, #NAME "_%s", typename);					\
+  sprintf (buf, #NAME "_%s", type_name);				\
   TYPE_## TABLE ##_DECL (type) = decl =					\
     build_decl (VAR_DECL, get_identifier (buf), TABLE_TYPE);		\
   DECL_EXTERNAL (decl) = 1;						\
@@ -428,7 +429,7 @@
   pushdecl (decl);							\
   MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);				\
   DECL_OWNER (decl) = TYPE;						\
-  sprintf (buf, #NAME "_syms_%s", typename);				\
+  sprintf (buf, #NAME "_syms_%s", type_name);				\
   TYPE_## TABLE ##_SYMS_DECL (TYPE) =					\
     build_decl (VAR_DECL, get_identifier (buf), symbols_array_type);	\
   TREE_STATIC (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1;			\
@@ -442,13 +443,14 @@
 void
 gen_indirect_dispatch_tables (tree type)
 {
-  const char *typename = IDENTIFIER_POINTER (mangled_classname ("", type));
+  const char *type_name = IDENTIFIER_POINTER (mangled_classname ("", type));
   {  
     tree field = NULL;
-    char *buf = (char *) alloca (strlen (typename) + strlen ("_catch_classes_") + 1);
+    char *buf = (char *) alloca (strlen (type_name)
+				 + strlen ("_catch_classes_") + 1);
     tree catch_class_type = make_node (RECORD_TYPE);
 
-    sprintf (buf, "_catch_classes_%s", typename);
+    sprintf (buf, "_catch_classes_%s", type_name);
     PUSH_FIELD (catch_class_type, field, "address", utf8const_ptr_type);
     PUSH_FIELD (catch_class_type, field, "classname", ptr_type_node);
     FINISH_RECORD (catch_class_type);
@@ -837,14 +839,14 @@
 }
 
 tree
-add_field (tree class, tree name, tree field_type, int flags)
+add_field (tree klass, tree name, tree field_type, int flags)
 {
   int is_static = (flags & ACC_STATIC) != 0;
   tree field;
   field = build_decl (is_static ? VAR_DECL : FIELD_DECL, name, field_type);
-  TREE_CHAIN (field) = TYPE_FIELDS (class);
-  TYPE_FIELDS (class) = field;
-  DECL_CONTEXT (field) = class;
+  TREE_CHAIN (field) = TYPE_FIELDS (klass);
+  TYPE_FIELDS (klass) = field;
+  DECL_CONTEXT (field) = klass;
   MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field);
 
   if (flags & ACC_PUBLIC) FIELD_PUBLIC (field) = 1;
@@ -871,7 +873,7 @@
 	java_hide_decl (field);
       /* Considered external unless we are compiling it into this
 	 object file.  */
-      DECL_EXTERNAL (field) = (is_compiled_class (class) != 2);
+      DECL_EXTERNAL (field) = (is_compiled_class (klass) != 2);
     }
 
   return field;
@@ -2227,43 +2229,43 @@
   rest_of_decl_compilation (TYPE_NAME (current_class), 1, 0);
 }
 
-/* Return 2 if CLASS is compiled by this compilation job;
-   return 1 if CLASS can otherwise be assumed to be compiled;
-   return 0 if we cannot assume that CLASS is compiled.
+/* Return 2 if KLASS is compiled by this compilation job;
+   return 1 if KLASS can otherwise be assumed to be compiled;
+   return 0 if we cannot assume that KLASS is compiled.
    Returns 1 for primitive and 0 for array types.  */
 int
-is_compiled_class (tree class)
+is_compiled_class (tree klass)
 {
   int seen_in_zip;
-  if (TREE_CODE (class) == POINTER_TYPE)
-    class = TREE_TYPE (class);
-  if (TREE_CODE (class) != RECORD_TYPE)  /* Primitive types are static. */
+  if (TREE_CODE (klass) == POINTER_TYPE)
+    klass = TREE_TYPE (klass);
+  if (TREE_CODE (klass) != RECORD_TYPE)  /* Primitive types are static. */
     return 1;
-  if (TYPE_ARRAY_P (class))
+  if (TYPE_ARRAY_P (klass))
     return 0;
 
-  seen_in_zip = (TYPE_JCF (class) && JCF_SEEN_IN_ZIP (TYPE_JCF (class)));
-  if (CLASS_FROM_CURRENTLY_COMPILED_P (class))
+  seen_in_zip = (TYPE_JCF (klass) && JCF_SEEN_IN_ZIP (TYPE_JCF (klass)));
+  if (CLASS_FROM_CURRENTLY_COMPILED_P (klass))
     {
       /* The class was seen in the current ZIP file and will be
 	 available as a compiled class in the future but may not have
 	 been loaded already. Load it if necessary. This prevent
 	 build_class_ref () from crashing. */
 
-      if (seen_in_zip && !CLASS_LOADED_P (class) && (class != current_class))
-        load_class (class, 1);
+      if (seen_in_zip && !CLASS_LOADED_P (klass) && (klass != current_class))
+        load_class (klass, 1);
 
       /* We return 2 for class seen in ZIP and class from files
          belonging to the same compilation unit */
       return 2;
     }
 
-  if (assume_compiled (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class)))))
+  if (assume_compiled (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (klass)))))
     {
-      if (!CLASS_LOADED_P (class))
+      if (!CLASS_LOADED_P (klass))
 	{
-	  if (class != current_class)
-	    load_class (class, 1);
+	  if (klass != current_class)
+	    load_class (klass, 1);
 	}
       return 1;
     }
@@ -2382,12 +2384,12 @@
    about the class processed currently.  */
 
 void
-safe_layout_class (tree class)
+safe_layout_class (tree klass)
 {
   tree save_current_class = current_class;
   location_t save_location = input_location;
 
-  layout_class (class);
+  layout_class (klass);
 
   current_class = save_current_class;
   input_location = save_location;
@@ -3010,14 +3012,14 @@
   return true;
 }
 
-/* Generate the type assertion table for CLASS, and return its DECL.  */
+/* Generate the type assertion table for KLASS, and return its DECL.  */
 
 static tree
-emit_assertion_table (tree class)
+emit_assertion_table (tree klass)
 {
   tree null_entry, ctor, table_decl;
   tree list = NULL_TREE;
-  htab_t assertions_htab = TYPE_ASSERTIONS (class);
+  htab_t assertions_htab = TYPE_ASSERTIONS (klass);
 
   /* Iterate through the hash table.  */
   htab_traverse (assertions_htab, add_assertion_table_entry, &list);
@@ -3035,7 +3037,7 @@
   list = nreverse (list);
   ctor = build_constructor_from_list (assertion_table_type, list);
 
-  table_decl = build_decl (VAR_DECL, mangled_classname ("_type_assert_", class),
+  table_decl = build_decl (VAR_DECL, mangled_classname ("_type_assert_", klass),
 			   assertion_table_type);
 
   TREE_STATIC (table_decl) = 1;
Index: gcc/java/decl.c
===================================================================
--- gcc/java/decl.c	(revision 137041)
+++ gcc/java/decl.c	(working copy)
@@ -1899,15 +1899,15 @@
 /* Use the preceding two functions and mark all members of the class.  */
 
 void
-java_mark_class_local (tree class)
+java_mark_class_local (tree klass)
 {
   tree t;
 
-  for (t = TYPE_FIELDS (class); t ; t = TREE_CHAIN (t))
+  for (t = TYPE_FIELDS (klass); t ; t = TREE_CHAIN (t))
     if (FIELD_STATIC (t))
       java_mark_decl_local (t);
 
-  for (t = TYPE_METHODS (class); t ; t = TREE_CHAIN (t))
+  for (t = TYPE_METHODS (klass); t ; t = TREE_CHAIN (t))
     if (!METHOD_ABSTRACT (t))
       {
 	if (METHOD_NATIVE (t) && !flag_jni)
Index: gcc/java/jcf-parse.c
===================================================================
--- gcc/java/jcf-parse.c	(revision 137041)
+++ gcc/java/jcf-parse.c	(working copy)
@@ -1160,8 +1160,8 @@
       /* If icii is 0, don't try to read the class. */
       if (icii >= 0)
 	{
-	  tree class = get_class_constant (jcf, icii);
-	  tree decl = TYPE_NAME (class);
+	  tree klass = get_class_constant (jcf, icii);
+	  tree decl = TYPE_NAME (klass);
           /* Skip reading further if ocii is null */
           if (DECL_P (decl) && !CLASS_COMPLETE_P (decl) && ocii)
 	    {
@@ -1253,7 +1253,7 @@
 read_class (tree name)
 {
   JCF this_jcf, *jcf;
-  tree icv, class = NULL_TREE;
+  tree icv, klass = NULL_TREE;
   tree save_current_class = current_class;
   tree save_output_class = output_class;
   location_t save_location = input_location;
@@ -1261,8 +1261,8 @@
 
   if ((icv = IDENTIFIER_CLASS_VALUE (name)) != NULL_TREE)
     {
-      class = TREE_TYPE (icv);
-      jcf = TYPE_JCF (class);
+      klass = TREE_TYPE (icv);
+      jcf = TYPE_JCF (klass);
     }
   else
     jcf = NULL;
@@ -1284,21 +1284,21 @@
 
   current_jcf = jcf;
 
-  if (class == NULL_TREE || ! CLASS_PARSED_P (class))
+  if (klass == NULL_TREE || ! CLASS_PARSED_P (klass))
     {
-      output_class = current_class = class;
+      output_class = current_class = klass;
       if (JCF_SEEN_IN_ZIP (current_jcf))
 	read_zip_member(current_jcf,
 			current_jcf->zipd, current_jcf->zipd->zipf);
       jcf_parse (current_jcf);
       /* Parsing might change the class, in which case we have to
 	 put it back where we found it.  */
-      if (current_class != class && icv != NULL_TREE)
+      if (current_class != klass && icv != NULL_TREE)
 	TREE_TYPE (icv) = current_class;
-      class = current_class;
+      klass = current_class;
     }
-  layout_class (class);
-  load_inner_classes (class);
+  layout_class (klass);
+  load_inner_classes (klass);
 
   output_class = save_output_class;
   current_class = save_current_class;
@@ -2025,7 +2025,7 @@
   for (i = 0, zdir = (ZipDirectory *)localToFile->central_directory;
        i < localToFile->count; i++, zdir = ZIPDIR_NEXT (zdir))
     {
-      tree class;
+      tree klass;
 
       switch (classify_zip_file (zdir))
 	{
@@ -2036,14 +2036,14 @@
 	  {
 	    char *class_name = compute_class_name (zdir);
 	    int previous_alias_set = -1;
-	    class = lookup_class (get_identifier (class_name));
+	    klass = lookup_class (get_identifier (class_name));
 	    FREE (class_name);
-	    current_jcf = TYPE_JCF (class);
-	    output_class = current_class = class;
+	    current_jcf = TYPE_JCF (klass);
+	    output_class = current_class = klass;
 
 	    /* This is a dummy class, and now we're compiling it for
 	       real.  */
-	    gcc_assert (! TYPE_DUMMY (class));
+	    gcc_assert (! TYPE_DUMMY (klass));
 
 	    /* This is for a corner case where we have a superclass
 	       but no superclass fields.
@@ -2058,17 +2058,17 @@
 	       FIXME: this really is a kludge.  We should figure out a
 	       way to lay out the class properly before this
 	       happens.  */
-	    if (TYPE_SIZE (class) && CLASSTYPE_SUPER (class)
-		&& integer_zerop (TYPE_SIZE (class)))
+	    if (TYPE_SIZE (klass) && CLASSTYPE_SUPER (klass)
+		&& integer_zerop (TYPE_SIZE (klass)))
 	      {
-		TYPE_SIZE (class) = NULL_TREE;
-		previous_alias_set = TYPE_ALIAS_SET (class);
-		TYPE_ALIAS_SET (class) = -1;
+		TYPE_SIZE (klass) = NULL_TREE;
+		previous_alias_set = TYPE_ALIAS_SET (klass);
+		TYPE_ALIAS_SET (klass) = -1;
 	      }
 
-	    if (! CLASS_LOADED_P (class))
+	    if (! CLASS_LOADED_P (klass))
 	      {
-		if (! CLASS_PARSED_P (class))
+		if (! CLASS_PARSED_P (klass))
 		  {
 		    read_zip_member (current_jcf, zdir, localToFile);
 		    jcf_parse (current_jcf);
@@ -2078,7 +2078,7 @@
 	      }
 
 	    if (previous_alias_set != -1)
-	      TYPE_ALIAS_SET (class) = previous_alias_set;
+	      TYPE_ALIAS_SET (klass) = previous_alias_set;
 
 	    if (TYPE_SIZE (current_class) != error_mark_node)
 	      {
@@ -2146,7 +2146,7 @@
        i < localToFile->count; i++, zdir = ZIPDIR_NEXT (zdir))
     {
       char *class_name, *file_name, *class_name_in_zip_dir;
-      tree class;
+      tree klass;
       JCF  *jcf;
 
       class_name_in_zip_dir = ZIPDIR_FILENAME (zdir);
@@ -2163,9 +2163,9 @@
       strncpy (file_name, class_name_in_zip_dir, zdir->filename_length);
       file_name [zdir->filename_length] = '\0';
 
-      class = lookup_class (get_identifier (class_name));
+      klass = lookup_class (get_identifier (class_name));
 
-      if (CLASS_FROM_CURRENTLY_COMPILED_P (class))
+      if (CLASS_FROM_CURRENTLY_COMPILED_P (klass))
 	{
 	  /* We've already compiled this class.  */
 	  duplicate_class_warning (file_name);
@@ -2173,7 +2173,7 @@
 	}
       /* This function is only called when processing a zip file seen
 	 on the command line.  */
-      CLASS_FROM_CURRENTLY_COMPILED_P (class) = 1;
+      CLASS_FROM_CURRENTLY_COMPILED_P (klass) = 1;
 
       jcf->read_state  = finput;
       jcf->filbuf      = jcf_filbuf_from_stdio;
@@ -2181,7 +2181,7 @@
       jcf->filename    = file_name;
       jcf->zipd        = zdir;
 
-      TYPE_JCF (class) = jcf;
+      TYPE_JCF (klass) = jcf;
     }
 }
 
Index: gcc/java/constants.c
===================================================================
--- gcc/java/constants.c	(revision 137041)
+++ gcc/java/constants.c	(working copy)
@@ -1,6 +1,6 @@
 /* Handle the constant pool of the Java(TM) Virtual Machine.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-   2007  Free Software Foundation, Inc.
+   2007, 2008  Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -327,14 +327,14 @@
 /* Given a class, return its constant pool, creating one if necessary.  */
 
 CPool *
-cpool_for_class (tree class)
+cpool_for_class (tree klass)
 {
-  CPool *cpool = TYPE_CPOOL (class);
+  CPool *cpool = TYPE_CPOOL (klass);
 
   if (cpool == NULL)
     {
       cpool = GGC_CNEW (struct CPool);
-      TYPE_CPOOL (class) = cpool;
+      TYPE_CPOOL (klass) = cpool;
     }
   return cpool;
 }
@@ -370,13 +370,13 @@
 }
 
 /* Look for a field ref that matches DECL in the constant pool of
-   CLASS.  
+   KLASS.  
    Return the index of the entry.  */
 
 int
-alloc_constant_fieldref (tree class, tree decl)
+alloc_constant_fieldref (tree klass, tree decl)
 {
-  CPool *outgoing_cpool = cpool_for_class (class);
+  CPool *outgoing_cpool = cpool_for_class (klass);
   int class_index 
     = find_tree_constant (outgoing_cpool, CONSTANT_Class, 
 			  DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))));
Index: gcc/java/jcf-path.c
===================================================================
--- gcc/java/jcf-path.c	(revision 137041)
+++ gcc/java/jcf-path.c	(working copy)
@@ -1,6 +1,6 @@
 /* Handle CLASSPATH, -classpath, and path searching.
    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006,
-   2007 Free Software Foundation, Inc.
+   2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -213,7 +213,7 @@
 jcf_path_init (void)
 {
   char *cp;
-  char *try, sep[2];
+  char *attempt, sep[2];
   struct stat stat_b;
   int found = 0, len;
 
@@ -227,56 +227,56 @@
   GET_ENVIRONMENT (cp, "GCC_EXEC_PREFIX");
   if (cp)
     {
-      try = (char *) alloca (strlen (cp) + 50);
+      attempt = (char *) alloca (strlen (cp) + 50);
       /* The exec prefix can be something like
 	 /usr/local/bin/../lib/gcc-lib/.  We want to change this
 	 into a pointer to the share/java directory.  We support two
 	 configurations: one where prefix and exec-prefix are the
 	 same, and one where exec-prefix is `prefix/SOMETHING'.  */
-      strcpy (try, cp);
-      strcat (try, DIR_UP);
-      strcat (try, sep);
-      strcat (try, DIR_UP);
-      strcat (try, sep);
-      len = strlen (try);
+      strcpy (attempt, cp);
+      strcat (attempt, DIR_UP);
+      strcat (attempt, sep);
+      strcat (attempt, DIR_UP);
+      strcat (attempt, sep);
+      len = strlen (attempt);
 
-      strcpy (try + len, "share");
-      strcat (try, sep);
-      strcat (try, "java");
-      strcat (try, sep);
-      strcat (try, "libgcj-" DEFAULT_TARGET_VERSION ".jar");
-      if (! stat (try, &stat_b))
+      strcpy (attempt + len, "share");
+      strcat (attempt, sep);
+      strcat (attempt, "java");
+      strcat (attempt, sep);
+      strcat (attempt, "libgcj-" DEFAULT_TARGET_VERSION ".jar");
+      if (! stat (attempt, &stat_b))
 	{
-	  add_entry (&sys_dirs, try, 1);
+	  add_entry (&sys_dirs, attempt, 1);
 	  found = 1;
-	  strcpy (&try[strlen (try)
-		      - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
+	  strcpy (&attempt[strlen (attempt)
+			   - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
 		  sep);
-	  strcat (try, "ext");
-	  strcat (try, sep);
-	  if (! stat (try, &stat_b))
-	    jcf_path_extdirs_arg (try);
+	  strcat (attempt, "ext");
+	  strcat (attempt, sep);
+	  if (! stat (attempt, &stat_b))
+	    jcf_path_extdirs_arg (attempt);
 	}
       else
 	{
-	  strcpy (try + len, DIR_UP);
-	  strcat (try, sep);
-	  strcat (try, "share");
-	  strcat (try, sep);
-	  strcat (try, "java");
-	  strcat (try, sep);
-	  strcat (try, "libgcj-" DEFAULT_TARGET_VERSION ".jar");
-	  if (! stat (try, &stat_b))
+	  strcpy (attempt + len, DIR_UP);
+	  strcat (attempt, sep);
+	  strcat (attempt, "share");
+	  strcat (attempt, sep);
+	  strcat (attempt, "java");
+	  strcat (attempt, sep);
+	  strcat (attempt, "libgcj-" DEFAULT_TARGET_VERSION ".jar");
+	  if (! stat (attempt, &stat_b))
 	    {
-	      add_entry (&sys_dirs, try, 1);
+	      add_entry (&sys_dirs, attempt, 1);
 	      found = 1;
-	      strcpy (&try[strlen (try)
-			  - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
+	      strcpy (&attempt[strlen (attempt)
+			       - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
 		      sep);
-	      strcat (try, "ext");
-	      strcat (try, sep);
-	      if (! stat (try, &stat_b))
-		jcf_path_extdirs_arg (try);
+	      strcat (attempt, "ext");
+	      strcat (attempt, sep);
+	      if (! stat (attempt, &stat_b))
+		jcf_path_extdirs_arg (attempt);
 	    }
 	}
     }
Index: gcc/java/mangle.c
===================================================================
--- gcc/java/mangle.c	(revision 137041)
+++ gcc/java/mangle.c	(working copy)
@@ -1,6 +1,6 @@
 /* Functions related to mangling class names for the GNU compiler
    for the Java(TM) language.
-   Copyright (C) 1998, 1999, 2001, 2002, 2003, 2006, 2007
+   Copyright (C) 1998, 1999, 2001, 2002, 2003, 2006, 2007, 2008
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -782,13 +782,13 @@
 {
   if (compression_next == TREE_VEC_LENGTH (compression_table))
     {
-      tree new = make_tree_vec (2*compression_next);
+      tree new_table = make_tree_vec (2*compression_next);
       int i;
 
       for (i = 0; i < compression_next; i++)
-	TREE_VEC_ELT (new, i) = TREE_VEC_ELT (compression_table, i);
+	TREE_VEC_ELT (new_table, i) = TREE_VEC_ELT (compression_table, i);
 
-      compression_table = new;
+      compression_table = new_table;
     }
   TREE_VEC_ELT (compression_table, compression_next++) = type;
 }
Index: gcc/java/jcf-io.c
===================================================================
--- gcc/java/jcf-io.c	(revision 137041)
+++ gcc/java/jcf-io.c	(working copy)
@@ -1,6 +1,6 @@
 /* Utility routines for finding and reading Java(TM) .class files.
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005,
-   2006, 2007 Free Software Foundation, Inc.
+   2006, 2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -448,7 +448,7 @@
 find_class (const char *classname, int classname_length, JCF *jcf)
 {
   int fd;
-  int i, k, class = -1;
+  int i, k, klass = -1;
   struct stat class_buf;
   char *dep_file;
   void *entry;
@@ -478,7 +478,7 @@
   for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
     {
       const char *path_name = jcf_path_name (entry);
-      if (class != 0)
+      if (klass != 0)
 	{
 	  int dir_len;
 
@@ -521,12 +521,12 @@
 	      else
 		continue;
 	    }
-	  class = caching_stat(buffer, &class_buf);
+	  klass = caching_stat(buffer, &class_buf);
 	}
     }
 
   dep_file = buffer;
-  if (!class)
+  if (!klass)
     {
       SOURCE_FRONTEND_DEBUG ((stderr, "[Class selected: %s]\n",
 			      classname+classname_length-
Index: gcc/java/expr.c
===================================================================
--- gcc/java/expr.c	(revision 137041)
+++ gcc/java/expr.c	(working copy)
@@ -457,20 +457,20 @@
 }
 
 /* Add an entry to the type assertion table for the given class.  
-   CLASS is the class for which this assertion will be evaluated by the 
+   KLASS is the class for which this assertion will be evaluated by the 
    runtime during loading/initialization.
    ASSERTION_CODE is the 'opcode' or type of this assertion: see java-tree.h.
    OP1 and OP2 are the operands. The tree type of these arguments may be
    specific to each assertion_code. */
 
 void
-add_type_assertion (tree class, int assertion_code, tree op1, tree op2)
+add_type_assertion (tree klass, int assertion_code, tree op1, tree op2)
 {
   htab_t assertions_htab;
   type_assertion as;
   void **as_pp;
 
-  assertions_htab = TYPE_ASSERTIONS (class);
+  assertions_htab = TYPE_ASSERTIONS (klass);
   if (assertions_htab == NULL)
     {
       assertions_htab = htab_create_ggc (7, type_assertion_hash, 
@@ -893,7 +893,7 @@
 tree
 build_java_arrayaccess (tree array, tree type, tree index)
 {
-  tree node, throw = NULL_TREE;
+  tree node, throw_expr = NULL_TREE;
   tree data_field;
   tree ref;
   tree array_type = TREE_TYPE (TREE_TYPE (array));
@@ -921,17 +921,18 @@
 			  len);
       if (! integer_zerop (test))
 	{
-	  throw = build2 (TRUTH_ANDIF_EXPR, int_type_node, test,
-			  build_java_throw_out_of_bounds_exception (index));
+	  throw_expr
+	    = build2 (TRUTH_ANDIF_EXPR, int_type_node, test,
+		      build_java_throw_out_of_bounds_exception (index));
 	  /* allows expansion within COMPOUND */
-	  TREE_SIDE_EFFECTS( throw ) = 1;
+	  TREE_SIDE_EFFECTS( throw_expr ) = 1;
 	}
     }
 
   /* If checking bounds, wrap the index expr with a COMPOUND_EXPR in order
      to have the bounds check evaluated first. */
-  if (throw != NULL_TREE)
-    index = build2 (COMPOUND_EXPR, int_type_node, throw, index);
+  if (throw_expr != NULL_TREE)
+    index = build2 (COMPOUND_EXPR, int_type_node, throw_expr, index);
 
   data_field = lookup_field (&array_type, get_identifier ("data"));
 
@@ -3447,9 +3448,9 @@
   }
 #define ARRAY_NEW_MULTI()					\
   {								\
-    tree class = get_class_constant (current_jcf, IMMEDIATE_u2 );	\
+    tree klass = get_class_constant (current_jcf, IMMEDIATE_u2 );	\
     int  ndims = IMMEDIATE_u1;					\
-    expand_java_multianewarray( class, ndims );			\
+    expand_java_multianewarray( klass, ndims );			\
   }
 
 #define UNOP(OPERAND_TYPE, OPERAND_VALUE) \

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-06-24 13:02 Patch: FYI: avoid use of C++ keywords in gcc/java Tom Tromey
@ 2008-06-26  2:30 ` Ben Elliston
  2008-06-26  3:17   ` Tom Tromey
  0 siblings, 1 reply; 19+ messages in thread
From: Ben Elliston @ 2008-06-26  2:30 UTC (permalink / raw)
  To: tromey; +Cc: gcc-patches

On Tue, 2008-06-24 at 06:46 -0600, Tom Tromey wrote:

> The gcj front end has some variables whose names conflict with C++
> keywords.  This patch renames them all.  In my opinion the result is
> not any less clear than what is there already.

Can I suggest that you document why class appears as "klass"?  That
might help avoid people trying to "fix" it or clarify for people whose
native language is not English?

Cheers, Ben


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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-06-26  2:30 ` Ben Elliston
@ 2008-06-26  3:17   ` Tom Tromey
  2008-06-26  6:39     ` Kaveh R. GHAZI
  2008-06-26  9:51     ` Markus Milleder
  0 siblings, 2 replies; 19+ messages in thread
From: Tom Tromey @ 2008-06-26  3:17 UTC (permalink / raw)
  To: Ben Elliston; +Cc: gcc-patches

>>>>> "Ben" == Ben Elliston <bje@au1.ibm.com> writes:

>> The gcj front end has some variables whose names conflict with C++
>> keywords.  This patch renames them all.  In my opinion the result is
>> not any less clear than what is there already.

Ben> Can I suggest that you document why class appears as "klass"?  That
Ben> might help avoid people trying to "fix" it or clarify for people whose
Ben> native language is not English?

'klass' is already used in a lot of places in gcj without explanation.
Anyway I'm willing to add a comment, but I don't know where.  I
definitely don't want to add a comment at every declaration of a
variable with this name.

As for folks fixing it... eventually I hope we can do the poison
thing, and then anyone changing it will get an error.

Tom

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-06-26  3:17   ` Tom Tromey
@ 2008-06-26  6:39     ` Kaveh R. GHAZI
  2008-06-26 21:13       ` Tom Tromey
  2008-06-26  9:51     ` Markus Milleder
  1 sibling, 1 reply; 19+ messages in thread
From: Kaveh R. GHAZI @ 2008-06-26  6:39 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Ben Elliston, gcc-patches, gdr

On Wed, 25 Jun 2008, Tom Tromey wrote:

> 'klass' is already used in a lot of places in gcj without explanation.
> Anyway I'm willing to add a comment, but I don't know where.  I
> definitely don't want to add a comment at every declaration of a
> variable with this name.
>
> As for folks fixing it... eventually I hope we can do the poison
> thing, and then anyone changing it will get an error.
> Tom

I think Gaby is going to extend -Wc++-compat to warn about these so we
won't have to poison them long-term (PR21759).  I don't know if doing this
with a flag will avoid the false positives with token pasting or not.

http://gcc.gnu.org/ml/gcc/2008-06/msg00415.html

Gaby, how's that coming along? :-)

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-06-26  3:17   ` Tom Tromey
  2008-06-26  6:39     ` Kaveh R. GHAZI
@ 2008-06-26  9:51     ` Markus Milleder
  1 sibling, 0 replies; 19+ messages in thread
From: Markus Milleder @ 2008-06-26  9:51 UTC (permalink / raw)
  To: gcc-patches

gcc-patches-owner@gcc.gnu.org schrieb am 26.06.2008 04:30:08:

> >>>>> "Ben" == Ben Elliston <bje@au1.ibm.com> writes:
>
> >> The gcj front end has some variables whose names conflict with C++
> >> keywords.  This patch renames them all.  In my opinion the result is
> >> not any less clear than what is there already.
>
> Ben> Can I suggest that you document why class appears as "klass"?  That
> Ben> might help avoid people trying to "fix" it or clarify for people whose
> Ben> native language is not English?
>
> 'klass' is already used in a lot of places in gcj without explanation.
> Anyway I'm willing to add a comment, but I don't know where.  I
> definitely don't want to add a comment at every declaration of a
> variable with this name.
>
Since 'class' is a keyword in Java, too, 'klass' is the usual variable name
for instances of the 'java.lang.Class' type that represents classes, e.g.
for reflection or during class loading.

Thus, it is a common idiom for advanced Java programmers.

      Markus Milleder


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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-06-26  6:39     ` Kaveh R. GHAZI
@ 2008-06-26 21:13       ` Tom Tromey
  2008-07-01 18:00         ` Kaveh R. GHAZI
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2008-06-26 21:13 UTC (permalink / raw)
  To: Kaveh R. GHAZI; +Cc: Ben Elliston, gcc-patches, gdr

>>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:

>> As for folks fixing it... eventually I hope we can do the poison
>> thing, and then anyone changing it will get an error.

Kaveh> I think Gaby is going to extend -Wc++-compat to warn about these so we
Kaveh> won't have to poison them long-term (PR21759).

Today I wrote an experimental patch to do this.  I've appended it, in
all its ChangeLog-less glory.  This patch is kind of bogus, but it
works well enough to prevent bootstrapping :).  I get a lot of errors
(due to -Werror) from the C++ FE about uses of 'template' and
'namespace' as identifiers.

Tom

Index: gcc/cp/lex.c
===================================================================
--- gcc/cp/lex.c	(revision 137041)
+++ gcc/cp/lex.c	(working copy)
@@ -163,190 +163,26 @@
     = "(round %=)";
 }
 
-/* The reserved keyword table.  */
-struct resword
-{
-  const char *const word;
-  ENUM_BITFIELD(rid) const rid : 16;
-  const unsigned int disable   : 16;
-};
-
-/* Disable mask.  Keywords are disabled if (reswords[i].disable & mask) is
-   _true_.  */
-#define D_EXT		0x01	/* GCC extension */
-#define D_ASM		0x02	/* in C99, but has a switch to turn it off */
-#define D_OBJC		0x04	/* Objective C++ only */
-#define D_CXX0X         0x08    /* C++0x only */
-
 CONSTRAINT(ridbits_fit, RID_LAST_MODIFIER < sizeof(unsigned long) * CHAR_BIT);
 
-static const struct resword reswords[] =
-{
-  { "_Complex",		RID_COMPLEX,	0 },
-  { "__FUNCTION__",	RID_FUNCTION_NAME, 0 },
-  { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
-  { "__alignof",	RID_ALIGNOF,	0 },
-  { "__alignof__",	RID_ALIGNOF,	0 },
-  { "__asm",		RID_ASM,	0 },
-  { "__asm__",		RID_ASM,	0 },
-  { "__attribute",	RID_ATTRIBUTE,	0 },
-  { "__attribute__",	RID_ATTRIBUTE,	0 },
-  { "__builtin_offsetof", RID_OFFSETOF, 0 },
-  { "__builtin_va_arg",	RID_VA_ARG,	0 },
-  { "__complex",	RID_COMPLEX,	0 },
-  { "__complex__",	RID_COMPLEX,	0 },
-  { "__const",		RID_CONST,	0 },
-  { "__const__",	RID_CONST,	0 },
-  { "__decltype",       RID_DECLTYPE,   0 },
-  { "__extension__",	RID_EXTENSION,	0 },
-  { "__func__",		RID_C99_FUNCTION_NAME,	0 },
-  { "__has_nothrow_assign", RID_HAS_NOTHROW_ASSIGN, 0 },
-  { "__has_nothrow_constructor", RID_HAS_NOTHROW_CONSTRUCTOR, 0 },
-  { "__has_nothrow_copy", RID_HAS_NOTHROW_COPY, 0 },
-  { "__has_trivial_assign", RID_HAS_TRIVIAL_ASSIGN, 0 },
-  { "__has_trivial_constructor", RID_HAS_TRIVIAL_CONSTRUCTOR, 0 },
-  { "__has_trivial_copy", RID_HAS_TRIVIAL_COPY, 0 },
-  { "__has_trivial_destructor", RID_HAS_TRIVIAL_DESTRUCTOR, 0 },
-  { "__has_virtual_destructor", RID_HAS_VIRTUAL_DESTRUCTOR, 0 },
-  { "__is_abstract",	RID_IS_ABSTRACT, 0 },
-  { "__is_base_of",	RID_IS_BASE_OF, 0 },
-  { "__is_class",	RID_IS_CLASS,	0 },
-  { "__is_convertible_to", RID_IS_CONVERTIBLE_TO, 0 },
-  { "__is_empty",	RID_IS_EMPTY,	0 },
-  { "__is_enum",	RID_IS_ENUM,	0 },
-  { "__is_pod",		RID_IS_POD,	0 },
-  { "__is_polymorphic",	RID_IS_POLYMORPHIC, 0 },
-  { "__is_union",	RID_IS_UNION,	0 },
-  { "__imag",		RID_IMAGPART,	0 },
-  { "__imag__",		RID_IMAGPART,	0 },
-  { "__inline",		RID_INLINE,	0 },
-  { "__inline__",	RID_INLINE,	0 },
-  { "__label__",	RID_LABEL,	0 },
-  { "__null",		RID_NULL,	0 },
-  { "__real",		RID_REALPART,	0 },
-  { "__real__",		RID_REALPART,	0 },
-  { "__restrict",	RID_RESTRICT,	0 },
-  { "__restrict__",	RID_RESTRICT,	0 },
-  { "__signed",		RID_SIGNED,	0 },
-  { "__signed__",	RID_SIGNED,	0 },
-  { "__thread",		RID_THREAD,	0 },
-  { "__typeof",		RID_TYPEOF,	0 },
-  { "__typeof__",	RID_TYPEOF,	0 },
-  { "__volatile",	RID_VOLATILE,	0 },
-  { "__volatile__",	RID_VOLATILE,	0 },
-  { "asm",		RID_ASM,	D_ASM },
-  { "auto",		RID_AUTO,	0 },
-  { "bool",		RID_BOOL,	0 },
-  { "break",		RID_BREAK,	0 },
-  { "case",		RID_CASE,	0 },
-  { "catch",		RID_CATCH,	0 },
-  { "char",		RID_CHAR,	0 },
-  { "char16_t",		RID_CHAR16,	D_CXX0X },
-  { "char32_t",		RID_CHAR32,	D_CXX0X },
-  { "class",		RID_CLASS,	0 },
-  { "const",		RID_CONST,	0 },
-  { "const_cast",	RID_CONSTCAST,	0 },
-  { "continue",		RID_CONTINUE,	0 },
-  { "decltype",         RID_DECLTYPE,   D_CXX0X },
-  { "default",		RID_DEFAULT,	0 },
-  { "delete",		RID_DELETE,	0 },
-  { "do",		RID_DO,		0 },
-  { "double",		RID_DOUBLE,	0 },
-  { "dynamic_cast",	RID_DYNCAST,	0 },
-  { "else",		RID_ELSE,	0 },
-  { "enum",		RID_ENUM,	0 },
-  { "explicit",		RID_EXPLICIT,	0 },
-  { "export",		RID_EXPORT,	0 },
-  { "extern",		RID_EXTERN,	0 },
-  { "false",		RID_FALSE,	0 },
-  { "float",		RID_FLOAT,	0 },
-  { "for",		RID_FOR,	0 },
-  { "friend",		RID_FRIEND,	0 },
-  { "goto",		RID_GOTO,	0 },
-  { "if",		RID_IF,		0 },
-  { "inline",		RID_INLINE,	0 },
-  { "int",		RID_INT,	0 },
-  { "long",		RID_LONG,	0 },
-  { "mutable",		RID_MUTABLE,	0 },
-  { "namespace",	RID_NAMESPACE,	0 },
-  { "new",		RID_NEW,	0 },
-  { "operator",		RID_OPERATOR,	0 },
-  { "private",		RID_PRIVATE,	0 },
-  { "protected",	RID_PROTECTED,	0 },
-  { "public",		RID_PUBLIC,	0 },
-  { "register",		RID_REGISTER,	0 },
-  { "reinterpret_cast",	RID_REINTCAST,	0 },
-  { "return",		RID_RETURN,	0 },
-  { "short",		RID_SHORT,	0 },
-  { "signed",		RID_SIGNED,	0 },
-  { "sizeof",		RID_SIZEOF,	0 },
-  { "static",		RID_STATIC,	0 },
-  { "static_assert",    RID_STATIC_ASSERT, D_CXX0X },
-  { "static_cast",	RID_STATCAST,	0 },
-  { "struct",		RID_STRUCT,	0 },
-  { "switch",		RID_SWITCH,	0 },
-  { "template",		RID_TEMPLATE,	0 },
-  { "this",		RID_THIS,	0 },
-  { "throw",		RID_THROW,	0 },
-  { "true",		RID_TRUE,	0 },
-  { "try",		RID_TRY,	0 },
-  { "typedef",		RID_TYPEDEF,	0 },
-  { "typename",		RID_TYPENAME,	0 },
-  { "typeid",		RID_TYPEID,	0 },
-  { "typeof",		RID_TYPEOF,	D_ASM|D_EXT },
-  { "union",		RID_UNION,	0 },
-  { "unsigned",		RID_UNSIGNED,	0 },
-  { "using",		RID_USING,	0 },
-  { "virtual",		RID_VIRTUAL,	0 },
-  { "void",		RID_VOID,	0 },
-  { "volatile",		RID_VOLATILE,	0 },
-  { "wchar_t",		RID_WCHAR,	0 },
-  { "while",		RID_WHILE,	0 },
-
-  /* The remaining keywords are specific to Objective-C++.  NB:
-     All of them will remain _disabled_, since they are context-
-     sensitive.  */
-
-  /* These ObjC keywords are recognized only immediately after
-     an '@'.  NB: The following C++ keywords double as
-     ObjC keywords in this context: RID_CLASS, RID_PRIVATE,
-     RID_PROTECTED, RID_PUBLIC, RID_THROW, RID_TRY and RID_CATCH.  */
-  { "compatibility_alias", RID_AT_ALIAS,	D_OBJC },
-  { "defs",		RID_AT_DEFS,		D_OBJC },
-  { "encode",		RID_AT_ENCODE,		D_OBJC },
-  { "end",		RID_AT_END,		D_OBJC },
-  { "implementation",	RID_AT_IMPLEMENTATION,	D_OBJC },
-  { "interface",	RID_AT_INTERFACE,	D_OBJC },
-  { "protocol",		RID_AT_PROTOCOL,	D_OBJC },
-  { "selector",		RID_AT_SELECTOR,	D_OBJC },
-  { "finally",		RID_AT_FINALLY,		D_OBJC },
-  { "synchronized",	RID_AT_SYNCHRONIZED,	D_OBJC },
-  /* These are recognized only in protocol-qualifier context.  */
-  { "bycopy",		RID_BYCOPY,		D_OBJC },
-  { "byref",		RID_BYREF,		D_OBJC },
-  { "in",		RID_IN,			D_OBJC },
-  { "inout",		RID_INOUT,		D_OBJC },
-  { "oneway",		RID_ONEWAY,		D_OBJC },
-  { "out",		RID_OUT,		D_OBJC },
-};
-
 void
 init_reswords (void)
 {
   unsigned int i;
   tree id;
-  int mask = ((flag_no_asm ? D_ASM : 0)
+  int mask = (D_CONLY
+	      | (flag_no_asm ? D_ASM : 0)
 	      | D_OBJC
 	      | (flag_no_gnu_keywords ? D_EXT : 0)
               | ((cxx_dialect == cxx0x) ? 0 : D_CXX0X));
 
   ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX);
-  for (i = 0; i < ARRAY_SIZE (reswords); i++)
+  for (i = 0; i < num_c_common_reswords; i++)
     {
-      id = get_identifier (reswords[i].word);
-      C_SET_RID_CODE (id, reswords[i].rid);
-      ridpointers [(int) reswords[i].rid] = id;
-      if (! (reswords[i].disable & mask))
+      id = get_identifier (c_common_reswords[i].word);
+      C_SET_RID_CODE (id, c_common_reswords[i].rid);
+      ridpointers [(int) c_common_reswords[i].rid] = id;
+      if (! (c_common_reswords[i].disable & mask))
 	C_IS_RESERVED_WORD (id) = 1;
     }
 }
Index: gcc/c-common.c
===================================================================
--- gcc/c-common.c	(revision 137041)
+++ gcc/c-common.c	(working copy)
@@ -219,6 +219,173 @@
 
 tree c_global_trees[CTI_MAX];
 \f
+/* Reserved words.  */
+const struct c_common_resword c_common_reswords[] =
+{
+  { "_Accum",           RID_ACCUM,     D_EXT | D_CONLY },
+  { "_Bool",		RID_BOOL,	0 },
+  { "_Complex",		RID_COMPLEX,	0 },
+  { "_Decimal128",      RID_DFLOAT128, D_EXT | D_CONLY },
+  { "_Decimal32",       RID_DFLOAT32,  D_EXT | D_CONLY },
+  { "_Decimal64",       RID_DFLOAT64,  D_EXT | D_CONLY },
+  { "_Fract",           RID_FRACT,     D_EXT | D_CONLY },
+  { "_Sat",             RID_SAT,       D_EXT | D_CONLY },
+  { "__FUNCTION__",	RID_FUNCTION_NAME, 0 },
+  { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
+  { "__alignof",	RID_ALIGNOF,	0 },
+  { "__alignof__",	RID_ALIGNOF,	0 },
+  { "__asm",		RID_ASM,	0 },
+  { "__asm__",		RID_ASM,	0 },
+  { "__attribute",	RID_ATTRIBUTE,	0 },
+  { "__attribute__",	RID_ATTRIBUTE,	0 },
+  { "__builtin_choose_expr", RID_CHOOSE_EXPR, D_CONLY },
+  { "__builtin_offsetof", RID_OFFSETOF, 0 },
+  { "__builtin_types_compatible_p", RID_TYPES_COMPATIBLE_P, D_CONLY },
+  { "__builtin_va_arg",	RID_VA_ARG,	0 },
+  { "__complex",	RID_COMPLEX,	0 },
+  { "__complex__",	RID_COMPLEX,	0 },
+  { "__const",		RID_CONST,	0 },
+  { "__const__",	RID_CONST,	0 },
+  { "__decltype",       RID_DECLTYPE,   D_CXX },
+  { "__extension__",	RID_EXTENSION,	0 },
+  { "__func__",		RID_C99_FUNCTION_NAME, 0 },
+  { "__has_nothrow_assign", RID_HAS_NOTHROW_ASSIGN, D_CXX },
+  { "__has_nothrow_constructor", RID_HAS_NOTHROW_CONSTRUCTOR, D_CXX },
+  { "__has_nothrow_copy", RID_HAS_NOTHROW_COPY, D_CXX },
+  { "__has_trivial_assign", RID_HAS_TRIVIAL_ASSIGN, D_CXX },
+  { "__has_trivial_constructor", RID_HAS_TRIVIAL_CONSTRUCTOR, D_CXX },
+  { "__has_trivial_copy", RID_HAS_TRIVIAL_COPY, D_CXX },
+  { "__has_trivial_destructor", RID_HAS_TRIVIAL_DESTRUCTOR, D_CXX },
+  { "__has_virtual_destructor", RID_HAS_VIRTUAL_DESTRUCTOR, D_CXX },
+  { "__imag",		RID_IMAGPART,	0 },
+  { "__imag__",		RID_IMAGPART,	0 },
+  { "__inline",		RID_INLINE,	0 },
+  { "__inline__",	RID_INLINE,	0 },
+  { "__is_abstract",	RID_IS_ABSTRACT, D_CXX },
+  { "__is_base_of",	RID_IS_BASE_OF, D_CXX },
+  { "__is_class",	RID_IS_CLASS,	D_CXX },
+  { "__is_convertible_to", RID_IS_CONVERTIBLE_TO, D_CXX },
+  { "__is_empty",	RID_IS_EMPTY,	D_CXX },
+  { "__is_enum",	RID_IS_ENUM,	D_CXX },
+  { "__is_pod",		RID_IS_POD,	D_CXX },
+  { "__is_polymorphic",	RID_IS_POLYMORPHIC, D_CXX },
+  { "__is_union",	RID_IS_UNION,	D_CXX },
+  { "__label__",	RID_LABEL,	0 },
+  { "__null",		RID_NULL,	0 },
+  { "__real",		RID_REALPART,	0 },
+  { "__real__",		RID_REALPART,	0 },
+  { "__restrict",	RID_RESTRICT,	0 },
+  { "__restrict__",	RID_RESTRICT,	0 },
+  { "__signed",		RID_SIGNED,	0 },
+  { "__signed__",	RID_SIGNED,	0 },
+  { "__thread",		RID_THREAD,	0 },
+  { "__typeof",		RID_TYPEOF,	0 },
+  { "__typeof__",	RID_TYPEOF,	0 },
+  { "__volatile",	RID_VOLATILE,	0 },
+  { "__volatile__",	RID_VOLATILE,	0 },
+  { "asm",		RID_ASM,	D_ASM },
+  { "auto",		RID_AUTO,	0 },
+  { "bool",		RID_BOOL,	D_CXX },
+  { "break",		RID_BREAK,	0 },
+  { "case",		RID_CASE,	0 },
+  { "catch",		RID_CATCH,	D_OBJC | D_CXX },
+  { "char",		RID_CHAR,	0 },
+  { "char16_t",		RID_CHAR16,	D_CXX0X },
+  { "char32_t",		RID_CHAR32,	D_CXX0X },
+  { "class",		RID_CLASS,	D_OBJC | D_CXX },
+  { "const",		RID_CONST,	0 },
+  { "const_cast",	RID_CONSTCAST,	D_CXX },
+  { "continue",		RID_CONTINUE,	0 },
+  { "decltype",         RID_DECLTYPE,   D_CXX0X },
+  { "default",		RID_DEFAULT,	0 },
+  { "delete",		RID_DELETE,	D_CXX },
+  { "do",		RID_DO,		0 },
+  { "double",		RID_DOUBLE,	0 },
+  { "dynamic_cast",	RID_DYNCAST,	D_CXX },
+  { "else",		RID_ELSE,	0 },
+  { "enum",		RID_ENUM,	0 },
+  { "explicit",		RID_EXPLICIT,	D_CXX },
+  { "export",		RID_EXPORT,	D_CXX },
+  { "extern",		RID_EXTERN,	0 },
+  { "false",		RID_FALSE,	D_CXX },
+  { "float",		RID_FLOAT,	0 },
+  { "for",		RID_FOR,	0 },
+  { "friend",		RID_FRIEND,	D_CXX },
+  { "goto",		RID_GOTO,	0 },
+  { "if",		RID_IF,		0 },
+  { "inline",		RID_INLINE,	D_EXT89 },
+  { "int",		RID_INT,	0 },
+  { "long",		RID_LONG,	0 },
+  { "mutable",		RID_MUTABLE,	D_CXX },
+  { "namespace",	RID_NAMESPACE,	D_CXX },
+  { "new",		RID_NEW,	D_CXX },
+  { "operator",		RID_OPERATOR,	D_CXX },
+  { "private",		RID_PRIVATE,	D_OBJC | D_CXX },
+  { "protected",	RID_PROTECTED,	D_OBJC | D_CXX },
+  { "public",		RID_PUBLIC,	D_OBJC | D_CXX },
+  { "register",		RID_REGISTER,	0 },
+  { "reinterpret_cast",	RID_REINTCAST,	D_CXX },
+  { "restrict",		RID_RESTRICT,	D_C89 },
+  { "return",		RID_RETURN,	0 },
+  { "short",		RID_SHORT,	0 },
+  { "signed",		RID_SIGNED,	0 },
+  { "sizeof",		RID_SIZEOF,	0 },
+  { "static",		RID_STATIC,	0 },
+  { "static_assert",    RID_STATIC_ASSERT, D_CXX0X },
+  { "static_cast",	RID_STATCAST,	D_CXX },
+  { "struct",		RID_STRUCT,	0 },
+  { "switch",		RID_SWITCH,	0 },
+  { "template",		RID_TEMPLATE,	D_CXX },
+  { "this",		RID_THIS,	D_CXX },
+  { "throw",		RID_THROW,	D_OBJC | D_CXX },
+  { "true",		RID_TRUE,	D_CXX },
+  { "try",		RID_TRY,	D_OBJC | D_CXX },
+  { "typedef",		RID_TYPEDEF,	0 },
+  { "typeid",		RID_TYPEID,	D_CXX },
+  { "typename",		RID_TYPENAME,	D_CXX },
+  { "typeof",		RID_TYPEOF,	D_ASM|D_EXT },
+  { "union",		RID_UNION,	0 },
+  { "unsigned",		RID_UNSIGNED,	0 },
+  { "using",		RID_USING,	D_CXX },
+  { "virtual",		RID_VIRTUAL,	D_CXX },
+  { "void",		RID_VOID,	0 },
+  { "volatile",		RID_VOLATILE,	0 },
+  { "wchar_t",		RID_WCHAR,	D_CXX },
+  { "while",		RID_WHILE,	0 },
+
+  /* The remaining keywords are specific to Objective-C++.  NB:
+     All of them will remain _disabled_, since they are context-
+     sensitive.  */
+
+  /* These ObjC keywords are recognized only immediately after
+     an '@'.  NB: The following C++ keywords double as
+     ObjC keywords in this context: RID_CLASS, RID_PRIVATE,
+     RID_PROTECTED, RID_PUBLIC, RID_THROW, RID_TRY and RID_CATCH.  */
+  { "class",		RID_AT_CLASS,		D_OBJC },
+  { "compatibility_alias", RID_AT_ALIAS,	D_OBJC },
+  { "defs",		RID_AT_DEFS,		D_OBJC },
+  { "encode",		RID_AT_ENCODE,		D_OBJC },
+  { "end",		RID_AT_END,		D_OBJC },
+  { "implementation",	RID_AT_IMPLEMENTATION,	D_OBJC },
+  { "interface",	RID_AT_INTERFACE,	D_OBJC },
+  { "protocol",		RID_AT_PROTOCOL,	D_OBJC },
+  { "selector",		RID_AT_SELECTOR,	D_OBJC },
+  { "finally",		RID_AT_FINALLY,		D_OBJC },
+  { "synchronized",	RID_AT_SYNCHRONIZED,	D_OBJC },
+  /* These are recognized only in protocol-qualifier context
+     (see above) */
+  { "bycopy",		RID_BYCOPY,		D_OBJC },
+  { "byref",		RID_BYREF,		D_OBJC },
+  { "in",		RID_IN,			D_OBJC },
+  { "inout",		RID_INOUT,		D_OBJC },
+  { "oneway",		RID_ONEWAY,		D_OBJC },
+  { "out",		RID_OUT,		D_OBJC },
+};
+
+const unsigned int num_c_common_reswords = (sizeof c_common_reswords
+					    / sizeof (struct c_common_resword));
+
+\f
 /* Switches common to the C front ends.  */
 
 /* Nonzero if preprocessing only.  */
Index: gcc/c-common.h
===================================================================
--- gcc/c-common.h	(revision 137041)
+++ gcc/c-common.h	(working copy)
@@ -1,6 +1,6 @@
 /* Definitions for c-common.c.
    Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -71,8 +71,8 @@
   RID_ASM,       RID_TYPEOF,   RID_ALIGNOF,  RID_ATTRIBUTE,  RID_VA_ARG,
   RID_EXTENSION, RID_IMAGPART, RID_REALPART, RID_LABEL,      RID_CHOOSE_EXPR,
   RID_TYPES_COMPATIBLE_P,
-  RID_DFLOAT32, RID_DFLOAT64, RID_DFLOAT128,
-  RID_FRACT, RID_ACCUM,
+  RID_DFLOAT32,  RID_DFLOAT64, RID_DFLOAT128,
+  RID_FRACT,     RID_ACCUM,    RID_OFFSETOF,
 
   /* Too many ways of getting the name of a function as a string */
   RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME,
@@ -82,7 +82,7 @@
   RID_PUBLIC,   RID_PRIVATE,  RID_PROTECTED,
   RID_TEMPLATE, RID_NULL,     RID_CATCH,
   RID_DELETE,   RID_FALSE,    RID_NAMESPACE,
-  RID_NEW,      RID_OFFSETOF, RID_OPERATOR,
+  RID_NEW,      RID_OPERATOR,
   RID_THIS,     RID_THROW,    RID_TRUE,
   RID_TRY,      RID_TYPENAME, RID_TYPEID,
   RID_USING,    RID_CHAR16,   RID_CHAR32,
@@ -135,6 +135,12 @@
   ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PQ && \
    (unsigned int) (rid) <= (unsigned int) RID_LAST_PQ)
 
+#define C_COMMON_IS_CXX_KEYWORD(rid)				\
+  (((unsigned int) (rid) >= (unsigned int) RID_FRIEND		\
+    && (unsigned int) (rid) <= (unsigned int) RID_MUTABLE)	\
+  || ((unsigned int) (rid) >= (unsigned int) RID_BOOL		\
+      && (unsigned int) (rid) <= (unsigned int) RID_USING))
+
 /* The elements of `ridpointers' are identifier nodes for the reserved
    type names and storage classes.  It is indexed by a RID_... value.  */
 extern GTY ((length ("(int) RID_MAX"))) tree *ridpointers;
@@ -197,6 +203,31 @@
   struct cpp_hashnode node;
 };
 
+/* Disable mask for keyword table.  Keywords are disabled if
+   (c_common_reswords[i].disable & mask) is _true_.  */
+#define D_EXT		0x01	/* GCC extension */
+#define D_ASM		0x02	/* in C99, but has a switch to turn it off */
+#define D_OBJC		0x04	/* Objective C++ only */
+#define D_CXX0X         0x08    /* C++0x only */
+#define D_C89		0x10	/* not in C89 */
+#define D_EXT89		0x20	/* GCC extension incorporated in C99 */
+#define D_CXX		0x40	/* C++ */
+#define D_CONLY		0x80	/* C only */
+
+/* An element of the reserved keyword table has this type.  */
+struct c_common_resword
+{
+  const char *word;
+  ENUM_BITFIELD(rid) rid : 16;
+  unsigned int disable   : 16;
+};
+
+/* The reserved keyword table.  */
+extern const struct c_common_resword c_common_reswords[];
+
+/* The number of items in the reserved keyword table.  */
+extern const unsigned int num_c_common_reswords;
+
 #define char16_type_node		c_global_trees[CTI_CHAR16_TYPE]
 #define char32_type_node		c_global_trees[CTI_CHAR32_TYPE]
 #define wchar_type_node			c_global_trees[CTI_WCHAR_TYPE]
Index: gcc/c-parser.c
===================================================================
--- gcc/c-parser.c	(revision 137041)
+++ gcc/c-parser.c	(working copy)
@@ -59,131 +59,6 @@
 #include "cgraph.h"
 
 \f
-/* The reserved keyword table.  */
-struct resword
-{
-  const char *word;
-  ENUM_BITFIELD(rid) rid : 16;
-  unsigned int disable   : 16;
-};
-
-/* Disable mask.  Keywords are disabled if (reswords[i].disable &
-   mask) is _true_.  */
-#define D_C89	0x01	/* not in C89 */
-#define D_EXT	0x02	/* GCC extension */
-#define D_EXT89	0x04	/* GCC extension incorporated in C99 */
-#define D_OBJC	0x08	/* Objective C only */
-
-static const struct resword reswords[] =
-{
-  { "_Bool",		RID_BOOL,	0 },
-  { "_Complex",		RID_COMPLEX,	0 },
-  { "_Decimal32",       RID_DFLOAT32,  D_EXT },
-  { "_Decimal64",       RID_DFLOAT64,  D_EXT },
-  { "_Decimal128",      RID_DFLOAT128, D_EXT },
-  { "_Fract",           RID_FRACT,     D_EXT },
-  { "_Accum",           RID_ACCUM,     D_EXT },
-  { "_Sat",             RID_SAT,       D_EXT },
-  { "__FUNCTION__",	RID_FUNCTION_NAME, 0 },
-  { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
-  { "__alignof",	RID_ALIGNOF,	0 },
-  { "__alignof__",	RID_ALIGNOF,	0 },
-  { "__asm",		RID_ASM,	0 },
-  { "__asm__",		RID_ASM,	0 },
-  { "__attribute",	RID_ATTRIBUTE,	0 },
-  { "__attribute__",	RID_ATTRIBUTE,	0 },
-  { "__builtin_choose_expr", RID_CHOOSE_EXPR, 0 },
-  { "__builtin_offsetof", RID_OFFSETOF, 0 },
-  { "__builtin_types_compatible_p", RID_TYPES_COMPATIBLE_P, 0 },
-  { "__builtin_va_arg",	RID_VA_ARG,	0 },
-  { "__complex",	RID_COMPLEX,	0 },
-  { "__complex__",	RID_COMPLEX,	0 },
-  { "__const",		RID_CONST,	0 },
-  { "__const__",	RID_CONST,	0 },
-  { "__extension__",	RID_EXTENSION,	0 },
-  { "__func__",		RID_C99_FUNCTION_NAME, 0 },
-  { "__imag",		RID_IMAGPART,	0 },
-  { "__imag__",		RID_IMAGPART,	0 },
-  { "__inline",		RID_INLINE,	0 },
-  { "__inline__",	RID_INLINE,	0 },
-  { "__label__",	RID_LABEL,	0 },
-  { "__real",		RID_REALPART,	0 },
-  { "__real__",		RID_REALPART,	0 },
-  { "__restrict",	RID_RESTRICT,	0 },
-  { "__restrict__",	RID_RESTRICT,	0 },
-  { "__signed",		RID_SIGNED,	0 },
-  { "__signed__",	RID_SIGNED,	0 },
-  { "__thread",		RID_THREAD,	0 },
-  { "__typeof",		RID_TYPEOF,	0 },
-  { "__typeof__",	RID_TYPEOF,	0 },
-  { "__volatile",	RID_VOLATILE,	0 },
-  { "__volatile__",	RID_VOLATILE,	0 },
-  { "asm",		RID_ASM,	D_EXT },
-  { "auto",		RID_AUTO,	0 },
-  { "break",		RID_BREAK,	0 },
-  { "case",		RID_CASE,	0 },
-  { "char",		RID_CHAR,	0 },
-  { "const",		RID_CONST,	0 },
-  { "continue",		RID_CONTINUE,	0 },
-  { "default",		RID_DEFAULT,	0 },
-  { "do",		RID_DO,		0 },
-  { "double",		RID_DOUBLE,	0 },
-  { "else",		RID_ELSE,	0 },
-  { "enum",		RID_ENUM,	0 },
-  { "extern",		RID_EXTERN,	0 },
-  { "float",		RID_FLOAT,	0 },
-  { "for",		RID_FOR,	0 },
-  { "goto",		RID_GOTO,	0 },
-  { "if",		RID_IF,		0 },
-  { "inline",		RID_INLINE,	D_EXT89 },
-  { "int",		RID_INT,	0 },
-  { "long",		RID_LONG,	0 },
-  { "register",		RID_REGISTER,	0 },
-  { "restrict",		RID_RESTRICT,	D_C89 },
-  { "return",		RID_RETURN,	0 },
-  { "short",		RID_SHORT,	0 },
-  { "signed",		RID_SIGNED,	0 },
-  { "sizeof",		RID_SIZEOF,	0 },
-  { "static",		RID_STATIC,	0 },
-  { "struct",		RID_STRUCT,	0 },
-  { "switch",		RID_SWITCH,	0 },
-  { "typedef",		RID_TYPEDEF,	0 },
-  { "typeof",		RID_TYPEOF,	D_EXT },
-  { "union",		RID_UNION,	0 },
-  { "unsigned",		RID_UNSIGNED,	0 },
-  { "void",		RID_VOID,	0 },
-  { "volatile",		RID_VOLATILE,	0 },
-  { "while",		RID_WHILE,	0 },
-  /* These Objective-C keywords are recognized only immediately after
-     an '@'.  */
-  { "class",		RID_AT_CLASS,		D_OBJC },
-  { "compatibility_alias", RID_AT_ALIAS,	D_OBJC },
-  { "defs",		RID_AT_DEFS,		D_OBJC },
-  { "encode",		RID_AT_ENCODE,		D_OBJC },
-  { "end",		RID_AT_END,		D_OBJC },
-  { "implementation",	RID_AT_IMPLEMENTATION,	D_OBJC },
-  { "interface",	RID_AT_INTERFACE,	D_OBJC },
-  { "private",		RID_AT_PRIVATE,		D_OBJC },
-  { "protected",	RID_AT_PROTECTED,	D_OBJC },
-  { "protocol",		RID_AT_PROTOCOL,	D_OBJC },
-  { "public",		RID_AT_PUBLIC,		D_OBJC },
-  { "selector",		RID_AT_SELECTOR,	D_OBJC },
-  { "throw",		RID_AT_THROW,		D_OBJC },
-  { "try",		RID_AT_TRY,		D_OBJC },
-  { "catch",		RID_AT_CATCH,		D_OBJC },
-  { "finally",		RID_AT_FINALLY,		D_OBJC },
-  { "synchronized",	RID_AT_SYNCHRONIZED,	D_OBJC },
-  /* These are recognized only in protocol-qualifier context
-     (see above) */
-  { "bycopy",		RID_BYCOPY,		D_OBJC },
-  { "byref",		RID_BYREF,		D_OBJC },
-  { "in",		RID_IN,			D_OBJC },
-  { "inout",		RID_INOUT,		D_OBJC },
-  { "oneway",		RID_ONEWAY,		D_OBJC },
-  { "out",		RID_OUT,		D_OBJC },
-};
-#define N_reswords (sizeof reswords / sizeof (struct resword))
-
 /* Initialization routine for this file.  */
 
 void
@@ -193,24 +68,26 @@
      identifiers.  */
   unsigned int i;
   tree id;
-  int mask = (flag_isoc99 ? 0 : D_C89)
-	      | (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0);
+  int mask = ((flag_isoc99 ? 0 : D_C89)
+	      | (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0)
+	      | (warn_cxx_compat ? 0 : D_CXX)
+	      | (warn_cxx0x_compat ? 0 : D_CXX0X));
 
   if (!c_dialect_objc ())
      mask |= D_OBJC;
 
   ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX);
-  for (i = 0; i < N_reswords; i++)
+  for (i = 0; i < num_c_common_reswords; i++)
     {
       /* If a keyword is disabled, do not enter it into the table
 	 and so create a canonical spelling that isn't a keyword.  */
-      if (reswords[i].disable & mask)
+      if (c_common_reswords[i].disable & mask)
 	continue;
 
-      id = get_identifier (reswords[i].word);
-      C_SET_RID_CODE (id, reswords[i].rid);
+      id = get_identifier (c_common_reswords[i].word);
+      C_SET_RID_CODE (id, c_common_reswords[i].rid);
       C_IS_RESERVED_WORD (id) = 1;
-      ridpointers [(int) reswords[i].rid] = id;
+      ridpointers [(int) c_common_reswords[i].rid] = id;
     }
 }
 \f
@@ -343,6 +220,13 @@
 		    break;
 		  }
 	      }
+	    else if (C_COMMON_IS_CXX_KEYWORD (rid_code))
+	      {
+		warning (0,
+			 "%Hidentifier named %qs conflicts with C++ keyword",
+			 &token->location,
+			 IDENTIFIER_POINTER (token->value));
+	      }
 	    else
 	      {
 		/* Return the canonical spelling for this keyword.  */

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-06-26 21:13       ` Tom Tromey
@ 2008-07-01 18:00         ` Kaveh R. GHAZI
  2008-07-01 18:19           ` Tom Tromey
  0 siblings, 1 reply; 19+ messages in thread
From: Kaveh R. GHAZI @ 2008-07-01 18:00 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Ben Elliston, gcc-patches, gdr

On Thu, 26 Jun 2008, Tom Tromey wrote:

> >>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:
>
> >> As for folks fixing it... eventually I hope we can do the poison
> >> thing, and then anyone changing it will get an error.
>
> Kaveh> I think Gaby is going to extend -Wc++-compat to warn about these so we
> Kaveh> won't have to poison them long-term (PR21759).
>
> Today I wrote an experimental patch to do this.  I've appended it, in
> all its ChangeLog-less glory.  This patch is kind of bogus, but it
> works well enough to prevent bootstrapping :).  I get a lot of errors
> (due to -Werror) from the C++ FE about uses of 'template' and
> 'namespace' as identifiers.
> Tom

What would it take to get this patch into shape?  ChangeLog, docs,
testcases, put it under the control of -Wc++-compat?  Anything else?

http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01698.html

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-01 18:00         ` Kaveh R. GHAZI
@ 2008-07-01 18:19           ` Tom Tromey
  2008-07-01 19:56             ` Kaveh R. GHAZI
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2008-07-01 18:19 UTC (permalink / raw)
  To: Kaveh R. GHAZI; +Cc: Ben Elliston, gcc-patches, gdr

>>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:

Kaveh> What would it take to get this patch into shape?  ChangeLog, docs,
Kaveh> testcases, put it under the control of -Wc++-compat?  Anything else?
Kaveh> http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01698.html

It already is under the control of -Wc++-compat.

It needs some testing under various conditions.  I am not sure that
the "inverted" keyword logic makes sense in this situation; I think we
might get false warnings in some cases.  Though, I am not sure.

In addition to a ChangeLog entry, I think it would also need fixes to
make gcc continue to bootstrap.  This patch, as-is, causes compile
failures due to the use of -Werror.

Finally, since it doesn't bootstrap, I didn't run the test suite with
this patch.  I don't anticipate problems there... but perhaps some new
tests are needed.

Tom

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-01 18:19           ` Tom Tromey
@ 2008-07-01 19:56             ` Kaveh R. GHAZI
  2008-07-01 20:05               ` Tom Tromey
  2008-07-02  1:28               ` Tom Tromey
  0 siblings, 2 replies; 19+ messages in thread
From: Kaveh R. GHAZI @ 2008-07-01 19:56 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Ben Elliston, gcc-patches, gdr

On Tue, 1 Jul 2008, Tom Tromey wrote:

> >>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:
>
> Kaveh> What would it take to get this patch into shape?  ChangeLog, docs,
> Kaveh> testcases, put it under the control of -Wc++-compat?  Anything else?
> Kaveh> http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01698.html
>
> It already is under the control of -Wc++-compat.

Shouldn't you have "OPT_Wc___compat" in the warning() call?


> In addition to a ChangeLog entry, I think it would also need fixes to
> make gcc continue to bootstrap.  This patch, as-is, causes compile
> failures due to the use of -Werror.

You can get past the -Werror failures temporarily by using
--disable-werror to get to the testsuite.  That will at least tell you if
any testcases fail.  The warnings can be fixed in the meantime (I'll help
if you like.)

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-01 19:56             ` Kaveh R. GHAZI
@ 2008-07-01 20:05               ` Tom Tromey
  2008-07-01 20:30                 ` Kaveh R. Ghazi
  2008-07-02  1:28               ` Tom Tromey
  1 sibling, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2008-07-01 20:05 UTC (permalink / raw)
  To: Kaveh R. GHAZI; +Cc: Ben Elliston, gcc-patches, gdr

>>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:

>> It already is under the control of -Wc++-compat.

Kaveh> Shouldn't you have "OPT_Wc___compat" in the warning() call?

The check is done earlier, when deciding what keywords exist.  But
yeah, I guess so ... I just copied the other -Wc++-compat warning,
which does not use this flag.

Kaveh> You can get past the -Werror failures temporarily by using
Kaveh> --disable-werror to get to the testsuite.  That will at least tell you if
Kaveh> any testcases fail.

I'll do that.

Kaveh> The warnings can be fixed in the meantime (I'll help if you
Kaveh> like.)

Sure :)

Tom

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-01 20:05               ` Tom Tromey
@ 2008-07-01 20:30                 ` Kaveh R. Ghazi
  2008-07-01 20:37                   ` Tom Tromey
  0 siblings, 1 reply; 19+ messages in thread
From: Kaveh R. Ghazi @ 2008-07-01 20:30 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Ben Elliston, gcc-patches, gdr

From: "Tom Tromey" <tromey@redhat.com>

> Kaveh> The warnings can be fixed in the meantime (I'll help if you
> Kaveh> like.)
>
> Sure :)
> Tom

:-)

Does the patch apply cleanly against mainline?  I just gave it a try and got 
rejects.

--Kaveh

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-01 20:30                 ` Kaveh R. Ghazi
@ 2008-07-01 20:37                   ` Tom Tromey
  2008-07-02  3:15                     ` Kaveh R. GHAZI
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2008-07-01 20:37 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: Ben Elliston, gcc-patches, gdr

Kaveh> Does the patch apply cleanly against mainline?  I just gave it
Kaveh> a try and got rejects.

I updated to 137323 and made the appended.

Tom

Index: gcc/cp/lex.c
===================================================================
--- gcc/cp/lex.c	(revision 137323)
+++ gcc/cp/lex.c	(working copy)
@@ -163,190 +163,26 @@
     = "(round %=)";
 }
 
-/* The reserved keyword table.  */
-struct resword
-{
-  const char *const word;
-  ENUM_BITFIELD(rid) const rid : 16;
-  const unsigned int disable   : 16;
-};
-
-/* Disable mask.  Keywords are disabled if (reswords[i].disable & mask) is
-   _true_.  */
-#define D_EXT		0x01	/* GCC extension */
-#define D_ASM		0x02	/* in C99, but has a switch to turn it off */
-#define D_OBJC		0x04	/* Objective C++ only */
-#define D_CXX0X         0x08    /* C++0x only */
-
 CONSTRAINT(ridbits_fit, RID_LAST_MODIFIER < sizeof(unsigned long) * CHAR_BIT);
 
-static const struct resword reswords[] =
-{
-  { "_Complex",		RID_COMPLEX,	0 },
-  { "__FUNCTION__",	RID_FUNCTION_NAME, 0 },
-  { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
-  { "__alignof",	RID_ALIGNOF,	0 },
-  { "__alignof__",	RID_ALIGNOF,	0 },
-  { "__asm",		RID_ASM,	0 },
-  { "__asm__",		RID_ASM,	0 },
-  { "__attribute",	RID_ATTRIBUTE,	0 },
-  { "__attribute__",	RID_ATTRIBUTE,	0 },
-  { "__builtin_offsetof", RID_OFFSETOF, 0 },
-  { "__builtin_va_arg",	RID_VA_ARG,	0 },
-  { "__complex",	RID_COMPLEX,	0 },
-  { "__complex__",	RID_COMPLEX,	0 },
-  { "__const",		RID_CONST,	0 },
-  { "__const__",	RID_CONST,	0 },
-  { "__decltype",       RID_DECLTYPE,   0 },
-  { "__extension__",	RID_EXTENSION,	0 },
-  { "__func__",		RID_C99_FUNCTION_NAME,	0 },
-  { "__has_nothrow_assign", RID_HAS_NOTHROW_ASSIGN, 0 },
-  { "__has_nothrow_constructor", RID_HAS_NOTHROW_CONSTRUCTOR, 0 },
-  { "__has_nothrow_copy", RID_HAS_NOTHROW_COPY, 0 },
-  { "__has_trivial_assign", RID_HAS_TRIVIAL_ASSIGN, 0 },
-  { "__has_trivial_constructor", RID_HAS_TRIVIAL_CONSTRUCTOR, 0 },
-  { "__has_trivial_copy", RID_HAS_TRIVIAL_COPY, 0 },
-  { "__has_trivial_destructor", RID_HAS_TRIVIAL_DESTRUCTOR, 0 },
-  { "__has_virtual_destructor", RID_HAS_VIRTUAL_DESTRUCTOR, 0 },
-  { "__is_abstract",	RID_IS_ABSTRACT, 0 },
-  { "__is_base_of",	RID_IS_BASE_OF, 0 },
-  { "__is_class",	RID_IS_CLASS,	0 },
-  { "__is_convertible_to", RID_IS_CONVERTIBLE_TO, 0 },
-  { "__is_empty",	RID_IS_EMPTY,	0 },
-  { "__is_enum",	RID_IS_ENUM,	0 },
-  { "__is_pod",		RID_IS_POD,	0 },
-  { "__is_polymorphic",	RID_IS_POLYMORPHIC, 0 },
-  { "__is_union",	RID_IS_UNION,	0 },
-  { "__imag",		RID_IMAGPART,	0 },
-  { "__imag__",		RID_IMAGPART,	0 },
-  { "__inline",		RID_INLINE,	0 },
-  { "__inline__",	RID_INLINE,	0 },
-  { "__label__",	RID_LABEL,	0 },
-  { "__null",		RID_NULL,	0 },
-  { "__real",		RID_REALPART,	0 },
-  { "__real__",		RID_REALPART,	0 },
-  { "__restrict",	RID_RESTRICT,	0 },
-  { "__restrict__",	RID_RESTRICT,	0 },
-  { "__signed",		RID_SIGNED,	0 },
-  { "__signed__",	RID_SIGNED,	0 },
-  { "__thread",		RID_THREAD,	0 },
-  { "__typeof",		RID_TYPEOF,	0 },
-  { "__typeof__",	RID_TYPEOF,	0 },
-  { "__volatile",	RID_VOLATILE,	0 },
-  { "__volatile__",	RID_VOLATILE,	0 },
-  { "asm",		RID_ASM,	D_ASM },
-  { "auto",		RID_AUTO,	0 },
-  { "bool",		RID_BOOL,	0 },
-  { "break",		RID_BREAK,	0 },
-  { "case",		RID_CASE,	0 },
-  { "catch",		RID_CATCH,	0 },
-  { "char",		RID_CHAR,	0 },
-  { "char16_t",		RID_CHAR16,	D_CXX0X },
-  { "char32_t",		RID_CHAR32,	D_CXX0X },
-  { "class",		RID_CLASS,	0 },
-  { "const",		RID_CONST,	0 },
-  { "const_cast",	RID_CONSTCAST,	0 },
-  { "continue",		RID_CONTINUE,	0 },
-  { "decltype",         RID_DECLTYPE,   D_CXX0X },
-  { "default",		RID_DEFAULT,	0 },
-  { "delete",		RID_DELETE,	0 },
-  { "do",		RID_DO,		0 },
-  { "double",		RID_DOUBLE,	0 },
-  { "dynamic_cast",	RID_DYNCAST,	0 },
-  { "else",		RID_ELSE,	0 },
-  { "enum",		RID_ENUM,	0 },
-  { "explicit",		RID_EXPLICIT,	0 },
-  { "export",		RID_EXPORT,	0 },
-  { "extern",		RID_EXTERN,	0 },
-  { "false",		RID_FALSE,	0 },
-  { "float",		RID_FLOAT,	0 },
-  { "for",		RID_FOR,	0 },
-  { "friend",		RID_FRIEND,	0 },
-  { "goto",		RID_GOTO,	0 },
-  { "if",		RID_IF,		0 },
-  { "inline",		RID_INLINE,	0 },
-  { "int",		RID_INT,	0 },
-  { "long",		RID_LONG,	0 },
-  { "mutable",		RID_MUTABLE,	0 },
-  { "namespace",	RID_NAMESPACE,	0 },
-  { "new",		RID_NEW,	0 },
-  { "operator",		RID_OPERATOR,	0 },
-  { "private",		RID_PRIVATE,	0 },
-  { "protected",	RID_PROTECTED,	0 },
-  { "public",		RID_PUBLIC,	0 },
-  { "register",		RID_REGISTER,	0 },
-  { "reinterpret_cast",	RID_REINTCAST,	0 },
-  { "return",		RID_RETURN,	0 },
-  { "short",		RID_SHORT,	0 },
-  { "signed",		RID_SIGNED,	0 },
-  { "sizeof",		RID_SIZEOF,	0 },
-  { "static",		RID_STATIC,	0 },
-  { "static_assert",    RID_STATIC_ASSERT, D_CXX0X },
-  { "static_cast",	RID_STATCAST,	0 },
-  { "struct",		RID_STRUCT,	0 },
-  { "switch",		RID_SWITCH,	0 },
-  { "template",		RID_TEMPLATE,	0 },
-  { "this",		RID_THIS,	0 },
-  { "throw",		RID_THROW,	0 },
-  { "true",		RID_TRUE,	0 },
-  { "try",		RID_TRY,	0 },
-  { "typedef",		RID_TYPEDEF,	0 },
-  { "typename",		RID_TYPENAME,	0 },
-  { "typeid",		RID_TYPEID,	0 },
-  { "typeof",		RID_TYPEOF,	D_ASM|D_EXT },
-  { "union",		RID_UNION,	0 },
-  { "unsigned",		RID_UNSIGNED,	0 },
-  { "using",		RID_USING,	0 },
-  { "virtual",		RID_VIRTUAL,	0 },
-  { "void",		RID_VOID,	0 },
-  { "volatile",		RID_VOLATILE,	0 },
-  { "wchar_t",		RID_WCHAR,	0 },
-  { "while",		RID_WHILE,	0 },
-
-  /* The remaining keywords are specific to Objective-C++.  NB:
-     All of them will remain _disabled_, since they are context-
-     sensitive.  */
-
-  /* These ObjC keywords are recognized only immediately after
-     an '@'.  NB: The following C++ keywords double as
-     ObjC keywords in this context: RID_CLASS, RID_PRIVATE,
-     RID_PROTECTED, RID_PUBLIC, RID_THROW, RID_TRY and RID_CATCH.  */
-  { "compatibility_alias", RID_AT_ALIAS,	D_OBJC },
-  { "defs",		RID_AT_DEFS,		D_OBJC },
-  { "encode",		RID_AT_ENCODE,		D_OBJC },
-  { "end",		RID_AT_END,		D_OBJC },
-  { "implementation",	RID_AT_IMPLEMENTATION,	D_OBJC },
-  { "interface",	RID_AT_INTERFACE,	D_OBJC },
-  { "protocol",		RID_AT_PROTOCOL,	D_OBJC },
-  { "selector",		RID_AT_SELECTOR,	D_OBJC },
-  { "finally",		RID_AT_FINALLY,		D_OBJC },
-  { "synchronized",	RID_AT_SYNCHRONIZED,	D_OBJC },
-  /* These are recognized only in protocol-qualifier context.  */
-  { "bycopy",		RID_BYCOPY,		D_OBJC },
-  { "byref",		RID_BYREF,		D_OBJC },
-  { "in",		RID_IN,			D_OBJC },
-  { "inout",		RID_INOUT,		D_OBJC },
-  { "oneway",		RID_ONEWAY,		D_OBJC },
-  { "out",		RID_OUT,		D_OBJC },
-};
-
 void
 init_reswords (void)
 {
   unsigned int i;
   tree id;
-  int mask = ((flag_no_asm ? D_ASM : 0)
+  int mask = (D_CONLY
+	      | (flag_no_asm ? D_ASM : 0)
 	      | D_OBJC
 	      | (flag_no_gnu_keywords ? D_EXT : 0)
               | ((cxx_dialect == cxx0x) ? 0 : D_CXX0X));
 
   ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX);
-  for (i = 0; i < ARRAY_SIZE (reswords); i++)
+  for (i = 0; i < num_c_common_reswords; i++)
     {
-      id = get_identifier (reswords[i].word);
-      C_SET_RID_CODE (id, reswords[i].rid);
-      ridpointers [(int) reswords[i].rid] = id;
-      if (! (reswords[i].disable & mask))
+      id = get_identifier (c_common_reswords[i].word);
+      C_SET_RID_CODE (id, c_common_reswords[i].rid);
+      ridpointers [(int) c_common_reswords[i].rid] = id;
+      if (! (c_common_reswords[i].disable & mask))
 	C_IS_RESERVED_WORD (id) = 1;
     }
 }
Index: gcc/c-common.c
===================================================================
--- gcc/c-common.c	(revision 137323)
+++ gcc/c-common.c	(working copy)
@@ -219,6 +219,173 @@
 
 tree c_global_trees[CTI_MAX];
 \f
+/* Reserved words.  */
+const struct c_common_resword c_common_reswords[] =
+{
+  { "_Accum",           RID_ACCUM,     D_EXT | D_CONLY },
+  { "_Bool",		RID_BOOL,	0 },
+  { "_Complex",		RID_COMPLEX,	0 },
+  { "_Decimal128",      RID_DFLOAT128, D_EXT | D_CONLY },
+  { "_Decimal32",       RID_DFLOAT32,  D_EXT | D_CONLY },
+  { "_Decimal64",       RID_DFLOAT64,  D_EXT | D_CONLY },
+  { "_Fract",           RID_FRACT,     D_EXT | D_CONLY },
+  { "_Sat",             RID_SAT,       D_EXT | D_CONLY },
+  { "__FUNCTION__",	RID_FUNCTION_NAME, 0 },
+  { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
+  { "__alignof",	RID_ALIGNOF,	0 },
+  { "__alignof__",	RID_ALIGNOF,	0 },
+  { "__asm",		RID_ASM,	0 },
+  { "__asm__",		RID_ASM,	0 },
+  { "__attribute",	RID_ATTRIBUTE,	0 },
+  { "__attribute__",	RID_ATTRIBUTE,	0 },
+  { "__builtin_choose_expr", RID_CHOOSE_EXPR, D_CONLY },
+  { "__builtin_offsetof", RID_OFFSETOF, 0 },
+  { "__builtin_types_compatible_p", RID_TYPES_COMPATIBLE_P, D_CONLY },
+  { "__builtin_va_arg",	RID_VA_ARG,	0 },
+  { "__complex",	RID_COMPLEX,	0 },
+  { "__complex__",	RID_COMPLEX,	0 },
+  { "__const",		RID_CONST,	0 },
+  { "__const__",	RID_CONST,	0 },
+  { "__decltype",       RID_DECLTYPE,   D_CXX },
+  { "__extension__",	RID_EXTENSION,	0 },
+  { "__func__",		RID_C99_FUNCTION_NAME, 0 },
+  { "__has_nothrow_assign", RID_HAS_NOTHROW_ASSIGN, D_CXX },
+  { "__has_nothrow_constructor", RID_HAS_NOTHROW_CONSTRUCTOR, D_CXX },
+  { "__has_nothrow_copy", RID_HAS_NOTHROW_COPY, D_CXX },
+  { "__has_trivial_assign", RID_HAS_TRIVIAL_ASSIGN, D_CXX },
+  { "__has_trivial_constructor", RID_HAS_TRIVIAL_CONSTRUCTOR, D_CXX },
+  { "__has_trivial_copy", RID_HAS_TRIVIAL_COPY, D_CXX },
+  { "__has_trivial_destructor", RID_HAS_TRIVIAL_DESTRUCTOR, D_CXX },
+  { "__has_virtual_destructor", RID_HAS_VIRTUAL_DESTRUCTOR, D_CXX },
+  { "__imag",		RID_IMAGPART,	0 },
+  { "__imag__",		RID_IMAGPART,	0 },
+  { "__inline",		RID_INLINE,	0 },
+  { "__inline__",	RID_INLINE,	0 },
+  { "__is_abstract",	RID_IS_ABSTRACT, D_CXX },
+  { "__is_base_of",	RID_IS_BASE_OF, D_CXX },
+  { "__is_class",	RID_IS_CLASS,	D_CXX },
+  { "__is_convertible_to", RID_IS_CONVERTIBLE_TO, D_CXX },
+  { "__is_empty",	RID_IS_EMPTY,	D_CXX },
+  { "__is_enum",	RID_IS_ENUM,	D_CXX },
+  { "__is_pod",		RID_IS_POD,	D_CXX },
+  { "__is_polymorphic",	RID_IS_POLYMORPHIC, D_CXX },
+  { "__is_union",	RID_IS_UNION,	D_CXX },
+  { "__label__",	RID_LABEL,	0 },
+  { "__null",		RID_NULL,	0 },
+  { "__real",		RID_REALPART,	0 },
+  { "__real__",		RID_REALPART,	0 },
+  { "__restrict",	RID_RESTRICT,	0 },
+  { "__restrict__",	RID_RESTRICT,	0 },
+  { "__signed",		RID_SIGNED,	0 },
+  { "__signed__",	RID_SIGNED,	0 },
+  { "__thread",		RID_THREAD,	0 },
+  { "__typeof",		RID_TYPEOF,	0 },
+  { "__typeof__",	RID_TYPEOF,	0 },
+  { "__volatile",	RID_VOLATILE,	0 },
+  { "__volatile__",	RID_VOLATILE,	0 },
+  { "asm",		RID_ASM,	D_ASM },
+  { "auto",		RID_AUTO,	0 },
+  { "bool",		RID_BOOL,	D_CXX },
+  { "break",		RID_BREAK,	0 },
+  { "case",		RID_CASE,	0 },
+  { "catch",		RID_CATCH,	D_OBJC | D_CXX },
+  { "char",		RID_CHAR,	0 },
+  { "char16_t",		RID_CHAR16,	D_CXX0X },
+  { "char32_t",		RID_CHAR32,	D_CXX0X },
+  { "class",		RID_CLASS,	D_OBJC | D_CXX },
+  { "const",		RID_CONST,	0 },
+  { "const_cast",	RID_CONSTCAST,	D_CXX },
+  { "continue",		RID_CONTINUE,	0 },
+  { "decltype",         RID_DECLTYPE,   D_CXX0X },
+  { "default",		RID_DEFAULT,	0 },
+  { "delete",		RID_DELETE,	D_CXX },
+  { "do",		RID_DO,		0 },
+  { "double",		RID_DOUBLE,	0 },
+  { "dynamic_cast",	RID_DYNCAST,	D_CXX },
+  { "else",		RID_ELSE,	0 },
+  { "enum",		RID_ENUM,	0 },
+  { "explicit",		RID_EXPLICIT,	D_CXX },
+  { "export",		RID_EXPORT,	D_CXX },
+  { "extern",		RID_EXTERN,	0 },
+  { "false",		RID_FALSE,	D_CXX },
+  { "float",		RID_FLOAT,	0 },
+  { "for",		RID_FOR,	0 },
+  { "friend",		RID_FRIEND,	D_CXX },
+  { "goto",		RID_GOTO,	0 },
+  { "if",		RID_IF,		0 },
+  { "inline",		RID_INLINE,	D_EXT89 },
+  { "int",		RID_INT,	0 },
+  { "long",		RID_LONG,	0 },
+  { "mutable",		RID_MUTABLE,	D_CXX },
+  { "namespace",	RID_NAMESPACE,	D_CXX },
+  { "new",		RID_NEW,	D_CXX },
+  { "operator",		RID_OPERATOR,	D_CXX },
+  { "private",		RID_PRIVATE,	D_OBJC | D_CXX },
+  { "protected",	RID_PROTECTED,	D_OBJC | D_CXX },
+  { "public",		RID_PUBLIC,	D_OBJC | D_CXX },
+  { "register",		RID_REGISTER,	0 },
+  { "reinterpret_cast",	RID_REINTCAST,	D_CXX },
+  { "restrict",		RID_RESTRICT,	D_C89 },
+  { "return",		RID_RETURN,	0 },
+  { "short",		RID_SHORT,	0 },
+  { "signed",		RID_SIGNED,	0 },
+  { "sizeof",		RID_SIZEOF,	0 },
+  { "static",		RID_STATIC,	0 },
+  { "static_assert",    RID_STATIC_ASSERT, D_CXX0X },
+  { "static_cast",	RID_STATCAST,	D_CXX },
+  { "struct",		RID_STRUCT,	0 },
+  { "switch",		RID_SWITCH,	0 },
+  { "template",		RID_TEMPLATE,	D_CXX },
+  { "this",		RID_THIS,	D_CXX },
+  { "throw",		RID_THROW,	D_OBJC | D_CXX },
+  { "true",		RID_TRUE,	D_CXX },
+  { "try",		RID_TRY,	D_OBJC | D_CXX },
+  { "typedef",		RID_TYPEDEF,	0 },
+  { "typeid",		RID_TYPEID,	D_CXX },
+  { "typename",		RID_TYPENAME,	D_CXX },
+  { "typeof",		RID_TYPEOF,	D_ASM|D_EXT },
+  { "union",		RID_UNION,	0 },
+  { "unsigned",		RID_UNSIGNED,	0 },
+  { "using",		RID_USING,	D_CXX },
+  { "virtual",		RID_VIRTUAL,	D_CXX },
+  { "void",		RID_VOID,	0 },
+  { "volatile",		RID_VOLATILE,	0 },
+  { "wchar_t",		RID_WCHAR,	D_CXX },
+  { "while",		RID_WHILE,	0 },
+
+  /* The remaining keywords are specific to Objective-C++.  NB:
+     All of them will remain _disabled_, since they are context-
+     sensitive.  */
+
+  /* These ObjC keywords are recognized only immediately after
+     an '@'.  NB: The following C++ keywords double as
+     ObjC keywords in this context: RID_CLASS, RID_PRIVATE,
+     RID_PROTECTED, RID_PUBLIC, RID_THROW, RID_TRY and RID_CATCH.  */
+  { "class",		RID_AT_CLASS,		D_OBJC },
+  { "compatibility_alias", RID_AT_ALIAS,	D_OBJC },
+  { "defs",		RID_AT_DEFS,		D_OBJC },
+  { "encode",		RID_AT_ENCODE,		D_OBJC },
+  { "end",		RID_AT_END,		D_OBJC },
+  { "implementation",	RID_AT_IMPLEMENTATION,	D_OBJC },
+  { "interface",	RID_AT_INTERFACE,	D_OBJC },
+  { "protocol",		RID_AT_PROTOCOL,	D_OBJC },
+  { "selector",		RID_AT_SELECTOR,	D_OBJC },
+  { "finally",		RID_AT_FINALLY,		D_OBJC },
+  { "synchronized",	RID_AT_SYNCHRONIZED,	D_OBJC },
+  /* These are recognized only in protocol-qualifier context
+     (see above) */
+  { "bycopy",		RID_BYCOPY,		D_OBJC },
+  { "byref",		RID_BYREF,		D_OBJC },
+  { "in",		RID_IN,			D_OBJC },
+  { "inout",		RID_INOUT,		D_OBJC },
+  { "oneway",		RID_ONEWAY,		D_OBJC },
+  { "out",		RID_OUT,		D_OBJC },
+};
+
+const unsigned int num_c_common_reswords = (sizeof c_common_reswords
+					    / sizeof (struct c_common_resword));
+
+\f
 /* Switches common to the C front ends.  */
 
 /* Nonzero if preprocessing only.  */
Index: gcc/c-common.h
===================================================================
--- gcc/c-common.h	(revision 137323)
+++ gcc/c-common.h	(working copy)
@@ -1,6 +1,6 @@
 /* Definitions for c-common.c.
    Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -71,8 +71,8 @@
   RID_ASM,       RID_TYPEOF,   RID_ALIGNOF,  RID_ATTRIBUTE,  RID_VA_ARG,
   RID_EXTENSION, RID_IMAGPART, RID_REALPART, RID_LABEL,      RID_CHOOSE_EXPR,
   RID_TYPES_COMPATIBLE_P,
-  RID_DFLOAT32, RID_DFLOAT64, RID_DFLOAT128,
-  RID_FRACT, RID_ACCUM,
+  RID_DFLOAT32,  RID_DFLOAT64, RID_DFLOAT128,
+  RID_FRACT,     RID_ACCUM,    RID_OFFSETOF,
 
   /* Too many ways of getting the name of a function as a string */
   RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME,
@@ -82,7 +82,7 @@
   RID_PUBLIC,   RID_PRIVATE,  RID_PROTECTED,
   RID_TEMPLATE, RID_NULL,     RID_CATCH,
   RID_DELETE,   RID_FALSE,    RID_NAMESPACE,
-  RID_NEW,      RID_OFFSETOF, RID_OPERATOR,
+  RID_NEW,      RID_OPERATOR,
   RID_THIS,     RID_THROW,    RID_TRUE,
   RID_TRY,      RID_TYPENAME, RID_TYPEID,
   RID_USING,    RID_CHAR16,   RID_CHAR32,
@@ -135,6 +135,12 @@
   ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PQ && \
    (unsigned int) (rid) <= (unsigned int) RID_LAST_PQ)
 
+#define C_COMMON_IS_CXX_KEYWORD(rid)				\
+  (((unsigned int) (rid) >= (unsigned int) RID_FRIEND		\
+    && (unsigned int) (rid) <= (unsigned int) RID_MUTABLE)	\
+  || ((unsigned int) (rid) >= (unsigned int) RID_BOOL		\
+      && (unsigned int) (rid) <= (unsigned int) RID_USING))
+
 /* The elements of `ridpointers' are identifier nodes for the reserved
    type names and storage classes.  It is indexed by a RID_... value.  */
 extern GTY ((length ("(int) RID_MAX"))) tree *ridpointers;
@@ -197,6 +203,31 @@
   struct cpp_hashnode node;
 };
 
+/* Disable mask for keyword table.  Keywords are disabled if
+   (c_common_reswords[i].disable & mask) is _true_.  */
+#define D_EXT		0x01	/* GCC extension */
+#define D_ASM		0x02	/* in C99, but has a switch to turn it off */
+#define D_OBJC		0x04	/* Objective C++ only */
+#define D_CXX0X         0x08    /* C++0x only */
+#define D_C89		0x10	/* not in C89 */
+#define D_EXT89		0x20	/* GCC extension incorporated in C99 */
+#define D_CXX		0x40	/* C++ */
+#define D_CONLY		0x80	/* C only */
+
+/* An element of the reserved keyword table has this type.  */
+struct c_common_resword
+{
+  const char *word;
+  ENUM_BITFIELD(rid) rid : 16;
+  unsigned int disable   : 16;
+};
+
+/* The reserved keyword table.  */
+extern const struct c_common_resword c_common_reswords[];
+
+/* The number of items in the reserved keyword table.  */
+extern const unsigned int num_c_common_reswords;
+
 #define char16_type_node		c_global_trees[CTI_CHAR16_TYPE]
 #define char32_type_node		c_global_trees[CTI_CHAR32_TYPE]
 #define wchar_type_node			c_global_trees[CTI_WCHAR_TYPE]
Index: gcc/c-parser.c
===================================================================
--- gcc/c-parser.c	(revision 137323)
+++ gcc/c-parser.c	(working copy)
@@ -58,132 +58,9 @@
 #include "target.h"
 #include "cgraph.h"
 
-\f
-/* The reserved keyword table.  */
-struct resword
-{
-  const char *word;
-  ENUM_BITFIELD(rid) rid : 16;
-  unsigned int disable   : 16;
-};
+static GTY(()) cpp_hashnode *zardoz;
 
-/* Disable mask.  Keywords are disabled if (reswords[i].disable &
-   mask) is _true_.  */
-#define D_C89	0x01	/* not in C89 */
-#define D_EXT	0x02	/* GCC extension */
-#define D_EXT89	0x04	/* GCC extension incorporated in C99 */
-#define D_OBJC	0x08	/* Objective C only */
-
-static const struct resword reswords[] =
-{
-  { "_Bool",		RID_BOOL,	0 },
-  { "_Complex",		RID_COMPLEX,	0 },
-  { "_Decimal32",       RID_DFLOAT32,  D_EXT },
-  { "_Decimal64",       RID_DFLOAT64,  D_EXT },
-  { "_Decimal128",      RID_DFLOAT128, D_EXT },
-  { "_Fract",           RID_FRACT,     D_EXT },
-  { "_Accum",           RID_ACCUM,     D_EXT },
-  { "_Sat",             RID_SAT,       D_EXT },
-  { "__FUNCTION__",	RID_FUNCTION_NAME, 0 },
-  { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
-  { "__alignof",	RID_ALIGNOF,	0 },
-  { "__alignof__",	RID_ALIGNOF,	0 },
-  { "__asm",		RID_ASM,	0 },
-  { "__asm__",		RID_ASM,	0 },
-  { "__attribute",	RID_ATTRIBUTE,	0 },
-  { "__attribute__",	RID_ATTRIBUTE,	0 },
-  { "__builtin_choose_expr", RID_CHOOSE_EXPR, 0 },
-  { "__builtin_offsetof", RID_OFFSETOF, 0 },
-  { "__builtin_types_compatible_p", RID_TYPES_COMPATIBLE_P, 0 },
-  { "__builtin_va_arg",	RID_VA_ARG,	0 },
-  { "__complex",	RID_COMPLEX,	0 },
-  { "__complex__",	RID_COMPLEX,	0 },
-  { "__const",		RID_CONST,	0 },
-  { "__const__",	RID_CONST,	0 },
-  { "__extension__",	RID_EXTENSION,	0 },
-  { "__func__",		RID_C99_FUNCTION_NAME, 0 },
-  { "__imag",		RID_IMAGPART,	0 },
-  { "__imag__",		RID_IMAGPART,	0 },
-  { "__inline",		RID_INLINE,	0 },
-  { "__inline__",	RID_INLINE,	0 },
-  { "__label__",	RID_LABEL,	0 },
-  { "__real",		RID_REALPART,	0 },
-  { "__real__",		RID_REALPART,	0 },
-  { "__restrict",	RID_RESTRICT,	0 },
-  { "__restrict__",	RID_RESTRICT,	0 },
-  { "__signed",		RID_SIGNED,	0 },
-  { "__signed__",	RID_SIGNED,	0 },
-  { "__thread",		RID_THREAD,	0 },
-  { "__typeof",		RID_TYPEOF,	0 },
-  { "__typeof__",	RID_TYPEOF,	0 },
-  { "__volatile",	RID_VOLATILE,	0 },
-  { "__volatile__",	RID_VOLATILE,	0 },
-  { "asm",		RID_ASM,	D_EXT },
-  { "auto",		RID_AUTO,	0 },
-  { "break",		RID_BREAK,	0 },
-  { "case",		RID_CASE,	0 },
-  { "char",		RID_CHAR,	0 },
-  { "const",		RID_CONST,	0 },
-  { "continue",		RID_CONTINUE,	0 },
-  { "default",		RID_DEFAULT,	0 },
-  { "do",		RID_DO,		0 },
-  { "double",		RID_DOUBLE,	0 },
-  { "else",		RID_ELSE,	0 },
-  { "enum",		RID_ENUM,	0 },
-  { "extern",		RID_EXTERN,	0 },
-  { "float",		RID_FLOAT,	0 },
-  { "for",		RID_FOR,	0 },
-  { "goto",		RID_GOTO,	0 },
-  { "if",		RID_IF,		0 },
-  { "inline",		RID_INLINE,	D_EXT89 },
-  { "int",		RID_INT,	0 },
-  { "long",		RID_LONG,	0 },
-  { "register",		RID_REGISTER,	0 },
-  { "restrict",		RID_RESTRICT,	D_C89 },
-  { "return",		RID_RETURN,	0 },
-  { "short",		RID_SHORT,	0 },
-  { "signed",		RID_SIGNED,	0 },
-  { "sizeof",		RID_SIZEOF,	0 },
-  { "static",		RID_STATIC,	0 },
-  { "struct",		RID_STRUCT,	0 },
-  { "switch",		RID_SWITCH,	0 },
-  { "typedef",		RID_TYPEDEF,	0 },
-  { "typeof",		RID_TYPEOF,	D_EXT },
-  { "union",		RID_UNION,	0 },
-  { "unsigned",		RID_UNSIGNED,	0 },
-  { "void",		RID_VOID,	0 },
-  { "volatile",		RID_VOLATILE,	0 },
-  { "while",		RID_WHILE,	0 },
-  /* These Objective-C keywords are recognized only immediately after
-     an '@'.  */
-  { "class",		RID_AT_CLASS,		D_OBJC },
-  { "compatibility_alias", RID_AT_ALIAS,	D_OBJC },
-  { "defs",		RID_AT_DEFS,		D_OBJC },
-  { "encode",		RID_AT_ENCODE,		D_OBJC },
-  { "end",		RID_AT_END,		D_OBJC },
-  { "implementation",	RID_AT_IMPLEMENTATION,	D_OBJC },
-  { "interface",	RID_AT_INTERFACE,	D_OBJC },
-  { "private",		RID_AT_PRIVATE,		D_OBJC },
-  { "protected",	RID_AT_PROTECTED,	D_OBJC },
-  { "protocol",		RID_AT_PROTOCOL,	D_OBJC },
-  { "public",		RID_AT_PUBLIC,		D_OBJC },
-  { "selector",		RID_AT_SELECTOR,	D_OBJC },
-  { "throw",		RID_AT_THROW,		D_OBJC },
-  { "try",		RID_AT_TRY,		D_OBJC },
-  { "catch",		RID_AT_CATCH,		D_OBJC },
-  { "finally",		RID_AT_FINALLY,		D_OBJC },
-  { "synchronized",	RID_AT_SYNCHRONIZED,	D_OBJC },
-  /* These are recognized only in protocol-qualifier context
-     (see above) */
-  { "bycopy",		RID_BYCOPY,		D_OBJC },
-  { "byref",		RID_BYREF,		D_OBJC },
-  { "in",		RID_IN,			D_OBJC },
-  { "inout",		RID_INOUT,		D_OBJC },
-  { "oneway",		RID_ONEWAY,		D_OBJC },
-  { "out",		RID_OUT,		D_OBJC },
-};
-#define N_reswords (sizeof reswords / sizeof (struct resword))
-
+\f
 /* Initialization routine for this file.  */
 
 void
@@ -193,24 +70,26 @@
      identifiers.  */
   unsigned int i;
   tree id;
-  int mask = (flag_isoc99 ? 0 : D_C89)
-	      | (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0);
+  int mask = ((flag_isoc99 ? 0 : D_C89)
+	      | (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0)
+	      | (warn_cxx_compat ? 0 : D_CXX)
+	      | (warn_cxx0x_compat ? 0 : D_CXX0X));
 
   if (!c_dialect_objc ())
      mask |= D_OBJC;
 
   ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX);
-  for (i = 0; i < N_reswords; i++)
+  for (i = 0; i < num_c_common_reswords; i++)
     {
       /* If a keyword is disabled, do not enter it into the table
 	 and so create a canonical spelling that isn't a keyword.  */
-      if (reswords[i].disable & mask)
+      if (c_common_reswords[i].disable & mask)
 	continue;
 
-      id = get_identifier (reswords[i].word);
-      C_SET_RID_CODE (id, reswords[i].rid);
+      id = get_identifier (c_common_reswords[i].word);
+      C_SET_RID_CODE (id, c_common_reswords[i].rid);
       C_IS_RESERVED_WORD (id) = 1;
-      ridpointers [(int) reswords[i].rid] = id;
+      ridpointers [(int) c_common_reswords[i].rid] = id;
     }
 }
 \f
@@ -343,6 +222,13 @@
 		    break;
 		  }
 	      }
+	    else if (C_COMMON_IS_CXX_KEYWORD (rid_code))
+	      {
+		warning (0,
+			 "%Hidentifier named %qs conflicts with C++ keyword",
+			 &token->location,
+			 IDENTIFIER_POINTER (token->value));
+	      }
 	    else
 	      {
 		/* Return the canonical spelling for this keyword.  */

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-01 19:56             ` Kaveh R. GHAZI
  2008-07-01 20:05               ` Tom Tromey
@ 2008-07-02  1:28               ` Tom Tromey
  2008-07-02  3:05                 ` Kaveh R. GHAZI
  1 sibling, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2008-07-02  1:28 UTC (permalink / raw)
  To: Kaveh R. GHAZI; +Cc: Ben Elliston, gcc-patches, gdr

>>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:

Kaveh> You can get past the -Werror failures temporarily by using
Kaveh> --disable-werror to get to the testsuite.  That will at least
Kaveh> tell you if any testcases fail.  The warnings can be fixed in
Kaveh> the meantime (I'll help if you like.)

I tried this on the compile farm but the build dies in libgomp.  This
is a bug in the patch, not libgomp, as the failing keyword is _Bool.
This is tricky to fix since both 'bool' and '_Bool' map to RID_BOOL.

Tom

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-02  1:28               ` Tom Tromey
@ 2008-07-02  3:05                 ` Kaveh R. GHAZI
  2008-07-02 15:02                   ` Tom Tromey
  0 siblings, 1 reply; 19+ messages in thread
From: Kaveh R. GHAZI @ 2008-07-02  3:05 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Ben Elliston, gcc-patches, gdr

On Tue, 1 Jul 2008, Tom Tromey wrote:

> >>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:
>
> Kaveh> You can get past the -Werror failures temporarily by using
> Kaveh> --disable-werror to get to the testsuite.  That will at least
> Kaveh> tell you if any testcases fail.  The warnings can be fixed in
> Kaveh> the meantime (I'll help if you like.)
>
> I tried this on the compile farm but the build dies in libgomp.  This
> is a bug in the patch, not libgomp, as the failing keyword is _Bool.
> This is tricky to fix since both 'bool' and '_Bool' map to RID_BOOL.
> Tom

At the point we're building the target libraries like libgomp, we've
already 3-staged cc1 so we have a C compiler available regardless of
whether we used a C++ compiler to bootstrap or not.  From a design
standpoint, there's no need to ensure that libgomp is buildable with C++
and we shouldn't apply this warning there.

Hmm.  What I don't understand is why this warning is active in a target
library in the first place.  I put -Wc++-compat in only for the gcc dir.
Are you sure when you added the C++ keyword warning that it checks
warn_cxx_compat?  Seems like the only way it would complain in this dir is
if it's on always.

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-01 20:37                   ` Tom Tromey
@ 2008-07-02  3:15                     ` Kaveh R. GHAZI
  2008-07-02 15:08                       ` Tom Tromey
  0 siblings, 1 reply; 19+ messages in thread
From: Kaveh R. GHAZI @ 2008-07-02  3:15 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Ben Elliston, gcc-patches, gdr

On Tue, 1 Jul 2008, Tom Tromey wrote:

> Kaveh> Does the patch apply cleanly against mainline?  I just gave it
> Kaveh> a try and got rejects.
>
> I updated to 137323 and made the appended.
> Tom

I still get failures when applying it to mainline.  Was this supposed to
be applied against the gcc-in-cxx branch only?  (I don't have it checked
out to try it ATM.)

patching file cp/lex.c
patching file c-common.c
Hunk #1 FAILED at 219.
1 out of 1 hunk FAILED -- saving rejects to file c-common.c.rej
patching file c-common.h
patching file c-parser.c
Hunk #1 FAILED at 58.
Hunk #2 succeeded at 70 with fuzz 1.
1 out of 3 hunks FAILED -- saving rejects to file c-parser.c.rej

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-02  3:05                 ` Kaveh R. GHAZI
@ 2008-07-02 15:02                   ` Tom Tromey
  2008-07-08 15:52                     ` Ian Lance Taylor
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2008-07-02 15:02 UTC (permalink / raw)
  To: Kaveh R. GHAZI; +Cc: Ben Elliston, gcc-patches, gdr

>>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:

Tom> I tried this on the compile farm but the build dies in libgomp.  This
Tom> is a bug in the patch, not libgomp, as the failing keyword is _Bool.
Tom> This is tricky to fix since both 'bool' and '_Bool' map to RID_BOOL.

Kaveh> Hmm.  What I don't understand is why this warning is active in
Kaveh> a target library in the first place.  I put -Wc++-compat in
Kaveh> only for the gcc dir.  Are you sure when you added the C++
Kaveh> keyword warning that it checks warn_cxx_compat?  Seems like the
Kaveh> only way it would complain in this dir is if it's on always.

Yeah, the warn_cxx_compat check is done when the keywords are added.
However, it always adds the _Bool keyword.  The "should I warn" logic
checks the RID_* value to see if it is a C++ keyword -- but because
_Bool and bool share a RID code, the warning triggers.

One way to fix this would be to add a new RID code to differentiate
the two cases.  Another way would be to check the spelling of the
token at the warning point.

Tom

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-02  3:15                     ` Kaveh R. GHAZI
@ 2008-07-02 15:08                       ` Tom Tromey
  2008-07-07  8:37                         ` Kaveh R. GHAZI
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2008-07-02 15:08 UTC (permalink / raw)
  To: Kaveh R. GHAZI; +Cc: Ben Elliston, gcc-patches, gdr

>>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:

Kaveh> I still get failures when applying it to mainline.  Was this
Kaveh> supposed to be applied against the gcc-in-cxx branch only?  (I
Kaveh> don't have it checked out to try it ATM.)

Nope, definitely trunk.  Also this is the only patch in my tree.

Do you have some other local patch?

I'll send you an updated patch off-list.

Tom

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-02 15:08                       ` Tom Tromey
@ 2008-07-07  8:37                         ` Kaveh R. GHAZI
  0 siblings, 0 replies; 19+ messages in thread
From: Kaveh R. GHAZI @ 2008-07-07  8:37 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Ben Elliston, gcc-patches, gdr

On Wed, 2 Jul 2008, Tom Tromey wrote:

> >>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:
>
> Kaveh> I still get failures when applying it to mainline.  Was this
> Kaveh> supposed to be applied against the gcc-in-cxx branch only?  (I
> Kaveh> don't have it checked out to try it ATM.)
>
> Nope, definitely trunk.  Also this is the only patch in my tree.
> Do you have some other local patch?
> I'll send you an updated patch off-list.
> Tom

Okay, got the patch working on my end.  (The problem was that the
surrounding source code had embedden ctrl-L's in it and they didn't
survive a cut-n-paste on my end causing the patch conflicts.  My fault.)

There are about 1540 unique C++ keyword warnings during bootstrap, (urp).
It dies in libgomp like you described elsewhere.  I grep'ed out the C++
keyword warnings from my log and got a count for each source file.  I made
a small patch to clean up the gen*.c files, but nothing else ATM.  If you
plan to submit this for mainline, I'll help but I can't do the whole thing
myself again.

I think a strategy for getting some assistance would be to *temporarily*
put the warning under its own flag so you could activate it as a soft
warning via a #pragma diagnostic in system.h like I did for -Wc++-compat.
Then people would see them and could fix individual warnings.  Once it was
all cleaned up, you could merge it into -Wc++-compat and get rid of the
temporary flag.  If there's an easier way to leave the void*->T* as a hard
error while having the C++ keyword be a soft warning, by all means do that
instead of creating a temporary -W* flag. :-)

		Thanks,
		--Kaveh


grep warning: output | grep keyword | sed 's%.*/gcc/%%' | sort -u | \
sed 's%:[0-9]*: warning:%: warning:%; s%: warning:.*%%' | uniq -c

yields:

     18 bt-load.c
      5 builtins.c
      2 c-pch.c
     34 caller-save.c
      4 calls.c
     25 cgraph.c
      5 combine-stack-adj.c
    101 combine.c
      5 cp/decl.c
      4 cp/friend.c
      5 cp/init.c
     13 cp/mangle.c
     28 cp/name-lookup.c
     21 cp/parser.c
     84 cp/pt.c
      4 cp/tree.c
      3 cp/typeck.c
      1 crtstuff.c
     61 cse.c
      9 df-problems.c
      6 df-scan.c
      8 dse.c
     70 emit-rtl.c
     18 except.c
      3 explow.c
      9 expr.c
     21 final.c
     20 fortran/arith.c
     12 fortran/array.c
      7 fortran/bbt.c
     32 fortran/decl.c
     11 fortran/dependency.c
      3 fortran/dump-parse-tree.c
     14 fortran/expr.c
      4 fortran/gfortran.h
    113 fortran/interface.c
     39 fortran/intrinsic.c
     14 fortran/io.c
      2 fortran/iresolve.c
      6 fortran/match.c
     11 fortran/matchexp.c
     43 fortran/module.c
      4 fortran/openmp.c
     13 fortran/resolve.c
      3 fortran/scanner.c
      5 fortran/st.c
      7 fortran/symbol.c
      3 fortran/trans-common.c
      3 fortran/trans-decl.c
     18 fortran/trans-expr.c
      1 fortran/trans-openmp.c
      4 fortran/trans-types.c
      1 fortran/trans.h
     54 function.c
     40 fwprop.c
     26 gcse.c
      6 genattrtab.c
      5 genemit.c
      4 gengtype.c
      1 gengtype.h
     20 genoutput.c
     26 genrecog.c
      5 gensupport.c
     17 gimplify.c
      1 intl.c
      3 ipa-cp.c
     10 lcm.c
      1 libgcc2.c
      3 lower-subreg.c
      3 matrix-reorg.c
      4 mode-switching.c
      7 passes.c
      2 profile.c
      4 ra.h
     20 recog.c
     37 reg-stack.c
     69 regrename.c
     33 reload1.c
     14 rtlanal.c
      4 rtlhooks.c
      3 sched-rgn.c
      9 tree-dump.c
     13 tree-eh.c
     88 tree-inline.c
     14 tree-into-ssa.c
      9 tree-predcom.c
      6 tree-vrp.c
      9 tree.c
      6 value-prof.c
      4 varasm.c

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

* Re: Patch: FYI: avoid use of C++ keywords in gcc/java
  2008-07-02 15:02                   ` Tom Tromey
@ 2008-07-08 15:52                     ` Ian Lance Taylor
  0 siblings, 0 replies; 19+ messages in thread
From: Ian Lance Taylor @ 2008-07-08 15:52 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Kaveh R. GHAZI, Ben Elliston, gcc-patches, gdr

Tom Tromey <tromey@redhat.com> writes:

> One way to fix this would be to add a new RID code to differentiate
> the two cases.  Another way would be to check the spelling of the
> token at the warning point.

I'm testing a patch which uses a new RID code.

My plan to integrate it is simply to turn on the warning one C++
keyword at a time.

Ian

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

end of thread, other threads:[~2008-07-08 14:54 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-24 13:02 Patch: FYI: avoid use of C++ keywords in gcc/java Tom Tromey
2008-06-26  2:30 ` Ben Elliston
2008-06-26  3:17   ` Tom Tromey
2008-06-26  6:39     ` Kaveh R. GHAZI
2008-06-26 21:13       ` Tom Tromey
2008-07-01 18:00         ` Kaveh R. GHAZI
2008-07-01 18:19           ` Tom Tromey
2008-07-01 19:56             ` Kaveh R. GHAZI
2008-07-01 20:05               ` Tom Tromey
2008-07-01 20:30                 ` Kaveh R. Ghazi
2008-07-01 20:37                   ` Tom Tromey
2008-07-02  3:15                     ` Kaveh R. GHAZI
2008-07-02 15:08                       ` Tom Tromey
2008-07-07  8:37                         ` Kaveh R. GHAZI
2008-07-02  1:28               ` Tom Tromey
2008-07-02  3:05                 ` Kaveh R. GHAZI
2008-07-02 15:02                   ` Tom Tromey
2008-07-08 15:52                     ` Ian Lance Taylor
2008-06-26  9:51     ` Markus Milleder

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).