From 4980b9f4e1b094fc9daeac67c18ebce27424d0ec Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 14 Aug 2013 10:12:49 -0600 Subject: [PATCH] Addressed some instances of Coverity issue 711927, uninitialized scalar variable. Modified 'makeparser' target in CMake build system. --- ncgen/CMakeLists.txt | 4 + ncgen/ncgen.y | 42 ++--- ncgen/ncgentab.c | 365 ++++++++++++++++++++----------------------- ncgen/ncgentab.h | 10 +- ncgen/ncgenyy.c | 63 ++++---- 5 files changed, 227 insertions(+), 257 deletions(-) diff --git a/ncgen/CMakeLists.txt b/ncgen/CMakeLists.txt index 4359e3c44..4b1f69d99 100644 --- a/ncgen/CMakeLists.txt +++ b/ncgen/CMakeLists.txt @@ -46,6 +46,10 @@ ADD_CUSTOM_COMMAND( COMMAND rm -f ncgentab.c ncgentab.h COMMAND mv ncgen.tab.c ncgentab.c COMMAND mv ncgen.tab.h ncgentab.h + COMMAND mv ncgentab.h ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND mv ncgentab.c ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND mv ncgenyy.c ${CMAKE_CURRENT_SOURCE_DIR} + ) ADD_CUSTOM_TARGET(makeparser DEPENDS ncgentab.h) diff --git a/ncgen/ncgen.y b/ncgen/ncgen.y index 2fcb63945..c04e48482 100644 --- a/ncgen/ncgen.y +++ b/ncgen/ncgen.y @@ -97,9 +97,9 @@ List* condefs; /* non-dimension constants used in type defs*/ List* tmp; /* Forward */ -static Constant makeconstdata(nc_type); -static Constant evaluate(Symbol* fcn, Datalist* arglist); -static Constant makeenumconst(Symbol*); +static NCConstant makeconstdata(nc_type); +static NCConstant evaluate(Symbol* fcn, Datalist* arglist); +static NCConstant makeenumconst(Symbol*); static void addtogroup(Symbol*); static Symbol* currentgroup(void); static Symbol* createrootgroup(void); @@ -110,7 +110,7 @@ static Symbol* makeattribute(Symbol*,Symbol*,Symbol*,Datalist*,Attrkind); static Symbol* makeprimitivetype(nc_type i); static Symbol* makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst); static int containsfills(Datalist* list); -static void datalistextend(Datalist* dl, Constant* con); +static void datalistextend(Datalist* dl, NCConstant* con); static void vercheck(int ncid); int yylex(void); @@ -134,7 +134,7 @@ unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/ long mark; /* track indices into the sequence*/ int nctype; /* for tracking attribute list type*/ Datalist* datalist; -Constant constant; +NCConstant constant; } %token @@ -998,10 +998,10 @@ creategroup(Symbol * gsym) return gsym; } -static Constant +static NCConstant makeconstdata(nc_type nctype) { - Constant con = nullconstant; + NCConstant con = nullconstant; consttype = nctype; con.nctype = nctype; con.lineno = lineno; @@ -1061,10 +1061,10 @@ makeconstdata(nc_type nctype) return con; } -static Constant +static NCConstant makeenumconst(Symbol* econst) { - Constant con; + NCConstant con; markcdf4("Enum type"); consttype = NC_ENUM; con.nctype = NC_ECONST; @@ -1143,7 +1143,7 @@ specialname(int flag) } static int -truefalse(Constant* con, int tag) +truefalse(NCConstant* con, int tag) { if(con->nctype == NC_STRING) { char* sdata = con->value.stringv.stringv; @@ -1172,22 +1172,24 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst) { Symbol* attr = NULL; Datalist* list; - Constant* con; + NCConstant* con; Specialdata* special = (Specialdata*)malloc(sizeof(Specialdata)); - Constant iconst; + NCConstant iconst; int tf = 0; char* sdata = NULL; int idata = -1; - + + special->flags = 0; + specials_flag += (tag == _FILLVALUE_FLAG ? 0 : 1); if(isconst) { - con = (Constant*)data; + con = (NCConstant*)data; list = builddatalist(1); - dlappend(list,(Constant*)data); + dlappend(list,(NCConstant*)data); } else { list = (Datalist*)data; - con = (Constant*)list->data; + con = (NCConstant*)list->data; } if(tag == _FORMAT && vsym != NULL) { @@ -1355,7 +1357,7 @@ containsfills(Datalist* list) { if(list != NULL) { int i; - Constant* con = list->data; + NCConstant* con = list->data; for(i=0;ilength;i++,con++) { if(con->nctype == NC_COMPOUND) { if(containsfills(con->value.compoundv)) return 1; @@ -1366,7 +1368,7 @@ containsfills(Datalist* list) } static void -datalistextend(Datalist* dl, Constant* con) +datalistextend(Datalist* dl, NCConstant* con) { dlappend(dl,con); } @@ -1399,10 +1401,10 @@ Note that currently, only a single value can be returned. */ -static Constant +static NCConstant evaluate(Symbol* fcn, Datalist* arglist) { - Constant result; + NCConstant result; /* prepare the result */ result.lineno = fcn->lineno; diff --git a/ncgen/ncgentab.c b/ncgen/ncgentab.c index 9611fdf32..4e2921c64 100644 --- a/ncgen/ncgentab.c +++ b/ncgen/ncgentab.c @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.6.4. */ +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ /* 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-2013 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.6.4" +#define YYBISON_VERSION "2.7.12-4996" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -69,7 +69,7 @@ #define yynerrs ncgnerrs /* Copy the first part of user declarations. */ -/* Line 358 of yacc.c */ +/* Line 371 of yacc.c */ #line 11 "ncgen.y" /* @@ -188,7 +188,7 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl; extern int lex_init(void); -/* Line 358 of yacc.c */ +/* Line 371 of yacc.c */ #line 193 "ncgen.tab.c" # ifndef YY_NULL @@ -280,7 +280,7 @@ extern int ncgdebug; #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { -/* Line 374 of yacc.c */ +/* Line 387 of yacc.c */ #line 131 "ncgen.y" Symbol* sym; @@ -291,7 +291,7 @@ Datalist* datalist; NCConstant constant; -/* Line 374 of yacc.c */ +/* Line 387 of yacc.c */ #line 296 "ncgen.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 @@ -319,7 +319,7 @@ int ncgparse (); /* Copy the second part of user declarations. */ -/* Line 377 of yacc.c */ +/* Line 390 of yacc.c */ #line 324 "ncgen.tab.c" #ifdef short @@ -381,6 +381,14 @@ typedef short int yytype_int16; # endif #endif +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if (! defined __GNUC__ || __GNUC__ < 2 \ + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) +# define __attribute__(Spec) /* empty */ +# endif +#endif + /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -388,6 +396,7 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif + /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(N) (N) @@ -1028,47 +1037,18 @@ do \ } \ while (YYID (0)) - +/* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#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; \ - } \ - while (YYID (0)) -#endif - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) - - /* This macro is provided for backward compatibility. */ - #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif /* YYLEX -- calling `yylex' with the right arguments. */ - #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else @@ -1128,11 +1108,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) # else YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -1373,7 +1349,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, { YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULL; @@ -1436,11 +1411,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } } } @@ -1460,10 +1437,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } if (*yymsg_alloc < yysize) { @@ -1519,12 +1498,7 @@ yydestruct (yymsg, yytype, yyvaluep) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YYUSE (yytype); } @@ -1534,16 +1508,16 @@ yydestruct (yymsg, yytype, yyvaluep) int yychar; -#ifndef YYLVAL_INITIALIZE -# define YYLVAL_INITIALIZE() -#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; +YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -1619,8 +1593,8 @@ yyparse () Keep to zero when no symbol should be popped. */ int yylen = 0; - yyss = yyssa; - yyvs = yyvsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1629,15 +1603,6 @@ yyparse () yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* 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; - - YYLVAL_INITIALIZE (); goto yysetstate; /*------------------------------------------------------------. @@ -1817,13 +1782,13 @@ yyreduce: switch (yyn) { case 2: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 211 "ncgen.y" {if (error_count > 0) YYABORT;} break; case 7: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 231 "ncgen.y" { Symbol* id = (yyvsp[(2) - (3)].sym); @@ -1835,25 +1800,25 @@ yyreduce: break; case 8: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 240 "ncgen.y" {listpop(groupstack);} break; case 11: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 246 "ncgen.y" {} break; case 12: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 248 "ncgen.y" {markcdf4("Type specification");} break; case 15: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 254 "ncgen.y" { /* Use when defining a type */ (yyvsp[(1) - (1)].sym)->objectclass = NC_TYPE; @@ -1865,19 +1830,19 @@ yyreduce: break; case 16: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 263 "ncgen.y" {} break; case 17: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 263 "ncgen.y" {} break; case 24: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 277 "ncgen.y" { int i; @@ -1908,13 +1873,13 @@ yyreduce: break; case 25: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 306 "ncgen.y" {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));} break; case 26: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 308 "ncgen.y" { int i; @@ -1933,7 +1898,7 @@ yyreduce: break; case 27: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 325 "ncgen.y" { (yyvsp[(1) - (3)].sym)->objectclass=NC_TYPE; @@ -1944,7 +1909,7 @@ yyreduce: break; case 28: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 334 "ncgen.y" { vercheck(NC_OPAQUE); @@ -1958,7 +1923,7 @@ yyreduce: break; case 29: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 346 "ncgen.y" { Symbol* basetype = (yyvsp[(1) - (5)].sym); @@ -1974,7 +1939,7 @@ yyreduce: break; case 30: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 360 "ncgen.y" { int i,j; @@ -2008,19 +1973,19 @@ yyreduce: break; case 31: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 392 "ncgen.y" {(yyval.mark)=(yyvsp[(1) - (2)].mark);} break; case 32: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 393 "ncgen.y" {(yyval.mark)=(yyvsp[(1) - (3)].mark);} break; case 33: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 397 "ncgen.y" { int i; @@ -2036,97 +2001,97 @@ yyreduce: break; case 34: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 410 "ncgen.y" { (yyval.sym) = primsymbols[NC_CHAR]; } break; case 35: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 411 "ncgen.y" { (yyval.sym) = primsymbols[NC_BYTE]; } break; case 36: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 412 "ncgen.y" { (yyval.sym) = primsymbols[NC_SHORT]; } break; case 37: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 413 "ncgen.y" { (yyval.sym) = primsymbols[NC_INT]; } break; case 38: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 414 "ncgen.y" { (yyval.sym) = primsymbols[NC_FLOAT]; } break; case 39: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 415 "ncgen.y" { (yyval.sym) = primsymbols[NC_DOUBLE]; } break; case 40: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 416 "ncgen.y" { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; } break; case 41: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 417 "ncgen.y" { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; } break; case 42: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 418 "ncgen.y" { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; } break; case 43: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 419 "ncgen.y" { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; } break; case 44: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 420 "ncgen.y" { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; } break; case 46: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 424 "ncgen.y" {} break; case 47: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 425 "ncgen.y" {} break; case 50: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 432 "ncgen.y" {} break; case 51: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 432 "ncgen.y" {} break; case 54: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 440 "ncgen.y" { (yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)uint32_val; @@ -2137,7 +2102,7 @@ fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned lo break; case 55: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 447 "ncgen.y" { if(int32_val <= 0) { @@ -2152,7 +2117,7 @@ fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned lo break; case 56: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 458 "ncgen.y" { /* for rare case where 2^31 < dimsize < 2^32 */ if (double_val <= 0) @@ -2169,7 +2134,7 @@ fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned lo break; case 57: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 471 "ncgen.y" { (yyvsp[(1) - (3)].sym)->dim.declsize = NC_UNLIMITED; @@ -2181,7 +2146,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 58: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 481 "ncgen.y" { (yyvsp[(1) - (1)].sym)->objectclass=NC_DIM; @@ -2195,31 +2160,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 60: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 493 "ncgen.y" {} break; case 61: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 494 "ncgen.y" {} break; case 64: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 501 "ncgen.y" {} break; case 65: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 501 "ncgen.y" {} break; case 66: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 504 "ncgen.y" { int i; @@ -2243,7 +2208,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 67: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 526 "ncgen.y" {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym)); @@ -2251,13 +2216,13 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 68: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 530 "ncgen.y" {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));} break; case 69: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 534 "ncgen.y" { int i; @@ -2286,31 +2251,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 70: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 560 "ncgen.y" {(yyval.mark)=listlength(stack);} break; case 71: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 561 "ncgen.y" {(yyval.mark)=(yyvsp[(2) - (3)].mark);} break; case 72: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 564 "ncgen.y" {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));} break; case 73: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 566 "ncgen.y" {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));} break; case 74: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 570 "ncgen.y" {Symbol* dimsym = (yyvsp[(1) - (1)].sym); dimsym->objectclass = NC_DIM; @@ -2325,7 +2290,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 75: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 584 "ncgen.y" {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym)); @@ -2333,13 +2298,13 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 76: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 588 "ncgen.y" {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));} break; case 77: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 593 "ncgen.y" { int i; @@ -2370,31 +2335,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 78: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 621 "ncgen.y" {(yyval.mark)=listlength(stack);} break; case 79: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 622 "ncgen.y" {(yyval.mark)=(yyvsp[(2) - (3)].mark);} break; case 80: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 626 "ncgen.y" {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));} break; case 81: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 628 "ncgen.y" {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));} break; case 82: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 633 "ncgen.y" { /* Anonymous integer dimension. Can only occur in type definitions*/ @@ -2408,7 +2373,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 83: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 643 "ncgen.y" { /* Anonymous integer dimension. Can only occur in type definitions*/ @@ -2426,7 +2391,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 84: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 663 "ncgen.y" {Symbol* vsym = (yyvsp[(1) - (1)].sym); if(vsym->objectclass != NC_VAR) { @@ -2438,7 +2403,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 85: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 674 "ncgen.y" {Symbol* tsym = (yyvsp[(1) - (1)].sym); if(tsym->objectclass != NC_TYPE) { @@ -2450,7 +2415,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 86: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 685 "ncgen.y" {Symbol* tvsym = (yyvsp[(1) - (1)].sym); Symbol* sym; /* disambiguate*/ @@ -2473,31 +2438,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 87: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 703 "ncgen.y" {(yyval.sym)=(yyvsp[(1) - (1)].sym);} break; case 88: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 710 "ncgen.y" {} break; case 89: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 710 "ncgen.y" {} break; case 90: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 714 "ncgen.y" { (yyval.sym)=makeattribute((yyvsp[(2) - (4)].sym),NULL,NULL,(yyvsp[(4) - (4)].datalist),ATTRGLOBAL);} break; case 91: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 716 "ncgen.y" {Symbol* tsym = (yyvsp[(1) - (6)].sym); Symbol* vsym = (yyvsp[(2) - (6)].sym); Symbol* asym = (yyvsp[(4) - (6)].sym); if(vsym->objectclass == NC_VAR) { @@ -2510,7 +2475,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 92: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 725 "ncgen.y" {Symbol* sym = (yyvsp[(1) - (5)].sym); Symbol* asym = (yyvsp[(3) - (5)].sym); if(sym->objectclass == NC_VAR) { @@ -2525,67 +2490,67 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 93: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 736 "ncgen.y" {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);} break; case 94: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 738 "ncgen.y" {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(2) - (6)].sym),(yyvsp[(1) - (6)].sym),(void*)(yyvsp[(6) - (6)].datalist),0);} break; case 95: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 740 "ncgen.y" {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 96: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 742 "ncgen.y" {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);} break; case 97: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 744 "ncgen.y" {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 98: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 746 "ncgen.y" {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 99: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 748 "ncgen.y" {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 100: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 750 "ncgen.y" {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 101: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 752 "ncgen.y" {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 102: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 754 "ncgen.y" {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),1);} break; case 103: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 759 "ncgen.y" { (yyval.sym)=(yyvsp[(1) - (1)].sym); @@ -2595,7 +2560,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 104: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 765 "ncgen.y" { (yyval.sym)=(yyvsp[(1) - (1)].sym); @@ -2606,248 +2571,248 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); break; case 106: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 774 "ncgen.y" {} break; case 107: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 775 "ncgen.y" {} break; case 110: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 783 "ncgen.y" {(yyvsp[(1) - (3)].sym)->data = (yyvsp[(3) - (3)].datalist);} break; case 111: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 786 "ncgen.y" {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);} break; case 112: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 787 "ncgen.y" {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);} break; case 113: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 791 "ncgen.y" {(yyval.datalist) = builddatalist(0);} break; case 114: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 795 "ncgen.y" {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));} break; case 115: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 797 "ncgen.y" {datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);} break; case 116: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 801 "ncgen.y" {(yyval.constant)=(yyvsp[(1) - (1)].constant);} break; case 117: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 802 "ncgen.y" {(yyval.constant)=builddatasublist((yyvsp[(2) - (3)].datalist));} break; case 118: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 806 "ncgen.y" {(yyval.constant)=(yyvsp[(1) - (1)].constant);} break; case 119: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 807 "ncgen.y" {(yyval.constant)=makeconstdata(NC_OPAQUE);} break; case 120: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 808 "ncgen.y" {(yyval.constant)=makeconstdata(NC_FILLVALUE);} break; case 121: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 809 "ncgen.y" {(yyval.constant)=makeconstdata(NC_NIL);} break; case 122: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 810 "ncgen.y" {(yyval.constant)=makeenumconst((yyvsp[(1) - (1)].sym));} break; case 124: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 815 "ncgen.y" {(yyval.constant)=evaluate((yyvsp[(1) - (4)].sym),(yyvsp[(3) - (4)].datalist));} break; case 125: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 820 "ncgen.y" {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));} break; case 126: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 822 "ncgen.y" {datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);} break; case 127: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 826 "ncgen.y" {(yyval.constant)=makeconstdata(NC_CHAR);} break; case 128: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 827 "ncgen.y" {(yyval.constant)=makeconstdata(NC_BYTE);} break; case 129: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 828 "ncgen.y" {(yyval.constant)=makeconstdata(NC_SHORT);} break; case 130: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 829 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT);} break; case 131: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 830 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT64);} break; case 132: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 831 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UBYTE);} break; case 133: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 832 "ncgen.y" {(yyval.constant)=makeconstdata(NC_USHORT);} break; case 134: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 833 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT);} break; case 135: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 834 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT64);} break; case 136: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 835 "ncgen.y" {(yyval.constant)=makeconstdata(NC_FLOAT);} break; case 137: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 836 "ncgen.y" {(yyval.constant)=makeconstdata(NC_DOUBLE);} break; case 138: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 837 "ncgen.y" {(yyval.constant)=makeconstdata(NC_STRING);} break; case 139: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 841 "ncgen.y" {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));} break; case 140: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 842 "ncgen.y" {(yyval.datalist)=(yyvsp[(1) - (3)].datalist); datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant)));} break; case 141: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 847 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT);} break; case 142: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 849 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT);} break; case 143: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 851 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT64);} break; case 144: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 853 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT64);} break; case 145: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 857 "ncgen.y" {(yyval.constant)=makeconstdata(NC_STRING);} break; case 146: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 861 "ncgen.y" {(yyval.constant)=(yyvsp[(1) - (1)].constant);} break; case 147: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 862 "ncgen.y" {(yyval.constant)=(yyvsp[(1) - (1)].constant);} break; case 148: -/* Line 1813 of yacc.c */ +/* Line 1787 of yacc.c */ #line 868 "ncgen.y" {(yyval.sym)=(yyvsp[(1) - (1)].sym);} break; -/* Line 1813 of yacc.c */ -#line 2851 "ncgen.tab.c" +/* Line 1787 of yacc.c */ +#line 2816 "ncgen.tab.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -3078,7 +3043,7 @@ yyreturn: } -/* Line 2076 of yacc.c */ +/* Line 2050 of yacc.c */ #line 871 "ncgen.y" @@ -3390,7 +3355,9 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst) int tf = 0; char* sdata = NULL; int idata = -1; - + + special->flags = 0; + specials_flag += (tag == _FILLVALUE_FLAG ? 0 : 1); if(isconst) { diff --git a/ncgen/ncgentab.h b/ncgen/ncgentab.h index 7b09dc148..6e687ffae 100644 --- a/ncgen/ncgentab.h +++ b/ncgen/ncgentab.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.6.4. */ +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2013 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 @@ -101,7 +101,7 @@ extern int ncgdebug; #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { -/* Line 2077 of yacc.c */ +/* Line 2053 of yacc.c */ #line 131 "ncgen.y" Symbol* sym; @@ -109,10 +109,10 @@ unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/ long mark; /* track indices into the sequence*/ int nctype; /* for tracking attribute list type*/ Datalist* datalist; -Constant constant; +NCConstant constant; -/* Line 2077 of yacc.c */ +/* Line 2053 of yacc.c */ #line 117 "ncgen.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 diff --git a/ncgen/ncgenyy.c b/ncgen/ncgenyy.c index 9fd735460..e0c7f1f0a 100644 --- a/ncgen/ncgenyy.c +++ b/ncgen/ncgenyy.c @@ -27,7 +27,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 37 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -72,7 +72,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -103,6 +102,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -171,7 +172,12 @@ typedef unsigned int flex_uint32_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -extern int ncgleng; +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t ncgleng; extern FILE *ncgin, *ncgout; @@ -197,11 +203,6 @@ extern FILE *ncgin, *ncgout; #define unput(c) yyunput( c, (yytext_ptr) ) -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -219,7 +220,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -289,8 +290,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when ncgtext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int ncgleng; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t ncgleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; @@ -318,7 +319,7 @@ static void ncg_init_buffer (YY_BUFFER_STATE b,FILE *file ); YY_BUFFER_STATE ncg_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE ncg_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,int len ); +YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,yy_size_t len ); void *ncgalloc (yy_size_t ); void *ncgrealloc (void *,yy_size_t ); @@ -1224,7 +1225,7 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})* /* Note: this definition of string will work for utf8 as well, although it is a very relaxed definition */ -#line 1228 "lex.ncg.c" +#line 1229 "lex.ncg.c" #define INITIAL 0 #define ST_C_COMMENT 1 @@ -1265,7 +1266,7 @@ FILE *ncgget_out (void ); void ncgset_out (FILE * out_str ); -int ncgget_leng (void ); +yy_size_t ncgget_leng (void ); char *ncgget_text (void ); @@ -1326,7 +1327,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( ncgin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1410,7 +1411,7 @@ YY_DECL #line 168 "ncgen.l" -#line 1414 "lex.ncg.c" +#line 1415 "lex.ncg.c" if ( !(yy_init) ) { @@ -2072,7 +2073,7 @@ YY_RULE_SETUP #line 563 "ncgen.l" ECHO; YY_BREAK -#line 2076 "lex.ncg.c" +#line 2077 "lex.ncg.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TEXT): yyterminate(); @@ -2259,21 +2260,21 @@ static int yy_get_next_buffer (void) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2304,7 +2305,7 @@ static int yy_get_next_buffer (void) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); + (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } @@ -2399,7 +2400,7 @@ static int yy_get_next_buffer (void) yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 384); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) @@ -2414,7 +2415,7 @@ static int yy_get_next_buffer (void) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; + register yy_size_t number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = @@ -2463,7 +2464,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -2623,10 +2624,6 @@ static void ncg_load_buffer_state (void) ncgfree((void *) b ); } -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a ncgrestart() or at EOF. @@ -2739,7 +2736,7 @@ void ncgpop_buffer_state (void) */ static void ncgensure_buffer_stack (void) { - int num_to_alloc; + yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { @@ -2831,12 +2828,12 @@ YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to ncglex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; @@ -2923,7 +2920,7 @@ FILE *ncgget_out (void) /** Get the length of the current token. * */ -int ncgget_leng (void) +yy_size_t ncgget_leng (void) { return ncgleng; }