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 generate -Wconversion clean code.
details: https://anonhg.NetBSD.org/src/rev/325eabdf36cc
branches: trunk
changeset: 333338:325eabdf36cc
user: christos <christos%NetBSD.org@localhost>
date: Wed Oct 29 19:08:51 2014 +0000
description:
generate -Wconversion clean code.
diffstat:
external/bsd/flex/dist/flex.skl | 11 ++++++-----
external/bsd/flex/dist/gen.c | 40 ++++++++++++++++++++++++++++++----------
2 files changed, 36 insertions(+), 15 deletions(-)
diffs (157 lines):
diff -r 39764e980765 -r 325eabdf36cc external/bsd/flex/dist/flex.skl
--- a/external/bsd/flex/dist/flex.skl Wed Oct 29 18:30:05 2014 +0000
+++ b/external/bsd/flex/dist/flex.skl Wed Oct 29 19:08:51 2014 +0000
@@ -1633,7 +1633,7 @@
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 @@
/* 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 @@
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 @@
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 @@
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
diff -r 39764e980765 -r 325eabdf36cc external/bsd/flex/dist/gen.c
--- a/external/bsd/flex/dist/gen.c Wed Oct 29 18:30:05 2014 +0000
+++ b/external/bsd/flex/dist/gen.c Wed Oct 29 19:08:51 2014 +0000
@@ -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 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 @@
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 @@
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 @@
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 @@
/* 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 @@
/* 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,
Home |
Main Index |
Thread Index |
Old Index