diff --git a/lib/base/attribute.cpp b/lib/base/attribute.cpp index 99cb68e8f..dca82816a 100644 --- a/lib/base/attribute.cpp +++ b/lib/base/attribute.cpp @@ -104,6 +104,8 @@ void AttributeHolder::Bind(AttributeBase *boundAttribute) { ASSERT(m_OwnsAttribute); boundAttribute->Set(m_Attribute->Get()); + if (m_OwnsAttribute) + delete m_Attribute; m_Attribute = boundAttribute; m_OwnsAttribute = false; } diff --git a/lib/config/config_parser.cc b/lib/config/config_parser.cc index fd2826472..02641cbda 100644 --- a/lib/config/config_parser.cc +++ b/lib/config/config_parser.cc @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.7. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,21 +58,21 @@ /* Pull parsers. */ #define YYPULL 1 +/* Using locations. */ +#define YYLSP_NEEDED 1 /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 68 "config_parser.cc" -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr -# else -# define YY_NULL 0 -# endif -# endif +/* Line 268 of yacc.c */ +#line 71 "config_parser.cc" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -82,19 +82,14 @@ # define YYERROR_VERBOSE 1 #endif -/* In a future release of Bison, this section will be replaced - by #include "y.tab.h". */ -#ifndef YY_YY_CONFIG_PARSER_HH_INCLUDED -# define YY_YY_CONFIG_PARSER_HH_INCLUDED -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 #endif + /* "%code requires" blocks. */ -/* Line 387 of yacc.c */ + +/* Line 288 of yacc.c */ #line 1 "config_parser.yy" /****************************************************************************** @@ -139,8 +134,9 @@ using namespace icinga; -/* Line 387 of yacc.c */ -#line 144 "config_parser.cc" + +/* Line 288 of yacc.c */ +#line 140 "config_parser.cc" /* Tokens. */ #ifndef YYTOKENTYPE @@ -210,10 +206,12 @@ using namespace icinga; + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { -/* Line 387 of yacc.c */ + +/* Line 293 of yacc.c */ #line 53 "config_parser.yy" char *text; @@ -227,8 +225,9 @@ typedef union YYSTYPE Array *array; -/* Line 387 of yacc.c */ -#line 232 "config_parser.cc" + +/* Line 293 of yacc.c */ +#line 231 "config_parser.cc" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -249,24 +248,9 @@ typedef struct YYLTYPE #endif -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (ConfigCompiler *context); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - -#endif /* !YY_YY_CONFIG_PARSER_HH_INCLUDED */ - /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ + +/* Line 343 of yacc.c */ #line 111 "config_parser.yy" @@ -302,8 +286,9 @@ void ConfigCompiler::Compile(void) #define scanner (context->GetScanner()) -/* Line 390 of yacc.c */ -#line 307 "config_parser.cc" + +/* Line 343 of yacc.c */ +#line 292 "config_parser.cc" #ifdef short # undef short @@ -356,24 +341,24 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ -# define YY_(Msgid) Msgid +# define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YYUSE(e) ((void) (e)) #else -# define YYUSE(E) /* empty */ +# define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint -# define YYID(N) (N) +# define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) @@ -409,7 +394,6 @@ YYID (yyi) # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -503,20 +487,20 @@ union yyalloc #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do +/* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ while (YYID (0)) # endif # endif @@ -623,14 +607,14 @@ static const yytype_uint16 yyrline[] = 165, 171, 172, 179, 178, 208, 211, 218, 217, 229, 230, 232, 233, 234, 237, 242, 247, 254, 263, 264, 271, 272, 273, 274, 275, 276, 283, 283, 320, 321, - 326, 327, 330, 334, 341, 344, 349, 361, 364, 370, - 376, 380, 386, 389, 394, 405, 411, 425, 426, 427, - 428, 429, 435, 441, 445, 451, 454, 459, 470, 475, - 479, 483, 493, 494 + 326, 327, 330, 334, 341, 344, 350, 363, 366, 372, + 378, 382, 388, 391, 397, 409, 415, 429, 430, 431, + 432, 433, 439, 445, 449, 455, 458, 464, 476, 481, + 485, 489, 499, 500 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 1 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -654,7 +638,7 @@ static const char *const yytname[] = "$@3", "object_declaration", "attributes", "attribute", "object_inherits_list", "object_inherits_specifier", "expressionlist", "expressions", "expressions_inner", "expression", "operator", "array", - "array_items", "array_items_inner", "simplevalue", "value", YY_NULL + "array_items", "array_items_inner", "simplevalue", "value", 0 }; #endif @@ -764,10 +748,10 @@ static const yytype_int8 yytable[] = 83, 86, 73, 0, 93, 92, 85, 46, 91 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-70))) +#define yypact_value_is_default(yystate) \ + ((yystate) == (-70)) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(yytable_value) \ YYID (0) static const yytype_int8 yycheck[] = @@ -825,24 +809,23 @@ static const yytype_uint8 yystos[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ yyerror (&yylloc, context, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) -/* Error token number */ + #define YYTERROR 1 #define YYERRCODE 256 @@ -851,28 +834,27 @@ while (YYID (0)) If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ while (YYID (0)) #endif -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) - /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know @@ -880,46 +862,10 @@ while (YYID (0)) #ifndef YY_LOCATION_PRINT # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL - -/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ - -__attribute__((__unused__)) -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static unsigned -yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) -#else -static unsigned -yy_location_print_ (yyo, yylocp) - FILE *yyo; - YYLTYPE const * const yylocp; -#endif -{ - unsigned res = 0; - int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; - if (0 <= yylocp->first_line) - { - res += fprintf (yyo, "%d", yylocp->first_line); - if (0 <= yylocp->first_column) - res += fprintf (yyo, ".%d", yylocp->first_column); - } - if (0 <= yylocp->last_line) - { - if (yylocp->first_line < yylocp->last_line) - { - res += fprintf (yyo, "-%d", yylocp->last_line); - if (0 <= end_col) - res += fprintf (yyo, ".%d", end_col); - } - else if (0 <= end_col && yylocp->first_column < end_col) - res += fprintf (yyo, "-%d", end_col); - } - return res; - } - -# define YY_LOCATION_PRINT(File, Loc) \ - yy_location_print_ (File, &(Loc)) - +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -927,6 +873,7 @@ yy_location_print_ (yyo, yylocp) /* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) #else @@ -978,8 +925,6 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context) ConfigCompiler *context; #endif { - FILE *yyo = yyoutput; - YYUSE (yyo); if (!yyvaluep) return; YYUSE (yylocationp); @@ -993,7 +938,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context) switch (yytype) { default: - break; + break; } } @@ -1239,11 +1184,12 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = 0; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1303,13 +1249,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; } } } @@ -1329,12 +1273,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; if (*yymsg_alloc < yysize) { @@ -1398,11 +1340,25 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, context) { default: - break; + break; } } +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (ConfigCompiler *context); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ /*----------. @@ -1434,40 +1390,11 @@ yyparse (context) /* The lookahead symbol. */ int yychar; - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -/* Default value used for initialization, for pacifying older GCCs - or non-GCC compilers. */ -static YYSTYPE yyval_default; -# define YY_INITIAL_VALUE(Value) = Value -#endif -static YYLTYPE yyloc_default -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL - = { 1, 1, 1, 1 } -# endif -; -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); +YYSTYPE yylval; /* Location data for the lookahead symbol. */ -YYLTYPE yylloc = yyloc_default; - +YYLTYPE yylloc; /* Number of syntax errors so far. */ int yynerrs; @@ -1481,7 +1408,7 @@ YYLTYPE yylloc = yyloc_default; `yyvs': related to semantic values. `yyls': related to locations. - Refer to the stacks through separate pointers, to allow yyoverflow + Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1507,7 +1434,7 @@ YYLTYPE yylloc = yyloc_default; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1526,9 +1453,10 @@ YYLTYPE yylloc = yyloc_default; Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yylsp = yyls = yylsa; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1537,7 +1465,21 @@ YYLTYPE yylloc = yyloc_default; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - yylsp[0] = yylloc; + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + yylsp = yyls; + +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; +#endif + goto yysetstate; /*------------------------------------------------------------. @@ -1683,9 +1625,7 @@ yybackup: yychar = YYEMPTY; yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END *++yylsp = yylloc; goto yynewstate; @@ -1723,7 +1663,8 @@ yyreduce: switch (yyn) { case 8: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 155 "config_parser.yy" { context->HandleInclude((yyvsp[(2) - (2)].text), false, yylloc); @@ -1732,7 +1673,8 @@ yyreduce: break; case 9: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 160 "config_parser.yy" { context->HandleInclude((yyvsp[(2) - (2)].text), true, yylloc); @@ -1741,7 +1683,8 @@ yyreduce: break; case 10: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 166 "config_parser.yy" { context->HandleLibrary((yyvsp[(2) - (2)].text)); @@ -1750,7 +1693,8 @@ yyreduce: break; case 12: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 173 "config_parser.yy" { (yyval.text) = (yyvsp[(1) - (1)].text); @@ -1758,7 +1702,8 @@ yyreduce: break; case 13: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 179 "config_parser.yy" { String name = String((yyvsp[(3) - (3)].text)); @@ -1777,7 +1722,8 @@ yyreduce: break; case 14: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 194 "config_parser.yy" { TypeRuleList::Ptr ruleList = *(yyvsp[(6) - (6)].variant); @@ -1793,7 +1739,8 @@ yyreduce: break; case 15: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 208 "config_parser.yy" { (yyval.num) = 0; @@ -1801,7 +1748,8 @@ yyreduce: break; case 16: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 212 "config_parser.yy" { (yyval.num) = 1; @@ -1809,7 +1757,8 @@ yyreduce: break; case 17: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 218 "config_parser.yy" { m_RuleLists.push(boost::make_shared()); @@ -1817,7 +1766,8 @@ yyreduce: break; case 18: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 223 "config_parser.yy" { (yyval.variant) = new Value(m_RuleLists.top()); @@ -1826,7 +1776,8 @@ yyreduce: break; case 24: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 238 "config_parser.yy" { m_RuleLists.top()->AddRequire((yyvsp[(2) - (2)].text)); @@ -1835,7 +1786,8 @@ yyreduce: break; case 25: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 243 "config_parser.yy" { m_RuleLists.top()->SetValidator((yyvsp[(2) - (2)].text)); @@ -1844,7 +1796,8 @@ yyreduce: break; case 26: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 248 "config_parser.yy" { TypeRule rule((yyvsp[(2) - (3)].type), (yyvsp[(3) - (3)].text), TypeRuleList::Ptr(), yylloc); @@ -1855,7 +1808,8 @@ yyreduce: break; case 27: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 255 "config_parser.yy" { TypeRule rule((yyvsp[(2) - (4)].type), (yyvsp[(3) - (4)].text), *(yyvsp[(4) - (4)].variant), yylloc); @@ -1866,7 +1820,8 @@ yyreduce: break; case 29: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 265 "config_parser.yy" { m_Type->SetParent((yyvsp[(2) - (2)].text)); @@ -1875,7 +1830,8 @@ yyreduce: break; case 35: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 277 "config_parser.yy" { (yyval.type) = (yyvsp[(1) - (1)].type); @@ -1883,7 +1839,8 @@ yyreduce: break; case 36: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 283 "config_parser.yy" { m_Abstract = false; @@ -1892,7 +1849,8 @@ yyreduce: break; case 37: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 288 "config_parser.yy" { ConfigItemBuilder::Ptr item = boost::make_shared(yylloc); @@ -1927,7 +1885,8 @@ yyreduce: break; case 39: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 322 "config_parser.yy" { m_Abstract = true; @@ -1935,7 +1894,8 @@ yyreduce: break; case 42: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 331 "config_parser.yy" { m_Abstract = true; @@ -1943,7 +1903,8 @@ yyreduce: break; case 43: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 335 "config_parser.yy" { m_Local = true; @@ -1951,7 +1912,8 @@ yyreduce: break; case 44: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 341 "config_parser.yy" { (yyval.slist) = NULL; @@ -1959,17 +1921,20 @@ yyreduce: break; case 45: -/* Line 1792 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 345 "config_parser.yy" { (yyval.slist) = new std::vector(); (yyval.slist)->push_back((yyvsp[(1) - (1)].text)); + free((yyvsp[(1) - (1)].text)); } break; case 46: -/* Line 1792 of yacc.c */ -#line 350 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 351 "config_parser.yy" { if ((yyvsp[(1) - (3)].slist)) (yyval.slist) = (yyvsp[(1) - (3)].slist); @@ -1977,69 +1942,79 @@ yyreduce: (yyval.slist) = new std::vector(); (yyval.slist)->push_back((yyvsp[(3) - (3)].text)); + free((yyvsp[(3) - (3)].text)); } break; case 47: -/* Line 1792 of yacc.c */ -#line 361 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 363 "config_parser.yy" { (yyval.slist) = NULL; } break; case 48: -/* Line 1792 of yacc.c */ -#line 365 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 367 "config_parser.yy" { (yyval.slist) = (yyvsp[(2) - (2)].slist); } break; case 49: -/* Line 1792 of yacc.c */ -#line 371 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 373 "config_parser.yy" { (yyval.exprl) = (yyvsp[(2) - (3)].exprl); } break; case 50: -/* Line 1792 of yacc.c */ -#line 377 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 379 "config_parser.yy" { (yyval.exprl) = (yyvsp[(1) - (1)].exprl); } break; case 51: -/* Line 1792 of yacc.c */ -#line 381 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 383 "config_parser.yy" { (yyval.exprl) = (yyvsp[(1) - (2)].exprl); } break; case 52: -/* Line 1792 of yacc.c */ -#line 386 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 388 "config_parser.yy" { (yyval.exprl) = NULL; } break; case 53: -/* Line 1792 of yacc.c */ -#line 390 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 392 "config_parser.yy" { (yyval.exprl) = new ExpressionList(); (yyval.exprl)->AddExpression(*(yyvsp[(1) - (1)].expr)); + delete (yyvsp[(1) - (1)].expr); } break; case 54: -/* Line 1792 of yacc.c */ -#line 395 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 398 "config_parser.yy" { if ((yyvsp[(1) - (3)].exprl)) (yyval.exprl) = (yyvsp[(1) - (3)].exprl); @@ -2047,12 +2022,14 @@ yyreduce: (yyval.exprl) = new ExpressionList(); (yyval.exprl)->AddExpression(*(yyvsp[(3) - (3)].expr)); + delete (yyvsp[(3) - (3)].expr); } break; case 55: -/* Line 1792 of yacc.c */ -#line 406 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 410 "config_parser.yy" { (yyval.expr) = new Expression((yyvsp[(1) - (3)].text), (yyvsp[(2) - (3)].op), *(yyvsp[(3) - (3)].variant), yylloc); free((yyvsp[(1) - (3)].text)); @@ -2061,8 +2038,9 @@ yyreduce: break; case 56: -/* Line 1792 of yacc.c */ -#line 412 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 416 "config_parser.yy" { Expression subexpr((yyvsp[(3) - (6)].text), (yyvsp[(5) - (6)].op), *(yyvsp[(6) - (6)].variant), yylloc); free((yyvsp[(3) - (6)].text)); @@ -2077,57 +2055,65 @@ yyreduce: break; case 61: -/* Line 1792 of yacc.c */ -#line 430 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 434 "config_parser.yy" { (yyval.op) = (yyvsp[(1) - (1)].op); } break; case 62: -/* Line 1792 of yacc.c */ -#line 436 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 440 "config_parser.yy" { (yyval.array) = (yyvsp[(2) - (3)].array); } break; case 63: -/* Line 1792 of yacc.c */ -#line 442 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 446 "config_parser.yy" { (yyval.array) = (yyvsp[(1) - (1)].array); } break; case 64: -/* Line 1792 of yacc.c */ -#line 446 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 450 "config_parser.yy" { (yyval.array) = (yyvsp[(1) - (2)].array); } break; case 65: -/* Line 1792 of yacc.c */ -#line 451 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 455 "config_parser.yy" { (yyval.array) = NULL; } break; case 66: -/* Line 1792 of yacc.c */ -#line 455 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 459 "config_parser.yy" { (yyval.array) = new Array(); (yyval.array)->Add(*(yyvsp[(1) - (1)].variant)); + delete (yyvsp[(1) - (1)].variant); } break; case 67: -/* Line 1792 of yacc.c */ -#line 460 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 465 "config_parser.yy" { if ((yyvsp[(1) - (3)].array)) (yyval.array) = (yyvsp[(1) - (3)].array); @@ -2135,12 +2121,14 @@ yyreduce: (yyval.array) = new Array(); (yyval.array)->Add(*(yyvsp[(3) - (3)].variant)); + delete (yyvsp[(3) - (3)].variant); } break; case 68: -/* Line 1792 of yacc.c */ -#line 471 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 477 "config_parser.yy" { (yyval.variant) = new Value((yyvsp[(1) - (1)].text)); free((yyvsp[(1) - (1)].text)); @@ -2148,24 +2136,27 @@ yyreduce: break; case 69: -/* Line 1792 of yacc.c */ -#line 476 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 482 "config_parser.yy" { (yyval.variant) = new Value((yyvsp[(1) - (1)].num)); } break; case 70: -/* Line 1792 of yacc.c */ -#line 480 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 486 "config_parser.yy" { (yyval.variant) = new Value(); } break; case 71: -/* Line 1792 of yacc.c */ -#line 484 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 490 "config_parser.yy" { if ((yyvsp[(1) - (1)].array) == NULL) (yyvsp[(1) - (1)].array) = new Array(); @@ -2176,8 +2167,9 @@ yyreduce: break; case 73: -/* Line 1792 of yacc.c */ -#line 495 "config_parser.yy" + +/* Line 1806 of yacc.c */ +#line 501 "config_parser.yy" { ExpressionList::Ptr exprl = ExpressionList::Ptr((yyvsp[(1) - (1)].exprl)); (yyval.variant) = new Value(exprl); @@ -2185,8 +2177,9 @@ yyreduce: break; -/* Line 1792 of yacc.c */ -#line 2190 "config_parser.cc" + +/* Line 1806 of yacc.c */ +#line 2183 "config_parser.cc" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2351,9 +2344,7 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END yyerror_range[2] = yylloc; /* Using YYLLOC is tempting, but would change the location of @@ -2382,7 +2373,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2424,6 +2415,8 @@ yyreturn: } -/* Line 2055 of yacc.c */ -#line 500 "config_parser.yy" + +/* Line 2067 of yacc.c */ +#line 506 "config_parser.yy" + diff --git a/lib/config/config_parser.h b/lib/config/config_parser.h index 24aae9756..74bbac7af 100644 --- a/lib/config/config_parser.h +++ b/lib/config/config_parser.h @@ -69,6 +69,7 @@ #include #include #include +#include using namespace icinga; @@ -78,7 +79,7 @@ using namespace icinga; /* Line 2068 of yacc.c */ -#line 82 "config_parser.h" +#line 83 "config_parser.h" /* Tokens. */ #ifndef YYTOKENTYPE @@ -154,18 +155,22 @@ typedef union YYSTYPE { /* Line 2068 of yacc.c */ -#line 52 "config_parser.yy" +#line 53 "config_parser.yy" char *text; double num; icinga::Value *variant; icinga::ExpressionOperator op; icinga::TypeSpecifier type; + std::vector *slist; + Expression *expr; + ExpressionList *exprl; + Array *array; /* Line 2068 of yacc.c */ -#line 169 "config_parser.h" +#line 174 "config_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index d0e0f938d..765341b73 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -345,6 +345,7 @@ object_inherits_list: { $$ = new std::vector(); $$->push_back($1); + free($1); } | object_inherits_list ',' T_STRING { @@ -354,6 +355,7 @@ object_inherits_list: $$ = new std::vector(); $$->push_back($3); + free($3); } ; @@ -390,6 +392,7 @@ expressions_inner: /* empty */ { $$ = new ExpressionList(); $$->AddExpression(*$1); + delete $1; } | expressions_inner ',' expression { @@ -399,6 +402,7 @@ expressions_inner: /* empty */ $$ = new ExpressionList(); $$->AddExpression(*$3); + delete $3; } ; @@ -455,6 +459,7 @@ array_items_inner: /* empty */ { $$ = new Array(); $$->Add(*$1); + delete $1; } | array_items_inner ',' value { @@ -464,6 +469,7 @@ array_items_inner: /* empty */ $$ = new Array(); $$->Add(*$3); + delete $3; } ;