bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: c output and register keyword


From: Paul Eggert
Subject: Re: c output and register keyword
Date: Fri, 21 Jan 2005 11:14:29 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

address@hidden writes:

> In the generated c output from bison-2.0a cvs-version
> the register keyword is used on some variables.
> Is this still needed, does it make still sense?

It didn't make any difference in the three optimizing compilers I tried,
so I removed it as follows.  Thanks for reporting it.

2005-01-21  Paul Eggert  <address@hidden>

        * data/yacc.c (YYCOPY, yystpcpy, yyparse): Remove "register"
        keyword; it's not needed with modern compilers, and it doesn't
        affect correctness with older compilers.  Suggested by
        address@hidden

Index: yacc.c
===================================================================
RCS file: /cvsroot/bison/bison/data/yacc.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -p -u -r1.81 -r1.82
--- yacc.c      17 Jan 2005 09:33:57 -0000      1.81
+++ yacc.c      21 Jan 2005 19:12:32 -0000      1.82
@@ -286,7 +286,7 @@ union yyalloc
 #   define YYCOPY(To, From, Count)             \
       do                                       \
        {                                       \
-         register YYSIZE_T yyi;                \
+         YYSIZE_T yyi;                         \
          for (yyi = 0; yyi < (Count); yyi++)   \
            (To)[yyi] = (From)[yyi];            \
        }                                       \
@@ -666,7 +666,7 @@ yystrlen (yystr)
      const char *yystr;
 #   endif
 {
-  register const char *yys = yystr;
+  const char *yys = yystr;
 
   while (*yys++ != '\0')
     continue;
@@ -691,8 +691,8 @@ yystpcpy (yydest, yysrc)
      const char *yysrc;
 #   endif
 {
-  register char *yyd = yydest;
-  register const char *yys = yysrc;
+  char *yyd = yydest;
+  const char *yys = yysrc;
 
   while ((*yyd++ = *yys++) != '\0')
     continue;
@@ -764,8 +764,8 @@ b4_c_function_def([yyparse], [int], b4_p
 #endif
 {[
   ]b4_pure_if([b4_declare_parser_variables])[
-  register int yystate;
-  register int yyn;
+  int yystate;
+  int yyn;
   int yyresult;
   /* Number of tokens to shift before error messages enabled.  */
   int yyerrstatus;
@@ -783,12 +783,12 @@ b4_c_function_def([yyparse], [int], b4_p
   /* The state stack.  */
   short int yyssa[YYINITDEPTH];
   short int *yyss = yyssa;
-  register short int *yyssp;
+  short int *yyssp;
 
   /* The semantic value stack.  */
   YYSTYPE yyvsa[YYINITDEPTH];
   YYSTYPE *yyvs = yyvsa;
-  register YYSTYPE *yyvsp;
+  YYSTYPE *yyvsp;
 
 ]b4_location_if(
 [[  /* The location stack.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]