C patch to remove useless code from parmlist_or_identifiers_1

Joseph S. Myers jsm@polyomino.org.uk
Mon Aug 30 19:45:00 GMT 2004


This patch is part of the C90 implementation project for GCC 3.5
(current status being maintained at
<http://www.srcf.ucam.org/~jsm28/gcc/#c90status>).

This particular patch is one fragment preliminary to the replacement
of trees as datastructures for declarators, going in separately
because the decoupling of ObjC from declarators isn't yet in mainline.
(I wouldn't normally split such a patch up into quite so many little
bits.)

Some of the code in parmlist_or_identifiers_1 has no effect.  The
first hunk checks for a condition "`...' in old-style identifier list"
that the grammar does not permit to arise.  The second has a condition
TREE_PURPOSE ($$) == 0 which is always true and so can be simplified.
These unnecessary conditions make no sense when this syntax production
produces something other than a tree.  This patch removes the
unnecessary code.

Bootstrapped with no regressions on i686-pc-linux-gnu together with
the other such fragment sent at this time.  Applied to mainline.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
  http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 3.5
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

2004-08-30  Joseph S. Myers  <jsm@polyomino.org.uk>

	* c-parse.in (parmlist_or_identifiers_1): Remove unreachable and
	redundant code.

diff -rupN GCC.orig/gcc/c-parse.in GCC/gcc/c-parse.in
--- GCC.orig/gcc/c-parse.in	2004-08-27 16:42:07.000000000 +0000
+++ GCC/gcc/c-parse.in	2004-08-30 15:02:25.000000000 +0000
@@ -2602,16 +2602,10 @@ parmlist_or_identifiers_1:
 	  parmlist_1
 	| identifiers ')'
 		{ tree t;
-		  for (t = $1; t; t = TREE_CHAIN (t))
-		    if (TREE_VALUE (t) == NULL_TREE)
-		      error ("`...' in old-style identifier list");
 		  $$ = tree_cons (NULL_TREE, NULL_TREE, $1);
 
 		  /* Make sure we have a parmlist after attributes.  */
-		  if ($<ttype>-1 != 0
-		      && (TREE_CODE ($$) != TREE_LIST
-			  || TREE_PURPOSE ($$) == 0
-			  || TREE_CODE (TREE_PURPOSE ($$)) != PARM_DECL))
+		  if ($<ttype>-1 != 0)
 		    YYERROR1;
 		}
 	;



More information about the Gcc-patches mailing list