[test-suite] r338773 - Prolangs-C/bison: don't rewind stdout

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 2 15:05:04 PDT 2018


Author: maskray
Date: Thu Aug  2 15:05:04 2018
New Revision: 338773

URL: http://llvm.org/viewvc/llvm-project?rev=338773&view=rev
Log:
Prolangs-C/bison: don't rewind stdout

fattrs is stdout, which was incorrectly rewound. This would cause issue
if the output is not a normal file.

Modified:
    test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/bison/mybison.reference_output
    test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/bison/output.c

Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/bison/mybison.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/bison/mybison.reference_output?rev=338773&r1=338772&r2=338773&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/bison/mybison.reference_output (original)
+++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/bison/mybison.reference_output Thu Aug  2 15:05:04 2018
@@ -1,207 +1,379 @@
-#include <stdio.h>
-
-#ifndef __STDC__
-#define const
-#endif
-
 
+/*  A Bison parser, made from parse.y.in  */
 
-#define	YYFINAL		152
-#define	YYFLAG		-32768
-#define	YYNTBASE	48
-
-#define YYTRANSLATE(x) ((unsigned)(x) <= 291 ? yytranslate[x] : 84)
-
-static const char yytranslate[] = {     0,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,    43,
-    44,    38,    35,    45,    36,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,    42,    41,     2,
-    29,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    46,     2,    47,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
-     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
-    26,    27,    28,    30,    31,    32,    33,    34,    37,    39,
-    40
-};
-
-static const short yyrline[] = {     0,
-    39,    41,    44,    65,    67,    67,    69,    83,    89,   101,
-   112,   118,   121,   135,   137,   141,   147,   150,   163,   177,
-   180,   183,   189,   191,   208,   219,   230,   247,   255,   256,
-   257,   259,   260,   262,   263,   264,   265,   266,   267,   269,
-   279,   298,   299,   301,   307,   309,   315,   317,   323,   326,
-   329,   332,   341,   350,   361,   372,   382,   393,   404,   416,
-   427,   438,   449,   460,   471,   482,   493,   503,   512,   549,
-   600,   627,   629,   688,   726,   731,   740,   745
-};
+#line 1 "parse.y.in"
 
-static const char * const yytname[] = {     0,
-"error","$illegal.","PROG","PERIOD","PROC","FUNC","VAR","ARRAY","RANGE","OF",
-"INT","CHAR","BOOL","WRITELN","THEN","ELSE","IF","DO","WHILE","BEG",
-"END","ASG","NOT","TRUE_TOK","FALSE_TOK","ID","CCONST","ICONST","'='","NEQ",
-"LT","LEQ","GEQ","GT","'+'","'-'","OR","'*'","AND","DIV",
-"';'","':'","'('","')'","','","'['","']'","program"
-};
-
-static const short yyr1[] = {     0,
-    49,    48,    51,    50,    52,    52,    54,    55,    53,    56,
-    57,    58,    53,    59,    59,    60,    60,    61,    61,    62,
-    62,    63,    63,    64,    65,    65,    66,    66,    67,    67,
-    67,    68,    68,    69,    69,    69,    69,    69,    69,    70,
-    71,    72,    72,    73,    74,    75,    76,    77,    78,    79,
-    79,    80,    80,    81,    81,    81,    81,    81,    81,    81,
-    81,    81,    81,    81,    81,    81,    81,    81,    81,    81,
-    81,    81,    82,    82,    83,    83,    83,    83
-};
-
-static const short yyr2[] = {     0,
-     0,     6,     0,     4,     2,     0,     0,     0,     8,     0,
-     0,     0,    11,     3,     0,     3,     1,     2,     1,     0,
-     2,     3,     2,     3,     3,     1,     8,     1,     1,     1,
-     1,     3,     1,     1,     1,     1,     1,     1,     1,     4,
-     2,     5,     3,     2,     3,     2,     3,     2,     2,     0,
-     3,     3,     1,     3,     3,     2,     3,     3,     3,     3,
-     3,     3,     3,     3,     3,     3,     2,     3,     4,     1,
-     4,     1,     1,     4,     1,     1,     1,     1
-};
-
-static const short yydefact[] = {     0,
-     0,     1,     0,    20,     0,     0,     3,    26,    21,     0,
-     0,     2,     6,     0,    23,     0,     0,     0,    22,     0,
-    29,    30,    31,    24,    28,    25,     0,     0,     0,     5,
-     4,     0,     7,    10,     0,     0,     0,    50,     0,    33,
-    39,    37,    34,     0,    35,     0,    38,    36,     0,     0,
-     0,    15,    15,     0,     0,    77,    78,    70,    76,    75,
-     0,     0,    44,    72,    46,     0,     0,    41,    47,     0,
-     0,     0,    48,    49,     0,     0,     8,    11,     0,    67,
-     0,     0,    56,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,    53,     0,    32,
-    43,    45,     0,     0,     0,    17,    19,     0,     0,    40,
-     0,     0,    68,    60,    59,    63,    64,    61,    62,    54,
-    55,    66,    57,    65,    58,    51,     0,    74,     0,     0,
-    18,     0,    14,    20,     0,    69,    71,    52,    42,     0,
-    16,     0,     0,    27,     9,    12,    20,     0,    13,     0,
-     0,     0
-};
-
-static const short yydefgoto[] = {   150,
-     3,     6,    13,    18,    30,    52,   108,    53,   109,   147,
-    77,   105,   106,     7,     9,   107,    11,    24,    25,    39,
-    40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
-    68,    97,    98,    50,    64
-};
-
-static const short yypact[] = {     8,
-    -2,-32768,     7,    21,    20,    69,-32768,-32768,    20,    45,
-   -30,-32768,-32768,    55,-32768,    76,    56,    11,-32768,    51,
--32768,-32768,-32768,-32768,-32768,-32768,    72,    86,    57,-32768,
--32768,    85,-32768,-32768,    73,    42,    42,   -13,   -18,-32768,
--32768,-32768,-32768,    99,-32768,    97,-32768,-32768,    42,    95,
-   122,    89,    89,    42,    42,-32768,-32768,   -21,-32768,-32768,
-    42,    42,   125,-32768,   125,    42,    42,-32768,-32768,    57,
-    57,    57,   125,-32768,   105,     3,-32768,-32768,     5,-32768,
-    42,    42,-32768,   109,    42,    42,    42,    42,    42,    42,
-    42,    42,    42,    42,    42,    42,    18,   125,    71,-32768,
-   118,-32768,    88,    20,    31,-32768,-32768,   110,    94,-32768,
-    46,    90,-32768,   137,   137,   137,   137,   137,   137,    41,
-    41,    41,-32768,-32768,-32768,-32768,    42,-32768,    57,   140,
--32768,     3,-32768,    21,    82,-32768,-32768,   125,-32768,    82,
--32768,   111,   138,-32768,-32768,-32768,    21,   139,-32768,   178,
-   181,-32768
-};
-
-static const short yypgoto[] = {-32768,
--32768,  -126,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-   129,-32768,    52,-32768,-32768,    -5,-32768,-32768,  -122,-32768,
-   -65,-32768,-32768,-32768,-32768,-32768,-32768,   165,-32768,-32768,
--32768,   104,   -35,-32768,-32768
-};
-
-
-#define	YYLAST		185
-
-
-static const short yytable[] = {    10,
-    63,    65,    69,    14,   100,   101,   102,   142,   -73,   104,
-     1,    16,   143,    73,    17,    27,    28,   144,    79,    80,
-   148,    81,    70,     2,    82,    83,    84,     5,     8,    66,
-    29,    99,    67,    85,    86,    87,    88,    89,    90,    91,
-    92,    93,    94,    95,    96,     8,   112,     4,   110,   114,
-   115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
-   125,   126,   127,   139,    55,    56,    57,    58,    59,    60,
-    35,   132,    12,    36,   133,    37,    29,    61,    94,    95,
-    96,    26,    38,    20,    62,    15,    21,    22,    23,   136,
-   127,   138,    21,    22,    23,    19,    32,    33,   131,    85,
-    86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
-    96,    34,    51,    71,    72,    54,    74,   128,    85,    86,
-    87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
-    75,    76,   103,   129,   130,   135,   137,    85,    86,    87,
-    88,    89,    90,    91,    92,    93,    94,    95,    96,   140,
-   134,   145,   113,    85,    86,    87,    88,    89,    90,    91,
-    92,    93,    94,    95,    96,-32768,-32768,-32768,-32768,-32768,
--32768,    91,    92,    93,    94,    95,    96,   151,   146,   149,
-   152,    78,    31,   141,   111
-};
-
-static const short yycheck[] = {     5,
-    36,    37,    21,     9,    70,    71,    72,   134,    22,     7,
-     3,    42,   135,    49,    45,     5,     6,   140,    54,    55,
-   147,    43,    41,    26,    46,    61,    62,     7,    26,    43,
-    20,    67,    46,    29,    30,    31,    32,    33,    34,    35,
-    36,    37,    38,    39,    40,    26,    82,    41,    44,    85,
-    86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
-    96,    44,    45,   129,    23,    24,    25,    26,    27,    28,
-    14,    41,     4,    17,    44,    19,    20,    36,    38,    39,
-    40,    26,    26,     8,    43,    41,    11,    12,    13,    44,
-    45,   127,    11,    12,    13,    41,    46,    26,   104,    29,
-    30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
-    40,    26,    28,    15,    18,    43,    22,    47,    29,    30,
-    31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
-     9,    43,    28,    16,    47,    42,    47,    29,    30,    31,
-    32,    33,    34,    35,    36,    37,    38,    39,    40,    10,
-    41,    41,    44,    29,    30,    31,    32,    33,    34,    35,
-    36,    37,    38,    39,    40,    29,    30,    31,    32,    33,
-    34,    35,    36,    37,    38,    39,    40,     0,    41,    41,
-     0,    53,    18,   132,    81
-};
-#define YYPURE 1
+#include <malloc.h>
+#include <string.h>
+#include "attr.h"
+int yylex();
+void yyerror(char* s);
+#include "symtab.h"
+/* Global variables */
+scopeEntry current = NULL;  /* Points to current scope */
+scopeEntry temp = NULL;     /* Used temporarily for adding and/or
+			       removing scopes */
+
+#line 14 "parse.y.in"
+typedef union { int number;
+	 tokentype token;
+	 BaseType basetype;
+	 typeinfo totaltype;
+	 namelist names;
+	 expnode exps;
+	 explist elist;} YYSTYPE;
+
+#ifndef YYLTYPE
+typedef
+  struct yyltype
+    {
+      int first_line;
+      int first_column;
+      int last_line;
+      int last_column;
+    }
+  yyltype;
 
-#line 751 "parse.y.in"
+#define YYLTYPE yyltype
+#endif
 
+#define	YYACCEPT	goto yyaccept
+#define	YYABORT	goto yyabort
+#define	YYERROR	goto yyerrlab
+#define	yytext	(*_yytext)
+extern char **_yytext;
+#define	yylval	(*_yylval)
+extern YYSTYPE *_yylval;
+#define	yylloc	(*_yylloc)
+extern YYLTYPE *_yylloc;
+#define	yyppval	(*_yyppval)
+extern int *_yyppval;
+
+  switch (yyn) {
+
+case 1:
+#line 40 "parse.y.in"
+{ enterblock(); ;
+    break;}
+case 2:
+#line 42 "parse.y.in"
+{leaveblock();;
+    break;}
+case 3:
+#line 45 "parse.y.in"
+{
+      /* Seen all the variables so declare them in the current scope */
+	 symTabEntry s;
+         namenode tmpnode;
+
+	 tmpnode = yyp->yyvsp[0].names.firstname;
+	 while ( tmpnode != NULL )
+	 {
+            if ( lookup( tmpnode -> name , current ) == NULL )
+	    {
+ 	       s = declare(tmpnode -> name,tmpnode -> idtype.basetype,
+		       tmpnode -> idtype.gentype,tmpnode -> ptype,
+                       tmpnode -> idtype.number, tmpnode -> idtype.endnum);
+	    }
+            else
+	       printf("\n***Error: duplicate declaration of %s\n", tmpnode ->
+		      name);
+	    tmpnode = tmpnode -> next;
+	 }
+      ;
+    break;}
+case 7:
+#line 70 "parse.y.in"
+{  
+	   symTabEntry find;
 
-void
-yyerror(char* s) {
-    fprintf(stderr,"%s\n",s);
-    }
+	   if (lookup(yyp->yyvsp[0].token.str,current) == NULL)
+	      find = declare(yyp->yyvsp[0].token.str,VOIDTYPE,PROCTYPE,NOTPARM,-1,-1);
+	   /* Just make a spot in the outerscope to hold the name of the */
+	   /* procedure */
+	   else
+	      printf("\n***Error: duplicate declaration of %s\n",yyp->yyvsp[0].token.str);
+	   enterblock();
+           procentry(yyp->yyvsp[0].token.str,PROCTYPE);
+	;
+    break;}
+case 8:
+#line 83 "parse.y.in"
+{           /* After we have seen the parmlist, install it and */
+           int n;   /* update the number field */
+	   
+	   n = installparms(yyp->yyvsp[0].names);
+	   current -> procedure -> number = n;
+        ;
+    break;}
+case 9:
+#line 90 "parse.y.in"
+{
+	   symTabEntry find;
+	   
+	   find = lookup(yyp->yyvsp[-6].token.str, current -> outerscope);  /* Before we leave the block */
+	   if ( find != NULL )                            /* We must transfer the link */
+	   {                                              /* to the outer scope        */
+	      find -> number = current -> procedure -> number;
+	      find -> formals = current -> procedure -> formals;
+	   }
+           leaveblock();
+	;
+    break;}
+case 10:
+#line 102 "parse.y.in"
+{   /* Same as above up until where 'stype' is */
+	   symTabEntry find;
+	   if (lookup(yyp->yyvsp[0].token.str,current) == NULL)
+	      find = declare(yyp->yyvsp[0].token.str,VOIDTYPE,FUNCTYPE,NOTPARM,-1,-1);
+	   else
+	      printf("\n***Error: duplicate declaration of %s\n",yyp->yyvsp[0].token.str);
+	   enterblock();
+           procentry(yyp->yyvsp[0].token.str,FUNCTYPE);
+        ;
+    break;}
+case 11:
+#line 112 "parse.y.in"
+{
+	   int n;
+	   
+	   n = installparms(yyp->yyvsp[0].names);
+	   current -> procedure -> number = n;
+	;
+    break;}
+case 12:
+#line 119 "parse.y.in"
+{ finishfunc(yyp->yyvsp[-1].basetype);
+	   /* We NOW know what type it returns so record it */;
+    break;}
+case 13:
+#line 122 "parse.y.in"
+{
+	   symTabEntry find;
+	  
+	   find = lookup(yyp->yyvsp[-9].token.str, current -> outerscope );
+	   if ( find != NULL )
+	   {   /* Before we leave the block, we must make the link in the outer scope */
+	      find -> number = current -> procedure -> number;
+	      find -> basetype = current -> procedure -> basetype;
+	      find -> formals = current -> procedure -> formals;
+	   }
+           leaveblock(); 
+	;
+    break;}
+case 14:
+#line 136 "parse.y.in"
+{ yyval.names = yyp->yyvsp[-1].names; ;
+    break;}
+case 15:
+#line 138 "parse.y.in"
+{ yyval.names.firstname = NULL;   /* There are no params so the list is NULL */
+	   yyval.names.lastname = NULL; ;
+    break;}
+case 16:
+#line 142 "parse.y.in"
+{  /* Link the current list to the new parmlist and send it up */
+	   yyp->yyvsp[-2].names.lastname -> next = yyp->yyvsp[0].names.firstname;
+	   yyval.names.firstname = yyp->yyvsp[-2].names.firstname;
+	   yyval.names.lastname = yyp->yyvsp[0].names.lastname;
+	;
+    break;}
+case 17:
+#line 148 "parse.y.in"
+{ yyval.names = yyp->yyvsp[0].names; ;
+    break;}
+case 18:
+#line 151 "parse.y.in"
+{  /* We know that these are pass by reference so record
+	      it in all the nodes */
+	   namenode tmpnode;
+	   
+	   tmpnode = yyp->yyvsp[0].names.firstname;
+	   while ( tmpnode != NULL )
+	   {
+	      tmpnode -> ptype = REFPARM;
+	      tmpnode = tmpnode -> next;
+	   }
+	   yyval.names = yyp->yyvsp[0].names; /* Send up the new list */
+	;
+    break;}
+case 19:
+#line 164 "parse.y.in"
+{  /* We know that these are pass by value so record
+	      it in all the nodes */
+	   namenode tmpnode;
+	   
+	   tmpnode = yyp->yyvsp[0].names.firstname;
+	   while ( tmpnode != NULL )
+	   {
+	      tmpnode -> ptype = VALPARM;
+	      tmpnode = tmpnode -> next;
+	   }
+	   yyval.names = yyp->yyvsp[0].names; /* Send up the new list */
+	;
+    break;}
+case 20:
+#line 178 "parse.y.in"
+{ yyval.names.firstname = NULL;  /* No variables = no list */
+	  yyval.names.lastname = NULL; ;
+    break;}
+case 21:
+#line 181 "parse.y.in"
+{ yyval.names = yyp->yyvsp[0].names; ;
+    break;}
+case 22:
+#line 184 "parse.y.in"
+{  /* Concatenates the 2 namelists */
+           yyp->yyvsp[-2].names.lastname -> next = yyp->yyvsp[-1].names.firstname;
+	   yyval.names.firstname = yyp->yyvsp[-2].names.firstname;
+	   yyval.names.lastname = yyp->yyvsp[-1].names.lastname;
+        ;
+    break;}
+case 23:
+#line 190 "parse.y.in"
+{ yyval.names = yyp->yyvsp[-1].names; ;
+    break;}
+case 24:
+#line 192 "parse.y.in"
+{  /* We have a list of IDs and we have their type so
+	      we can now record them to be all of the same type */
+	   namenode tmpnode;
 
-int
-main() {
-    printf("1\t");
-    yyparse();
-    return 1;
-    }
-ck the parameters */
+	   tmpnode = yyp->yyvsp[-2].names.firstname;
+	   while ( tmpnode != NULL )
+	   {
+	      tmpnode->idtype.basetype = yyp->yyvsp[0].totaltype.basetype;
+	      tmpnode->idtype.gentype = yyp->yyvsp[0].totaltype.gentype;
+	      tmpnode->idtype.number = yyp->yyvsp[0].totaltype.number;
+	      tmpnode->idtype.endnum = yyp->yyvsp[0].totaltype.endnum;
+	      tmpnode->ptype = NOTPARM;
+              tmpnode = tmpnode -> next;
+	   }
+           yyval.names = yyp->yyvsp[-2].names; /* Send up the new list */
+        ;
+    break;}
+case 25:
+#line 209 "parse.y.in"
+{  /* Hook the new ID to the current list of IDs */
+	   namenode tmpname1 = NULL;
+
+	   tmpname1 = (namenode) malloc(sizeof(struct _namenode));
+	   tmpname1 -> name = yyp->yyvsp[0].token.str;
+	   tmpname1 -> next = NULL;
+           yyp->yyvsp[-2].names.lastname -> next = tmpname1;
+           yyval.names.firstname = yyp->yyvsp[-2].names.firstname;
+	   yyval.names.lastname = tmpname1;
+        ;
+    break;}
+case 26:
+#line 220 "parse.y.in"
+{  /* Start the linked list with the first ID */
+	   namenode tmpname1 = NULL;
+	
+	   tmpname1 = (namenode) malloc(sizeof(struct _namenode));
+	   tmpname1 -> name = yyp->yyvsp[0].token.str;
+	   tmpname1 -> next = NULL;
+	   yyval.names.firstname = tmpname1;
+	   yyval.names.lastname = tmpname1;
+        ;
+    break;}
+case 27:
+#line 231 "parse.y.in"
+{ if (yyp->yyvsp[-5].token.num > yyp->yyvsp[-3].token.num)
+	  {
+	     printf("\n***Error: lower bound exceeds upper bound\n");
+	     yyval.totaltype.basetype = yyp->yyvsp[0].basetype;   /* Basetype is whatever 'stype' was */
+	     yyval.totaltype.gentype = ARRAYTYPE;
+	     yyval.totaltype.number = yyp->yyvsp[-3].token.num;
+	     yyval.totaltype.endnum = yyp->yyvsp[-5].token.num;
+	  }
+          else
+	  {
+             yyval.totaltype.basetype = yyp->yyvsp[0].basetype;   /* Basetype is whatever 'stype' was */
+             yyval.totaltype.gentype = ARRAYTYPE;
+	     yyval.totaltype.number = yyp->yyvsp[-5].token.num;
+	     yyval.totaltype.endnum = yyp->yyvsp[-3].token.num;
+          }
+	;
+    break;}
+case 28:
+#line 248 "parse.y.in"
+{   
+           yyval.totaltype.basetype = yyp->yyvsp[0].basetype;
+	   yyval.totaltype.gentype = NOTYPE;
+	   yyval.totaltype.number = -1;
+	   yyval.totaltype.endnum = -1;
+        ;
+    break;}
+case 29:
+#line 255 "parse.y.in"
+{ yyval.basetype = INTTYPE; /* Send up the basetypes */ ;
+    break;}
+case 30:
+#line 256 "parse.y.in"
+{ yyval.basetype = CHARTYPE;                            ;
+    break;}
+case 31:
+#line 257 "parse.y.in"
+{ yyval.basetype = BOOLTYPE;                            ;
+    break;}
+case 32:
+#line 259 "parse.y.in"
+{   ;
+    break;}
+case 33:
+#line 260 "parse.y.in"
+{   ;
+    break;}
+case 34:
+#line 262 "parse.y.in"
+{   ;
+    break;}
+case 35:
+#line 263 "parse.y.in"
+{   ;
+    break;}
+case 36:
+#line 264 "parse.y.in"
+{   ;
+    break;}
+case 37:
+#line 265 "parse.y.in"
+{   ;
+    break;}
+case 38:
+#line 266 "parse.y.in"
+{   ;
+    break;}
+case 39:
+#line 267 "parse.y.in"
+{   ;
+    break;}
+case 40:
+#line 270 "parse.y.in"
+{ if (( yyp->yyvsp[-1].totaltype.basetype == INTTYPE ) || ( yyp->yyvsp[-1].totaltype.basetype == STRINGTYPE ))
+	  {  /* Must be a string or int */
+	     if ( yyp->yyvsp[-1].totaltype.gentype != NOTYPE )
+	        printf("\n***Error: illegal type for writeln\n"); /* No arrays or such */
+	  }
+	  else
+	     printf("\n***Error: illegal type for writeln\n"); /* Only ints and strings */
+	;
+    break;}
+case 41:
+#line 280 "parse.y.in"
+{
+           symTabEntry s;
+	   
+	   s = lookupALL(yyp->yyvsp[-1].token.str);
+	   if ( s == NULL )       /* ID not found */
+	      printf("\n***Error: undeclared identifier %s\n",yyp->yyvsp[-1].token.str);
+	   else
+	   {
+	      if ( s -> gentype != PROCTYPE ) /* Found, but not a procedure */
+	         printf("\n***Error: id %s is not a procedure\n",yyp->yyvsp[-1].token.str);
+	      else
+	      {  /* Found and it is a procedure so check the parameters */
 		 int check;
 		 check = checkparams( s -> formals , yyp->yyvsp[0].elist );
 	      }
@@ -3065,4 +3237,207 @@ state 151
 state 152
 
     NO ACTIONS
+#include <stdio.h>
+
+#ifndef __STDC__
+#define const
+#endif
+
+
+
+#define	YYFINAL		152
+#define	YYFLAG		-32768
+#define	YYNTBASE	48
+
+#define YYTRANSLATE(x) ((unsigned)(x) <= 291 ? yytranslate[x] : 84)
+
+static const char yytranslate[] = {     0,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,    43,
+    44,    38,    35,    45,    36,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,    42,    41,     2,
+    29,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    46,     2,    47,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
+     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
+    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+    26,    27,    28,    30,    31,    32,    33,    34,    37,    39,
+    40
+};
+
+static const short yyrline[] = {     0,
+    39,    41,    44,    65,    67,    67,    69,    83,    89,   101,
+   112,   118,   121,   135,   137,   141,   147,   150,   163,   177,
+   180,   183,   189,   191,   208,   219,   230,   247,   255,   256,
+   257,   259,   260,   262,   263,   264,   265,   266,   267,   269,
+   279,   298,   299,   301,   307,   309,   315,   317,   323,   326,
+   329,   332,   341,   350,   361,   372,   382,   393,   404,   416,
+   427,   438,   449,   460,   471,   482,   493,   503,   512,   549,
+   600,   627,   629,   688,   726,   731,   740,   745
+};
+
+static const char * const yytname[] = {     0,
+"error","$illegal.","PROG","PERIOD","PROC","FUNC","VAR","ARRAY","RANGE","OF",
+"INT","CHAR","BOOL","WRITELN","THEN","ELSE","IF","DO","WHILE","BEG",
+"END","ASG","NOT","TRUE_TOK","FALSE_TOK","ID","CCONST","ICONST","'='","NEQ",
+"LT","LEQ","GEQ","GT","'+'","'-'","OR","'*'","AND","DIV",
+"';'","':'","'('","')'","','","'['","']'","program"
+};
+
+static const short yyr1[] = {     0,
+    49,    48,    51,    50,    52,    52,    54,    55,    53,    56,
+    57,    58,    53,    59,    59,    60,    60,    61,    61,    62,
+    62,    63,    63,    64,    65,    65,    66,    66,    67,    67,
+    67,    68,    68,    69,    69,    69,    69,    69,    69,    70,
+    71,    72,    72,    73,    74,    75,    76,    77,    78,    79,
+    79,    80,    80,    81,    81,    81,    81,    81,    81,    81,
+    81,    81,    81,    81,    81,    81,    81,    81,    81,    81,
+    81,    81,    82,    82,    83,    83,    83,    83
+};
+
+static const short yyr2[] = {     0,
+     0,     6,     0,     4,     2,     0,     0,     0,     8,     0,
+     0,     0,    11,     3,     0,     3,     1,     2,     1,     0,
+     2,     3,     2,     3,     3,     1,     8,     1,     1,     1,
+     1,     3,     1,     1,     1,     1,     1,     1,     1,     4,
+     2,     5,     3,     2,     3,     2,     3,     2,     2,     0,
+     3,     3,     1,     3,     3,     2,     3,     3,     3,     3,
+     3,     3,     3,     3,     3,     3,     2,     3,     4,     1,
+     4,     1,     1,     4,     1,     1,     1,     1
+};
+
+static const short yydefact[] = {     0,
+     0,     1,     0,    20,     0,     0,     3,    26,    21,     0,
+     0,     2,     6,     0,    23,     0,     0,     0,    22,     0,
+    29,    30,    31,    24,    28,    25,     0,     0,     0,     5,
+     4,     0,     7,    10,     0,     0,     0,    50,     0,    33,
+    39,    37,    34,     0,    35,     0,    38,    36,     0,     0,
+     0,    15,    15,     0,     0,    77,    78,    70,    76,    75,
+     0,     0,    44,    72,    46,     0,     0,    41,    47,     0,
+     0,     0,    48,    49,     0,     0,     8,    11,     0,    67,
+     0,     0,    56,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,    53,     0,    32,
+    43,    45,     0,     0,     0,    17,    19,     0,     0,    40,
+     0,     0,    68,    60,    59,    63,    64,    61,    62,    54,
+    55,    66,    57,    65,    58,    51,     0,    74,     0,     0,
+    18,     0,    14,    20,     0,    69,    71,    52,    42,     0,
+    16,     0,     0,    27,     9,    12,    20,     0,    13,     0,
+     0,     0
+};
+
+static const short yydefgoto[] = {   150,
+     3,     6,    13,    18,    30,    52,   108,    53,   109,   147,
+    77,   105,   106,     7,     9,   107,    11,    24,    25,    39,
+    40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
+    68,    97,    98,    50,    64
+};
+
+static const short yypact[] = {     8,
+    -2,-32768,     7,    21,    20,    69,-32768,-32768,    20,    45,
+   -30,-32768,-32768,    55,-32768,    76,    56,    11,-32768,    51,
+-32768,-32768,-32768,-32768,-32768,-32768,    72,    86,    57,-32768,
+-32768,    85,-32768,-32768,    73,    42,    42,   -13,   -18,-32768,
+-32768,-32768,-32768,    99,-32768,    97,-32768,-32768,    42,    95,
+   122,    89,    89,    42,    42,-32768,-32768,   -21,-32768,-32768,
+    42,    42,   125,-32768,   125,    42,    42,-32768,-32768,    57,
+    57,    57,   125,-32768,   105,     3,-32768,-32768,     5,-32768,
+    42,    42,-32768,   109,    42,    42,    42,    42,    42,    42,
+    42,    42,    42,    42,    42,    42,    18,   125,    71,-32768,
+   118,-32768,    88,    20,    31,-32768,-32768,   110,    94,-32768,
+    46,    90,-32768,   137,   137,   137,   137,   137,   137,    41,
+    41,    41,-32768,-32768,-32768,-32768,    42,-32768,    57,   140,
+-32768,     3,-32768,    21,    82,-32768,-32768,   125,-32768,    82,
+-32768,   111,   138,-32768,-32768,-32768,    21,   139,-32768,   178,
+   181,-32768
+};
+
+static const short yypgoto[] = {-32768,
+-32768,  -126,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+   129,-32768,    52,-32768,-32768,    -5,-32768,-32768,  -122,-32768,
+   -65,-32768,-32768,-32768,-32768,-32768,-32768,   165,-32768,-32768,
+-32768,   104,   -35,-32768,-32768
+};
+
+
+#define	YYLAST		185
+
+
+static const short yytable[] = {    10,
+    63,    65,    69,    14,   100,   101,   102,   142,   -73,   104,
+     1,    16,   143,    73,    17,    27,    28,   144,    79,    80,
+   148,    81,    70,     2,    82,    83,    84,     5,     8,    66,
+    29,    99,    67,    85,    86,    87,    88,    89,    90,    91,
+    92,    93,    94,    95,    96,     8,   112,     4,   110,   114,
+   115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
+   125,   126,   127,   139,    55,    56,    57,    58,    59,    60,
+    35,   132,    12,    36,   133,    37,    29,    61,    94,    95,
+    96,    26,    38,    20,    62,    15,    21,    22,    23,   136,
+   127,   138,    21,    22,    23,    19,    32,    33,   131,    85,
+    86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
+    96,    34,    51,    71,    72,    54,    74,   128,    85,    86,
+    87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
+    75,    76,   103,   129,   130,   135,   137,    85,    86,    87,
+    88,    89,    90,    91,    92,    93,    94,    95,    96,   140,
+   134,   145,   113,    85,    86,    87,    88,    89,    90,    91,
+    92,    93,    94,    95,    96,-32768,-32768,-32768,-32768,-32768,
+-32768,    91,    92,    93,    94,    95,    96,   151,   146,   149,
+   152,    78,    31,   141,   111
+};
+
+static const short yycheck[] = {     5,
+    36,    37,    21,     9,    70,    71,    72,   134,    22,     7,
+     3,    42,   135,    49,    45,     5,     6,   140,    54,    55,
+   147,    43,    41,    26,    46,    61,    62,     7,    26,    43,
+    20,    67,    46,    29,    30,    31,    32,    33,    34,    35,
+    36,    37,    38,    39,    40,    26,    82,    41,    44,    85,
+    86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
+    96,    44,    45,   129,    23,    24,    25,    26,    27,    28,
+    14,    41,     4,    17,    44,    19,    20,    36,    38,    39,
+    40,    26,    26,     8,    43,    41,    11,    12,    13,    44,
+    45,   127,    11,    12,    13,    41,    46,    26,   104,    29,
+    30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
+    40,    26,    28,    15,    18,    43,    22,    47,    29,    30,
+    31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
+     9,    43,    28,    16,    47,    42,    47,    29,    30,    31,
+    32,    33,    34,    35,    36,    37,    38,    39,    40,    10,
+    41,    41,    44,    29,    30,    31,    32,    33,    34,    35,
+    36,    37,    38,    39,    40,    29,    30,    31,    32,    33,
+    34,    35,    36,    37,    38,    39,    40,     0,    41,    41,
+     0,    53,    18,   132,    81
+};
+#define YYPURE 1
+
+#line 751 "parse.y.in"
+
+
+void
+yyerror(char* s) {
+    fprintf(stderr,"%s\n",s);
+    }
+
+int
+main() {
+    printf("1\t");
+    yyparse();
+    return 1;
+    }
 exit 0

Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/bison/output.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/bison/output.c?rev=338773&r1=338772&r2=338773&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/bison/output.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/bison/output.c Thu Aug  2 15:05:04 2018
@@ -217,9 +217,9 @@ void output(void)
   /* output_token_defines(ftable);	JF put out token defines FIRST */
   if (!semantic_parser)		/* JF Put out other stuff */
     {
-      rewind(fattrs);
-      while ((c=getc(fattrs))!=EOF)
-        putc(c,ftable);
+      // rewind(fattrs);
+      // while ((c=getc(fattrs))!=EOF)
+      //   putc(c,ftable);
     }
 
   if (debugflag)




More information about the llvm-commits mailing list