Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/flex/dist/src more yy_size_t <-> int fixes



details:   https://anonhg.NetBSD.org/src/rev/e8f07b9757a4
branches:  trunk
changeset: 820198:e8f07b9757a4
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 02 23:21:14 2017 +0000

description:
more yy_size_t <-> int fixes

diffstat:

 external/bsd/flex/dist/src/flex.skl   |   22 +-
 external/bsd/flex/dist/src/gen.c      |   12 +-
 external/bsd/flex/dist/src/initscan.c |  536 +++++++++++++++++-----------------
 3 files changed, 283 insertions(+), 287 deletions(-)

diffs (truncated from 1982 to 300 lines):

diff -r 1f68fd00f834 -r e8f07b9757a4 external/bsd/flex/dist/src/flex.skl
--- a/external/bsd/flex/dist/src/flex.skl       Mon Jan 02 23:02:04 2017 +0000
+++ b/external/bsd/flex/dist/src/flex.skl       Mon Jan 02 23:21:14 2017 +0000
@@ -384,10 +384,6 @@
 #define YY_TYPEDEF_YY_SIZE_T
 typedef size_t yy_size_t;
 #endif
-#ifndef YY_TYPEDEF_YY_SSIZE_T
-#define YY_TYPEDEF_YY_SSIZE_T
-typedef ssize_t yy_ssize_t;
-#endif
 
 %if-not-reentrant
 extern yy_size_t yyleng;
@@ -574,7 +570,7 @@
 
 void yyrestart ( FILE *input_file M4_YY_PROTO_LAST_ARG );
 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
-YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size M4_YY_PROTO_LAST_ARG );
+YY_BUFFER_STATE yy_create_buffer ( FILE *file, yy_size_t size M4_YY_PROTO_LAST_ARG );
 void yy_delete_buffer ( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
 void yy_flush_buffer ( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
@@ -1495,9 +1491,9 @@
 }
 
 #ifdef YY_INTERACTIVE
-int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
+int yyFlexLexer::LexerInput( char* buf, yy_size_t /* max_size */ )
 #else
-int yyFlexLexer::LexerInput( char* buf, int max_size )
+int yyFlexLexer::LexerInput( char* buf, yy_size_t max_size )
 #endif
 {
        if ( yyin.eof() || yyin.fail() )
@@ -1592,7 +1588,7 @@
 
        else
                {
-                       yy_ssize_t 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 )
@@ -1669,7 +1665,7 @@
 
        if ((YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
                /* Extend the array by 50%, plus the number we really need. */
-               int new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
+               yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
                        (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size M4_YY_CALL_LAST_ARG );
                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
@@ -1978,10 +1974,10 @@
  * @return the allocated buffer state.
  */
 %if-c-only
-    YY_BUFFER_STATE yy_create_buffer  YYFARGS2( FILE *,file, int ,size)
+    YY_BUFFER_STATE yy_create_buffer  YYFARGS2( FILE *,file, yy_size_t ,size)
 %endif
 %if-c++-only
-    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size )
+    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, yy_size_t size )
 %endif
 {
        YY_BUFFER_STATE b;
@@ -2014,7 +2010,7 @@
  * M4_YY_DOC_PARAM
  * @return the allocated buffer state.
  */
-       YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
+       YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, yy_size_t size )
 {
        return yy_create_buffer( *file, size );
 }
@@ -2286,7 +2282,7 @@
        if ( ! b )
                YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
 
-       b->yy_buf_size = (int) (size - 2);      /* "- 2" to take care of EOB's */
+       b->yy_buf_size = (size - 2);    /* "- 2" to take care of EOB's */
        b->yy_buf_pos = b->yy_ch_buf = base;
        b->yy_is_our_buffer = 0;
        b->yy_input_file = NULL;
diff -r 1f68fd00f834 -r e8f07b9757a4 external/bsd/flex/dist/src/gen.c
--- a/external/bsd/flex/dist/src/gen.c  Mon Jan 02 23:02:04 2017 +0000
+++ b/external/bsd/flex/dist/src/gen.c  Mon Jan 02 23:21:14 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gen.c,v 1.4 2017/01/02 21:20:00 christos Exp $ */
+/*     $NetBSD: gen.c,v 1.5 2017/01/02 23:21:14 christos Exp $ */
 
 /* gen - actual generation (writing) of flex scanners */
 
@@ -33,7 +33,7 @@
 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
 /*  PURPOSE. */
 #include "flexdef.h"
-__RCSID("$NetBSD: gen.c,v 1.4 2017/01/02 21:20:00 christos Exp $");
+__RCSID("$NetBSD: gen.c,v 1.5 2017/01/02 23:21:14 christos Exp $");
 
 #include "tables.h"
 
@@ -1509,11 +1509,11 @@
        if (yymore_used && !yytext_is_array) {
                indent_puts ("YY_G(yytext_ptr) -= YY_G(yy_more_len); \\");
                indent_puts
-                       ("yyleng = (int) (yy_cp - YY_G(yytext_ptr)); \\");
+                       ("yyleng = (yy_size_t)(yy_cp - YY_G(yytext_ptr)); \\");
        }
 
        else
-               indent_puts ("yyleng = (int) (yy_cp - yy_bp); \\");
+               indent_puts ("yyleng = (yy_size_t)(yy_cp - yy_bp); \\");
 
        /* Now also deal with copying yytext_ptr to yytext if needed. */
        skelout ();             /* %% [3.0] - break point in skel */
@@ -1884,7 +1884,7 @@
                        outn ("\tif ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \\");
                        outn ("\t\t{ \\");
                        outn ("\t\tint c = '*'; \\");
-                       outn ("\t\tint n; \\");
+                       outn ("\t\tyy_size_t n; \\");
                        outn ("\t\tfor ( n = 0; n < max_size && \\");
                        outn ("\t\t\t     (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\");
                        outn ("\t\t\tbuf[n] = (char) c; \\");
@@ -1897,7 +1897,7 @@
                        outn ("\telse \\");
                        outn ("\t\t{ \\");
                        outn ("\t\terrno=0; \\");
-                       outn ("\t\twhile ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \\");
+                       outn ("\t\twhile ( (result = fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \\");
                        outn ("\t\t\t{ \\");
                        outn ("\t\t\tif( errno != EINTR) \\");
                        outn ("\t\t\t\t{ \\");
diff -r 1f68fd00f834 -r e8f07b9757a4 external/bsd/flex/dist/src/initscan.c
--- a/external/bsd/flex/dist/src/initscan.c     Mon Jan 02 23:02:04 2017 +0000
+++ b/external/bsd/flex/dist/src/initscan.c     Mon Jan 02 23:21:14 2017 +0000
@@ -104,7 +104,7 @@
 
 /* end standard C headers. */
 
-/*     $NetBSD: initscan.c,v 1.6 2017/01/02 21:20:00 christos Exp $    */
+/*     $NetBSD: initscan.c,v 1.7 2017/01/02 23:21:14 christos Exp $    */
 
 /* flex integer type definitions */
 
@@ -1925,10 +1925,10 @@
 #define YY_MORE_ADJ 0
 #define YY_RESTORE_YY_MORE_OFFSET
 char *yytext;
-#line 1 "/usr/src/external/bsd/flex/dist/src/scan.l"
-/*     $NetBSD: initscan.c,v 1.6 2017/01/02 21:20:00 christos Exp $    */
+#line 1 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
+/*     $NetBSD: initscan.c,v 1.7 2017/01/02 23:21:14 christos Exp $    */
 /* scan.l - scanner for flex input -*-C-*- */
-#line 6 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 6 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 /*  Copyright (c) 1990 The Regents of the University of California. */
 /*  All rights reserved. */
 
@@ -1960,7 +1960,7 @@
 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
 /*  PURPOSE. */
 #include "flexdef.h"
-__RCSID("$NetBSD: initscan.c,v 1.6 2017/01/02 21:20:00 christos Exp $");
+__RCSID("$NetBSD: initscan.c,v 1.7 2017/01/02 23:21:14 christos Exp $");
 
 #include "parse.h"
 extern bool tablesverify, tablesext;
@@ -2304,9 +2304,9 @@
                }
 
        {
-#line 162 "/usr/src/external/bsd/flex/dist/src/scan.l"
-
-#line 164 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 162 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
+
+#line 164 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
        static int bracelevel, didadef, indented_code;
        static int doing_rule_action = false;
        static int option_sense;
@@ -2376,39 +2376,39 @@
 
 case 1:
 YY_RULE_SETUP
-#line 174 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 174 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 START_CODEBLOCK(true);
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 175 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 175 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 add_action("/*[""["); yy_push_state( COMMENT );
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 176 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 176 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 yy_push_state( LINEDIR );
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 177 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 177 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 return SCDECL;
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 178 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 178 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 return XSCDECL;
        YY_BREAK
 case 6:
 /* rule 6 can match eol */
 YY_RULE_SETUP
-#line 179 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 179 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 START_CODEBLOCK(false);
        YY_BREAK
 case 7:
 /* rule 7 can match eol */
 YY_RULE_SETUP
-#line 180 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 180 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 {
                 brace_start_line = linenum;
                 ++linenum;
@@ -2419,17 +2419,17 @@
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 188 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 188 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 synerr( _("malformed '%top' directive") );
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 190 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 190 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 /* discard */
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 192 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 192 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 {
                        sectnum = 2;
                        bracelevel = 0;
@@ -2442,42 +2442,42 @@
 case 11:
 /* rule 11 can match eol */
 YY_RULE_SETUP
-#line 201 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 201 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 yytext_is_array = false; ++linenum;
        YY_BREAK
 case 12:
 /* rule 12 can match eol */
 YY_RULE_SETUP
-#line 202 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 202 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 yytext_is_array = true; ++linenum;
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 204 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 204 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 BEGIN(OPTION); return TOK_OPTION;
        YY_BREAK
 case 14:
 /* rule 14 can match eol */
 YY_RULE_SETUP
-#line 206 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 206 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 ++linenum; /* ignore */
        YY_BREAK
 case 15:
 /* rule 15 can match eol */
 YY_RULE_SETUP
-#line 207 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 207 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 ++linenum;     /* ignore */
        YY_BREAK
 /* xgettext: no-c-format */
 case 16:
 /* rule 16 can match eol */
 YY_RULE_SETUP
-#line 210 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 210 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 synerr( _( "unrecognized '%' directive" ) );
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 212 "/usr/src/external/bsd/flex/dist/src/scan.l"
+#line 212 "/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l"
 {
                        if(yyleng < MAXLINE)
                         {



Home | Main Index | Thread Index | Old Index