1 /* A Bison parser, made by GNU Bison 2.4.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
6 2009, 2010 Free Software Foundation, Inc.
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
37 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
44 /* Identify Bison output. */
48 #define YYBISON_VERSION "2.4.3"
51 #define YYSKELETON_NAME "yacc.c"
62 /* Using locations. */
63 #define YYLSP_NEEDED 0
65 /* Substitute the variable and function names. */
66 #define yyparse perf_pmu_parse
67 #define yylex perf_pmu_lex
68 #define yyerror perf_pmu_error
69 #define yylval perf_pmu_lval
70 #define yychar perf_pmu_char
71 #define yydebug perf_pmu_debug
72 #define yynerrs perf_pmu_nerrs
75 /* Copy the first part of user declarations. */
77 /* Line 189 of yacc.c */
81 #include <linux/compiler.h>
82 #include <linux/list.h>
83 #include <linux/bitmap.h>
87 extern int perf_pmu_lex (void);
89 #define ABORT_ON(val) \
97 /* Line 189 of yacc.c */
98 #line 99 "util/pmu-bison.c"
100 /* Enabling traces. */
105 /* Enabling verbose error messages. */
106 #ifdef YYERROR_VERBOSE
107 # undef YYERROR_VERBOSE
108 # define YYERROR_VERBOSE 1
110 # define YYERROR_VERBOSE 0
113 /* Enabling the token table. */
114 #ifndef YYTOKEN_TABLE
115 # define YYTOKEN_TABLE 0
122 /* Put the tokens into the symbol table, so that GDB and other debuggers
135 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
136 typedef union YYSTYPE
139 /* Line 214 of yacc.c */
140 #line 31 "util/pmu.y"
143 DECLARE_BITMAP(bits
, PERF_PMU_FORMAT_BITS
);
147 /* Line 214 of yacc.c */
148 #line 149 "util/pmu-bison.c"
150 # define YYSTYPE_IS_TRIVIAL 1
151 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
152 # define YYSTYPE_IS_DECLARED 1
156 /* Copy the second part of user declarations. */
159 /* Line 264 of yacc.c */
160 #line 161 "util/pmu-bison.c"
167 typedef YYTYPE_UINT8 yytype_uint8
;
169 typedef unsigned char yytype_uint8
;
173 typedef YYTYPE_INT8 yytype_int8
;
174 #elif (defined __STDC__ || defined __C99__FUNC__ \
175 || defined __cplusplus || defined _MSC_VER)
176 typedef signed char yytype_int8
;
178 typedef short int yytype_int8
;
182 typedef YYTYPE_UINT16 yytype_uint16
;
184 typedef unsigned short int yytype_uint16
;
188 typedef YYTYPE_INT16 yytype_int16
;
190 typedef short int yytype_int16
;
194 # ifdef __SIZE_TYPE__
195 # define YYSIZE_T __SIZE_TYPE__
196 # elif defined size_t
197 # define YYSIZE_T size_t
198 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
199 || defined __cplusplus || defined _MSC_VER)
200 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
201 # define YYSIZE_T size_t
203 # define YYSIZE_T unsigned int
207 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
210 # if defined YYENABLE_NLS && YYENABLE_NLS
212 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
213 # define YY_(msgid) dgettext ("bison-runtime", msgid)
217 # define YY_(msgid) msgid
221 /* Suppress unused-variable warnings by "using" E. */
222 #if ! defined lint || defined __GNUC__
223 # define YYUSE(e) ((void) (e))
225 # define YYUSE(e) /* empty */
228 /* Identity function, used to suppress warnings about constant conditions. */
232 #if (defined __STDC__ || defined __C99__FUNC__ \
233 || defined __cplusplus || defined _MSC_VER)
246 #if ! defined yyoverflow || YYERROR_VERBOSE
248 /* The parser invokes alloca or malloc; define the necessary symbols. */
250 # ifdef YYSTACK_USE_ALLOCA
251 # if YYSTACK_USE_ALLOCA
253 # define YYSTACK_ALLOC __builtin_alloca
254 # elif defined __BUILTIN_VA_ARG_INCR
255 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
257 # define YYSTACK_ALLOC __alloca
258 # elif defined _MSC_VER
259 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
260 # define alloca _alloca
262 # define YYSTACK_ALLOC alloca
263 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
264 || defined __cplusplus || defined _MSC_VER)
265 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
274 # ifdef YYSTACK_ALLOC
275 /* Pacify GCC's `empty if-body' warning. */
276 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
277 # ifndef YYSTACK_ALLOC_MAXIMUM
278 /* The OS might guarantee only one guard page at the bottom of the stack,
279 and a page size can be as small as 4096 bytes. So we cannot safely
280 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
281 to allow for a few compiler-allocated temporary stack slots. */
282 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
285 # define YYSTACK_ALLOC YYMALLOC
286 # define YYSTACK_FREE YYFREE
287 # ifndef YYSTACK_ALLOC_MAXIMUM
288 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
290 # if (defined __cplusplus && ! defined _STDLIB_H \
291 && ! ((defined YYMALLOC || defined malloc) \
292 && (defined YYFREE || defined free)))
293 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
299 # define YYMALLOC malloc
300 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
301 || defined __cplusplus || defined _MSC_VER)
302 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
307 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
308 || defined __cplusplus || defined _MSC_VER)
309 void free (void *); /* INFRINGES ON USER NAME SPACE */
313 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
316 #if (! defined yyoverflow \
317 && (! defined __cplusplus \
318 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
320 /* A type that is properly aligned for any stack member. */
323 yytype_int16 yyss_alloc
;
327 /* The size of the maximum gap between one aligned stack and the next. */
328 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
330 /* The size of an array large to enough to hold all stacks, each with
332 # define YYSTACK_BYTES(N) \
333 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
334 + YYSTACK_GAP_MAXIMUM)
336 /* Copy COUNT objects from FROM to TO. The source and destination do
339 # if defined __GNUC__ && 1 < __GNUC__
340 # define YYCOPY(To, From, Count) \
341 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
343 # define YYCOPY(To, From, Count) \
347 for (yyi = 0; yyi < (Count); yyi++) \
348 (To)[yyi] = (From)[yyi]; \
354 /* Relocate STACK from its old location to the new one. The
355 local variables YYSIZE and YYSTACKSIZE give the old and new number of
356 elements in the stack, and YYPTR gives the new location of the
357 stack. Advance YYPTR to a properly aligned location for the next
359 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
362 YYSIZE_T yynewbytes; \
363 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
364 Stack = &yyptr->Stack_alloc; \
365 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
366 yyptr += yynewbytes / sizeof (*yyptr); \
372 /* YYFINAL -- State number of the termination state. */
374 /* YYLAST -- Last index in YYTABLE. */
377 /* YYNTOKENS -- Number of terminals. */
379 /* YYNNTS -- Number of nonterminals. */
381 /* YYNRULES -- Number of rules. */
383 /* YYNRULES -- Number of states. */
386 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
388 #define YYMAXUTOK 262
390 #define YYTRANSLATE(YYX) \
391 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
393 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
394 static const yytype_uint8 yytranslate
[] =
396 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 9, 10, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 8, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
426 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
428 static const yytype_uint8 yyprhs
[] =
430 0, 0, 3, 6, 8, 12, 16, 20, 24, 26,
434 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
435 static const yytype_int8 yyrhs
[] =
437 12, 0, -1, 12, 13, -1, 13, -1, 3, 8,
438 14, -1, 4, 8, 14, -1, 5, 8, 14, -1,
439 14, 9, 15, -1, 15, -1, 6, 10, 6, -1,
443 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
444 static const yytype_uint8 yyrline
[] =
446 0, 39, 39, 41, 44, 51, 58, 66, 71, 77,
451 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
452 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
453 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
454 static const char *const yytname
[] =
456 "$end", "error", "$undefined", "PP_CONFIG", "PP_CONFIG1", "PP_CONFIG2",
457 "PP_VALUE", "PP_ERROR", "':'", "','", "'-'", "$accept", "format",
458 "format_term", "bits", "bit_term", 0
463 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
465 static const yytype_uint16 yytoknum
[] =
467 0, 256, 257, 258, 259, 260, 261, 262, 58, 44,
472 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
473 static const yytype_uint8 yyr1
[] =
475 0, 11, 12, 12, 13, 13, 13, 14, 14, 15,
479 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
480 static const yytype_uint8 yyr2
[] =
482 0, 2, 2, 1, 3, 3, 3, 3, 1, 3,
486 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
487 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
488 means the default is an error. */
489 static const yytype_uint8 yydefact
[] =
491 0, 0, 0, 0, 0, 3, 0, 0, 0, 1,
492 2, 10, 4, 8, 5, 6, 0, 0, 9, 7
495 /* YYDEFGOTO[NTERM-NUM]. */
496 static const yytype_int8 yydefgoto
[] =
501 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
503 #define YYPACT_NINF -7
504 static const yytype_int8 yypact
[] =
506 3, 1, 2, 4, 0, -7, 5, 5, 5, -7,
507 -7, 6, 8, -7, 8, 8, 7, 5, -7, -7
510 /* YYPGOTO[NTERM-NUM]. */
511 static const yytype_int8 yypgoto
[] =
516 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
517 positive, shift that token. If negative, reduce the rule which
518 number is the opposite. If zero, do what YYDEFACT says.
519 If YYTABLE_NINF, syntax error. */
520 #define YYTABLE_NINF -1
521 static const yytype_uint8 yytable
[] =
523 9, 14, 15, 1, 2, 3, 1, 2, 3, 6,
524 7, 11, 8, 18, 10, 19, 16, 17
527 static const yytype_uint8 yycheck
[] =
529 0, 7, 8, 3, 4, 5, 3, 4, 5, 8,
530 8, 6, 8, 6, 4, 17, 10, 9
533 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
534 symbol of state STATE-NUM. */
535 static const yytype_uint8 yystos
[] =
537 0, 3, 4, 5, 12, 13, 8, 8, 8, 0,
538 13, 6, 14, 15, 14, 14, 10, 9, 6, 15
541 #define yyerrok (yyerrstatus = 0)
542 #define yyclearin (yychar = YYEMPTY)
546 #define YYACCEPT goto yyacceptlab
547 #define YYABORT goto yyabortlab
548 #define YYERROR goto yyerrorlab
551 /* Like YYERROR except do call yyerror. This remains here temporarily
552 to ease the transition to the new meaning of YYERROR, for GCC.
553 Once GCC version 2 has supplanted version 1, this can go. However,
554 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
555 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
558 #define YYFAIL goto yyerrlab
560 /* This is here to suppress warnings from the GCC cpp's
561 -Wunused-macros. Normally we don't worry about that warning, but
562 some users do, and we want to make it easy for users to remove
563 YYFAIL uses, which will produce warnings from Bison 2.5. */
566 #define YYRECOVERING() (!!yyerrstatus)
568 #define YYBACKUP(Token, Value) \
570 if (yychar == YYEMPTY && yylen == 1) \
574 yytoken = YYTRANSLATE (yychar); \
580 yyerror (format, name, YY_("syntax error: cannot back up")); \
587 #define YYERRCODE 256
590 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
591 If N is 0, then set CURRENT to the empty location which ends
592 the previous symbol: RHS[0] (always defined). */
594 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
595 #ifndef YYLLOC_DEFAULT
596 # define YYLLOC_DEFAULT(Current, Rhs, N) \
600 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
601 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
602 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
603 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
607 (Current).first_line = (Current).last_line = \
608 YYRHSLOC (Rhs, 0).last_line; \
609 (Current).first_column = (Current).last_column = \
610 YYRHSLOC (Rhs, 0).last_column; \
616 /* YY_LOCATION_PRINT -- Print the location on the stream.
617 This macro was not mandated originally: define only if we know
618 we won't break user code: when these are the locations we know. */
620 #ifndef YY_LOCATION_PRINT
621 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
622 # define YY_LOCATION_PRINT(File, Loc) \
623 fprintf (File, "%d.%d-%d.%d", \
624 (Loc).first_line, (Loc).first_column, \
625 (Loc).last_line, (Loc).last_column)
627 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
632 /* YYLEX -- calling `yylex' with the right arguments. */
635 # define YYLEX yylex (YYLEX_PARAM)
637 # define YYLEX yylex ()
640 /* Enable debugging if requested. */
644 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
645 # define YYFPRINTF fprintf
648 # define YYDPRINTF(Args) \
654 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
658 YYFPRINTF (stderr, "%s ", Title); \
659 yy_symbol_print (stderr, \
660 Type, Value, format, name); \
661 YYFPRINTF (stderr, "\n"); \
666 /*--------------------------------.
667 | Print this symbol on YYOUTPUT. |
668 `--------------------------------*/
671 #if (defined __STDC__ || defined __C99__FUNC__ \
672 || defined __cplusplus || defined _MSC_VER)
674 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, struct list_head
*format
, char *name
)
677 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, format
, name
)
680 YYSTYPE
const * const yyvaluep
;
681 struct list_head
*format
;
690 if (yytype
< YYNTOKENS
)
691 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
703 /*--------------------------------.
704 | Print this symbol on YYOUTPUT. |
705 `--------------------------------*/
707 #if (defined __STDC__ || defined __C99__FUNC__ \
708 || defined __cplusplus || defined _MSC_VER)
710 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, struct list_head
*format
, char *name
)
713 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, format
, name
)
716 YYSTYPE
const * const yyvaluep
;
717 struct list_head
*format
;
721 if (yytype
< YYNTOKENS
)
722 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
724 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
726 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, format
, name
);
727 YYFPRINTF (yyoutput
, ")");
730 /*------------------------------------------------------------------.
731 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
733 `------------------------------------------------------------------*/
735 #if (defined __STDC__ || defined __C99__FUNC__ \
736 || defined __cplusplus || defined _MSC_VER)
738 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
741 yy_stack_print (yybottom
, yytop
)
742 yytype_int16
*yybottom
;
746 YYFPRINTF (stderr
, "Stack now");
747 for (; yybottom
<= yytop
; yybottom
++)
749 int yybot
= *yybottom
;
750 YYFPRINTF (stderr
, " %d", yybot
);
752 YYFPRINTF (stderr
, "\n");
755 # define YY_STACK_PRINT(Bottom, Top) \
758 yy_stack_print ((Bottom), (Top)); \
762 /*------------------------------------------------.
763 | Report that the YYRULE is going to be reduced. |
764 `------------------------------------------------*/
766 #if (defined __STDC__ || defined __C99__FUNC__ \
767 || defined __cplusplus || defined _MSC_VER)
769 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
, struct list_head
*format
, char *name
)
772 yy_reduce_print (yyvsp
, yyrule
, format
, name
)
775 struct list_head
*format
;
779 int yynrhs
= yyr2
[yyrule
];
781 unsigned long int yylno
= yyrline
[yyrule
];
782 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
784 /* The symbols being reduced. */
785 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
787 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
788 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
789 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
791 YYFPRINTF (stderr
, "\n");
795 # define YY_REDUCE_PRINT(Rule) \
798 yy_reduce_print (yyvsp, Rule, format, name); \
801 /* Nonzero means print parse trace. It is left uninitialized so that
802 multiple parsers can coexist. */
805 # define YYDPRINTF(Args)
806 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
807 # define YY_STACK_PRINT(Bottom, Top)
808 # define YY_REDUCE_PRINT(Rule)
809 #endif /* !YYDEBUG */
812 /* YYINITDEPTH -- initial size of the parser's stacks. */
814 # define YYINITDEPTH 200
817 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
818 if the built-in stack extension method is used).
820 Do not make this value too large; the results are undefined if
821 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
822 evaluated with infinite-precision integer arithmetic. */
825 # define YYMAXDEPTH 10000
833 # if defined __GLIBC__ && defined _STRING_H
834 # define yystrlen strlen
836 /* Return the length of YYSTR. */
837 #if (defined __STDC__ || defined __C99__FUNC__ \
838 || defined __cplusplus || defined _MSC_VER)
840 yystrlen (const char *yystr
)
848 for (yylen
= 0; yystr
[yylen
]; yylen
++)
856 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
857 # define yystpcpy stpcpy
859 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
861 #if (defined __STDC__ || defined __C99__FUNC__ \
862 || defined __cplusplus || defined _MSC_VER)
864 yystpcpy (char *yydest
, const char *yysrc
)
867 yystpcpy (yydest
, yysrc
)
873 const char *yys
= yysrc
;
875 while ((*yyd
++ = *yys
++) != '\0')
884 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
885 quotes and backslashes, so that it's suitable for yyerror. The
886 heuristic is that double-quoting is unnecessary unless the string
887 contains an apostrophe, a comma, or backslash (other than
888 backslash-backslash). YYSTR is taken from yytname. If YYRES is
889 null, do not copy; instead, return the length of what the result
892 yytnamerr (char *yyres
, const char *yystr
)
897 char const *yyp
= yystr
;
904 goto do_not_strip_quotes
;
908 goto do_not_strip_quotes
;
921 do_not_strip_quotes
: ;
925 return yystrlen (yystr
);
927 return yystpcpy (yyres
, yystr
) - yyres
;
931 /* Copy into YYRESULT an error message about the unexpected token
932 YYCHAR while in state YYSTATE. Return the number of bytes copied,
933 including the terminating null byte. If YYRESULT is null, do not
934 copy anything; just return the number of bytes that would be
935 copied. As a special case, return 0 if an ordinary "syntax error"
936 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
939 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
941 int yyn
= yypact
[yystate
];
943 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
947 int yytype
= YYTRANSLATE (yychar
);
948 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
949 YYSIZE_T yysize
= yysize0
;
951 int yysize_overflow
= 0;
952 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
953 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
957 /* This is so xgettext sees the translatable formats that are
958 constructed on the fly. */
959 YY_("syntax error, unexpected %s");
960 YY_("syntax error, unexpected %s, expecting %s");
961 YY_("syntax error, unexpected %s, expecting %s or %s");
962 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
963 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
967 static char const yyunexpected
[] = "syntax error, unexpected %s";
968 static char const yyexpecting
[] = ", expecting %s";
969 static char const yyor
[] = " or %s";
970 char yyformat
[sizeof yyunexpected
971 + sizeof yyexpecting
- 1
972 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
973 * (sizeof yyor
- 1))];
974 char const *yyprefix
= yyexpecting
;
976 /* Start YYX at -YYN if negative to avoid negative indexes in
978 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
980 /* Stay within bounds of both yycheck and yytname. */
981 int yychecklim
= YYLAST
- yyn
+ 1;
982 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
985 yyarg
[0] = yytname
[yytype
];
986 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
988 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
989 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
991 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
995 yyformat
[sizeof yyunexpected
- 1] = '\0';
998 yyarg
[yycount
++] = yytname
[yyx
];
999 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1000 yysize_overflow
|= (yysize1
< yysize
);
1002 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1006 yyf
= YY_(yyformat
);
1007 yysize1
= yysize
+ yystrlen (yyf
);
1008 yysize_overflow
|= (yysize1
< yysize
);
1011 if (yysize_overflow
)
1012 return YYSIZE_MAXIMUM
;
1016 /* Avoid sprintf, as that infringes on the user's name space.
1017 Don't have undefined behavior even if the translation
1018 produced a string with the wrong number of "%s"s. */
1019 char *yyp
= yyresult
;
1021 while ((*yyp
= *yyf
) != '\0')
1023 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1025 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1038 #endif /* YYERROR_VERBOSE */
1041 /*-----------------------------------------------.
1042 | Release the memory associated to this symbol. |
1043 `-----------------------------------------------*/
1046 #if (defined __STDC__ || defined __C99__FUNC__ \
1047 || defined __cplusplus || defined _MSC_VER)
1049 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, struct list_head
*format
, char *name
)
1052 yydestruct (yymsg
, yytype
, yyvaluep
, format
, name
)
1056 struct list_head
*format
;
1066 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1076 /* Prevent warnings from -Wmissing-prototypes. */
1077 #ifdef YYPARSE_PARAM
1078 #if defined __STDC__ || defined __cplusplus
1079 int yyparse (void *YYPARSE_PARAM
);
1083 #else /* ! YYPARSE_PARAM */
1084 #if defined __STDC__ || defined __cplusplus
1085 int yyparse (struct list_head
*format
, char *name
);
1089 #endif /* ! YYPARSE_PARAM */
1092 /* The lookahead symbol. */
1095 /* The semantic value of the lookahead symbol. */
1098 /* Number of syntax errors so far. */
1103 /*-------------------------.
1104 | yyparse or yypush_parse. |
1105 `-------------------------*/
1107 #ifdef YYPARSE_PARAM
1108 #if (defined __STDC__ || defined __C99__FUNC__ \
1109 || defined __cplusplus || defined _MSC_VER)
1111 yyparse (void *YYPARSE_PARAM
)
1114 yyparse (YYPARSE_PARAM
)
1115 void *YYPARSE_PARAM
;
1117 #else /* ! YYPARSE_PARAM */
1118 #if (defined __STDC__ || defined __C99__FUNC__ \
1119 || defined __cplusplus || defined _MSC_VER)
1121 yyparse (struct list_head
*format
, char *name
)
1124 yyparse (format
, name
)
1125 struct list_head
*format
;
1133 /* Number of tokens to shift before error messages enabled. */
1136 /* The stacks and their tools:
1137 `yyss': related to states.
1138 `yyvs': related to semantic values.
1140 Refer to the stacks thru separate pointers, to allow yyoverflow
1141 to reallocate them elsewhere. */
1143 /* The state stack. */
1144 yytype_int16 yyssa
[YYINITDEPTH
];
1146 yytype_int16
*yyssp
;
1148 /* The semantic value stack. */
1149 YYSTYPE yyvsa
[YYINITDEPTH
];
1153 YYSIZE_T yystacksize
;
1157 /* Lookahead token as an internal (translated) token number. */
1159 /* The variables used to return semantic value and location from the
1164 /* Buffer for error messages, and its allocated size. */
1166 char *yymsg
= yymsgbuf
;
1167 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1170 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1172 /* The number of symbols on the RHS of the reduced rule.
1173 Keep to zero when no symbol should be popped. */
1179 yystacksize
= YYINITDEPTH
;
1181 YYDPRINTF ((stderr
, "Starting parse\n"));
1186 yychar
= YYEMPTY
; /* Cause a token to be read. */
1188 /* Initialize stack pointers.
1189 Waste one element of value and location stack
1190 so that they stay on the same level as the state stack.
1191 The wasted elements are never initialized. */
1197 /*------------------------------------------------------------.
1198 | yynewstate -- Push a new state, which is found in yystate. |
1199 `------------------------------------------------------------*/
1201 /* In all cases, when you get here, the value and location stacks
1202 have just been pushed. So pushing a state here evens the stacks. */
1208 if (yyss
+ yystacksize
- 1 <= yyssp
)
1210 /* Get the current used size of the three stacks, in elements. */
1211 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1215 /* Give user a chance to reallocate the stack. Use copies of
1216 these so that the &'s don't force the real ones into
1218 YYSTYPE
*yyvs1
= yyvs
;
1219 yytype_int16
*yyss1
= yyss
;
1221 /* Each stack pointer address is followed by the size of the
1222 data in use in that stack, in bytes. This used to be a
1223 conditional around just the two extra args, but that might
1224 be undefined if yyoverflow is a macro. */
1225 yyoverflow (YY_("memory exhausted"),
1226 &yyss1
, yysize
* sizeof (*yyssp
),
1227 &yyvs1
, yysize
* sizeof (*yyvsp
),
1233 #else /* no yyoverflow */
1234 # ifndef YYSTACK_RELOCATE
1235 goto yyexhaustedlab
;
1237 /* Extend the stack our own way. */
1238 if (YYMAXDEPTH
<= yystacksize
)
1239 goto yyexhaustedlab
;
1241 if (YYMAXDEPTH
< yystacksize
)
1242 yystacksize
= YYMAXDEPTH
;
1245 yytype_int16
*yyss1
= yyss
;
1246 union yyalloc
*yyptr
=
1247 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1249 goto yyexhaustedlab
;
1250 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1251 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1252 # undef YYSTACK_RELOCATE
1254 YYSTACK_FREE (yyss1
);
1257 #endif /* no yyoverflow */
1259 yyssp
= yyss
+ yysize
- 1;
1260 yyvsp
= yyvs
+ yysize
- 1;
1262 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1263 (unsigned long int) yystacksize
));
1265 if (yyss
+ yystacksize
- 1 <= yyssp
)
1269 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1271 if (yystate
== YYFINAL
)
1281 /* Do appropriate processing given the current state. Read a
1282 lookahead token if we need one and don't already have one. */
1284 /* First try to decide what to do without reference to lookahead token. */
1285 yyn
= yypact
[yystate
];
1286 if (yyn
== YYPACT_NINF
)
1289 /* Not known => get a lookahead token if don't already have one. */
1291 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1292 if (yychar
== YYEMPTY
)
1294 YYDPRINTF ((stderr
, "Reading a token: "));
1298 if (yychar
<= YYEOF
)
1300 yychar
= yytoken
= YYEOF
;
1301 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1305 yytoken
= YYTRANSLATE (yychar
);
1306 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1309 /* If the proper action on seeing token YYTOKEN is to reduce or to
1310 detect an error, take that action. */
1312 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1317 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1323 /* Count tokens shifted since error; after three, turn off error
1328 /* Shift the lookahead token. */
1329 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1331 /* Discard the shifted token. */
1340 /*-----------------------------------------------------------.
1341 | yydefault -- do the default action for the current state. |
1342 `-----------------------------------------------------------*/
1344 yyn
= yydefact
[yystate
];
1350 /*-----------------------------.
1351 | yyreduce -- Do a reduction. |
1352 `-----------------------------*/
1354 /* yyn is the number of a rule to reduce with. */
1357 /* If YYLEN is nonzero, implement the default value of the action:
1360 Otherwise, the following line sets YYVAL to garbage.
1361 This behavior is undocumented and Bison
1362 users should not rely upon it. Assigning to YYVAL
1363 unconditionally makes the parser a bit smaller, and it avoids a
1364 GCC warning that YYVAL may be used uninitialized. */
1365 yyval
= yyvsp
[1-yylen
];
1368 YY_REDUCE_PRINT (yyn
);
1373 /* Line 1464 of yacc.c */
1374 #line 45 "util/pmu.y"
1376 ABORT_ON(perf_pmu__new_format(format
, name
,
1377 PERF_PMU_FORMAT_VALUE_CONFIG
,
1378 (yyvsp
[(3) - (3)].bits
)));
1384 /* Line 1464 of yacc.c */
1385 #line 52 "util/pmu.y"
1387 ABORT_ON(perf_pmu__new_format(format
, name
,
1388 PERF_PMU_FORMAT_VALUE_CONFIG1
,
1389 (yyvsp
[(3) - (3)].bits
)));
1395 /* Line 1464 of yacc.c */
1396 #line 59 "util/pmu.y"
1398 ABORT_ON(perf_pmu__new_format(format
, name
,
1399 PERF_PMU_FORMAT_VALUE_CONFIG2
,
1400 (yyvsp
[(3) - (3)].bits
)));
1406 /* Line 1464 of yacc.c */
1407 #line 67 "util/pmu.y"
1409 bitmap_or((yyval
.bits
), (yyvsp
[(1) - (3)].bits
), (yyvsp
[(3) - (3)].bits
), 64);
1415 /* Line 1464 of yacc.c */
1416 #line 72 "util/pmu.y"
1418 memcpy((yyval
.bits
), (yyvsp
[(1) - (1)].bits
), sizeof((yyvsp
[(1) - (1)].bits
)));
1424 /* Line 1464 of yacc.c */
1425 #line 78 "util/pmu.y"
1427 perf_pmu__set_format((yyval
.bits
), (yyvsp
[(1) - (3)].num
), (yyvsp
[(3) - (3)].num
));
1433 /* Line 1464 of yacc.c */
1434 #line 83 "util/pmu.y"
1436 perf_pmu__set_format((yyval
.bits
), (yyvsp
[(1) - (1)].num
), 0);
1442 /* Line 1464 of yacc.c */
1443 #line 1444 "util/pmu-bison.c"
1446 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
1450 YY_STACK_PRINT (yyss
, yyssp
);
1454 /* Now `shift' the result of the reduction. Determine what state
1455 that goes to, based on the state we popped back to and the rule
1456 number reduced by. */
1460 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1461 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1462 yystate
= yytable
[yystate
];
1464 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1469 /*------------------------------------.
1470 | yyerrlab -- here on detecting error |
1471 `------------------------------------*/
1473 /* If not already recovering from an error, report this error. */
1477 #if ! YYERROR_VERBOSE
1478 yyerror (format
, name
, YY_("syntax error"));
1481 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
1482 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
1484 YYSIZE_T yyalloc
= 2 * yysize
;
1485 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
1486 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
1487 if (yymsg
!= yymsgbuf
)
1488 YYSTACK_FREE (yymsg
);
1489 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
1491 yymsg_alloc
= yyalloc
;
1495 yymsg_alloc
= sizeof yymsgbuf
;
1499 if (0 < yysize
&& yysize
<= yymsg_alloc
)
1501 (void) yysyntax_error (yymsg
, yystate
, yychar
);
1502 yyerror (format
, name
, yymsg
);
1506 yyerror (format
, name
, YY_("syntax error"));
1508 goto yyexhaustedlab
;
1516 if (yyerrstatus
== 3)
1518 /* If just tried and failed to reuse lookahead token after an
1519 error, discard it. */
1521 if (yychar
<= YYEOF
)
1523 /* Return failure if at end of input. */
1524 if (yychar
== YYEOF
)
1529 yydestruct ("Error: discarding",
1530 yytoken
, &yylval
, format
, name
);
1535 /* Else will try to reuse lookahead token after shifting the error
1540 /*---------------------------------------------------.
1541 | yyerrorlab -- error raised explicitly by YYERROR. |
1542 `---------------------------------------------------*/
1545 /* Pacify compilers like GCC when the user code never invokes
1546 YYERROR and the label yyerrorlab therefore never appears in user
1548 if (/*CONSTCOND*/ 0)
1551 /* Do not reclaim the symbols of the rule which action triggered
1555 YY_STACK_PRINT (yyss
, yyssp
);
1560 /*-------------------------------------------------------------.
1561 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1562 `-------------------------------------------------------------*/
1564 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1568 yyn
= yypact
[yystate
];
1569 if (yyn
!= YYPACT_NINF
)
1572 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1580 /* Pop the current state because it cannot handle the error token. */
1585 yydestruct ("Error: popping",
1586 yystos
[yystate
], yyvsp
, format
, name
);
1589 YY_STACK_PRINT (yyss
, yyssp
);
1595 /* Shift the error token. */
1596 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1602 /*-------------------------------------.
1603 | yyacceptlab -- YYACCEPT comes here. |
1604 `-------------------------------------*/
1609 /*-----------------------------------.
1610 | yyabortlab -- YYABORT comes here. |
1611 `-----------------------------------*/
1616 #if !defined(yyoverflow) || YYERROR_VERBOSE
1617 /*-------------------------------------------------.
1618 | yyexhaustedlab -- memory exhaustion comes here. |
1619 `-------------------------------------------------*/
1621 yyerror (format
, name
, YY_("memory exhausted"));
1627 if (yychar
!= YYEMPTY
)
1628 yydestruct ("Cleanup: discarding lookahead",
1629 yytoken
, &yylval
, format
, name
);
1630 /* Do not reclaim the symbols of the rule which action triggered
1631 this YYABORT or YYACCEPT. */
1633 YY_STACK_PRINT (yyss
, yyssp
);
1634 while (yyssp
!= yyss
)
1636 yydestruct ("Cleanup: popping",
1637 yystos
[*yyssp
], yyvsp
, format
, name
);
1642 YYSTACK_FREE (yyss
);
1645 if (yymsg
!= yymsgbuf
)
1646 YYSTACK_FREE (yymsg
);
1648 /* Make sure YYID is used. */
1649 return YYID (yyresult
);
1654 /* Line 1684 of yacc.c */
1655 #line 87 "util/pmu.y"
1658 void perf_pmu_error(struct list_head
*list __used
,
1660 char const *msg __used
)