Module Name:    src
Committed By:   christos
Date:           Wed Oct 29 19:08:51 UTC 2014

Modified Files:
        src/external/bsd/flex/dist: flex.skl gen.c

Log Message:
generate -Wconversion clean code.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/flex/dist/flex.skl
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/flex/dist/gen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/flex/dist/flex.skl
diff -u src/external/bsd/flex/dist/flex.skl:1.10 src/external/bsd/flex/dist/flex.skl:1.11
--- src/external/bsd/flex/dist/flex.skl:1.10	Wed Oct 29 14:28:36 2014
+++ src/external/bsd/flex/dist/flex.skl	Wed Oct 29 15:08:51 2014
@@ -1633,7 +1633,7 @@ int yyFlexLexer::yy_get_next_buffer()
     M4_YY_DECL_GUTS_VAR();
 	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 	register char *source = YY_G(yytext_ptr);
-	register int number_to_move, i;
+	register yy_size_t number_to_move, i;
 	int ret_val;
 
 	if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
@@ -1662,7 +1662,7 @@ int yyFlexLexer::yy_get_next_buffer()
 	/* Try to read more data. */
 
 	/* First move last chars to start of buffer. */
-	number_to_move = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;
+	number_to_move = (yy_size_t)((YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1);
 
 	for ( i = 0; i < number_to_move; ++i )
 		*(dest++) = *(source++);
@@ -1903,7 +1903,8 @@ m4_ifdef( [[M4_YY_USE_LINENO]],
 
 		else
 			{ /* need more input */
-			yy_size_t offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
+			yy_size_t offset = (yy_size_t)
+			    (YY_G(yy_c_buf_p) - YY_G(yytext_ptr));
 			++YY_G(yy_c_buf_p);
 
 			switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
@@ -2057,7 +2058,7 @@ static void yy_load_buffer_state  YYFARG
 	if ( ! b )
 		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
-	b->yy_buf_size = size;
+	b->yy_buf_size = (yy_size_t)size;
 
 	/* yy_ch_buf has to be 2 characters longer than the size given because
 	 * we need to put in 2 end-of-buffer characters.
@@ -2290,7 +2291,7 @@ void yyFlexLexer::yyensure_buffer_stack(
 	if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
 
 		/* Increase the buffer to prepare for a possible push. */
-		int grow_size = 8 /* arbitrary grow size */;
+		yy_size_t grow_size = 8 /* arbitrary grow size */;
 
 		num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
 		YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc

Index: src/external/bsd/flex/dist/gen.c
diff -u src/external/bsd/flex/dist/gen.c:1.9 src/external/bsd/flex/dist/gen.c:1.10
--- src/external/bsd/flex/dist/gen.c:1.9	Wed Oct 29 14:28:36 2014
+++ src/external/bsd/flex/dist/gen.c	Wed Oct 29 15:08:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: gen.c,v 1.9 2014/10/29 18:28:36 christos Exp $	*/
+/*	$NetBSD: gen.c,v 1.10 2014/10/29 19:08:51 christos Exp $	*/
 
 /* gen - actual generation (writing) of flex scanners */
 
@@ -33,7 +33,7 @@
 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
 /*  PURPOSE. */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: gen.c,v 1.9 2014/10/29 18:28:36 christos Exp $");
+__RCSID("$NetBSD: gen.c,v 1.10 2014/10/29 19:08:51 christos Exp $");
 
 #include "flexdef.h"
 #include "tables.h"
@@ -74,6 +74,26 @@ static const char *get_int32_decl (void)
 		: "static yyconst flex_int32_t * %s = 0;\n";
 }
 
+static const char *get_uint16_decl (void)
+{
+	return (gentables)
+		? "static yyconst flex_uint16_t %s[%d] =\n    {   0,\n"
+		: "static yyconst flex_uint16_t * %s = 0;\n";
+}
+
+static const char *get_uint32_decl (void)
+{
+	return (gentables)
+		? "static yyconst flex_uint32_t %s[%d] =\n    {   0,\n"
+		: "static yyconst flex_uint32_t * %s = 0;\n";
+}
+
+static const char *get_yy_char_decl (void)
+{
+	return (gentables)
+		? "static yyconst YY_CHAR %s[%d] =\n    {   0,\n"
+		: "static yyconst YY_CHAR * %s = 0;\n";
+}
 static const char *get_state_decl (void)
 {
 	return (gentables)
@@ -456,7 +476,7 @@ static struct yytbl_data *mkecstbl (void
 
 	buf_prints (&yydmap_buf,
 		    "\t{YYTD_ID_EC, (void**)&yy_ec, sizeof(%s)},\n",
-		    "flex_int32_t");
+		    "YY_CHAR");
 
 	return tbl;
 }
@@ -468,7 +488,7 @@ void genecs ()
 	register int i, j;
 	int     numrows;
 
-	out_str_dec (get_int32_decl (), "yy_ec", csize);
+	out_str_dec (get_yy_char_decl (), "yy_ec", csize);
 
 	for (i = 1; i < csize; ++i) {
 		ecgroup[i] = ABS (ecgroup[i]);
@@ -1278,10 +1298,10 @@ void gentabs ()
 			fputs (_("\n\nMeta-Equivalence Classes:\n"),
 			       stderr);
 
-		out_str_dec (get_int32_decl (), "yy_meta", numecs + 1);
+		out_str_dec (get_yy_char_decl (), "yy_meta", numecs + 1);
 		buf_prints (&yydmap_buf,
 			    "\t{YYTD_ID_META, (void**)&yy_meta, sizeof(%s)},\n",
-			    "flex_int32_t");
+			    "YY_CHAR");
 
 		for (i = 1; i <= numecs; ++i) {
 			if (trace)
@@ -1308,13 +1328,13 @@ void gentabs ()
 
 	/* Begin generating yy_base */
 	out_str_dec ((tblend >= INT16_MAX || long_align) ?
-		     get_int32_decl () : get_int16_decl (),
+		     get_uint32_decl () : get_uint16_decl (),
 		     "yy_base", total_states + 1);
 
 	buf_prints (&yydmap_buf,
 		    "\t{YYTD_ID_BASE, (void**)&yy_base, sizeof(%s)},\n",
 		    (tblend >= INT16_MAX
-		     || long_align) ? "flex_int32_t" : "flex_int16_t");
+		     || long_align) ? "flex_uint32_t" : "flex_uint16_t");
 	yybase_tbl =
 		(struct yytbl_data *) calloc (1,
 					      sizeof (struct yytbl_data));
@@ -1401,13 +1421,13 @@ void gentabs ()
 
 	/* Begin generating yy_nxt */
 	out_str_dec ((total_states >= INT16_MAX || long_align) ?
-		     get_int32_decl () : get_int16_decl (), "yy_nxt",
+		     get_uint32_decl () : get_uint16_decl (), "yy_nxt",
 		     tblend + 1);
 
 	buf_prints (&yydmap_buf,
 		    "\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
 		    (total_states >= INT16_MAX
-		     || long_align) ? "flex_int32_t" : "flex_int16_t");
+		     || long_align) ? "flex_uint32_t" : "flex_uint16_t");
 
 	yynxt_tbl =
 		(struct yytbl_data *) calloc (1,

Reply via email to