diff options
author | rlar <rlar> | 2016-03-20 20:13:42 +0100 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2016-03-28 16:41:15 -0400 |
commit | fab3f206e4fae1cf329e82a47a0b9d50975dd1b7 (patch) | |
tree | be949f75fc60643ac632a319fad77b4e029490df | |
parent | 42325b8b3934a9577d4bb347d6e5cf9a06945e9a (diff) | |
download | flex-git-fab3f206e4fae1cf329e82a47a0b9d50975dd1b7.tar.gz |
avoid warning in generated code, with -Cf
warning: conversion to 'unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
-rw-r--r-- | src/flex.skl | 8 | ||||
-rw-r--r-- | src/gen.c | 6 | ||||
-rw-r--r-- | src/main.c | 5 |
3 files changed, 7 insertions, 12 deletions
diff --git a/src/flex.skl b/src/flex.skl index 4c7d322..e9e3ba3 100644 --- a/src/flex.skl +++ b/src/flex.skl @@ -257,12 +257,10 @@ m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]], %ok-for-header %not-for-header -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) %ok-for-header @@ -752,7 +752,7 @@ void gen_next_compressed_state (char *char_map) out_dec ("if ( yy_current_state >= %d )\n", lastdfa + 2); ++indent_level; - indent_puts ("yy_c = yy_meta[(unsigned int) yy_c];"); + indent_puts ("yy_c = yy_meta[yy_c];"); --indent_level; } @@ -760,7 +760,7 @@ void gen_next_compressed_state (char *char_map) --indent_level; indent_puts - ("yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];"); + ("yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];"); } @@ -814,7 +814,7 @@ void gen_next_match (void) indent_puts ("YY_CHAR yy_c;\n"); indent_put2s ("for ( yy_c = %s;", char_map); indent_puts - (" (yy_trans_info = &yy_current_state[(unsigned int) yy_c])->"); + (" (yy_trans_info = &yy_current_state[yy_c])->"); indent_puts ("yy_verify == yy_c;"); indent_put2s (" yy_c = %s )", char_map_2); @@ -1609,10 +1609,7 @@ void readin (void) outn ("\n#define FLEX_DEBUG"); OUT_BEGIN_CODE (); - if (csize == 256) - outn ("typedef unsigned char YY_CHAR;"); - else - outn ("typedef char YY_CHAR;"); + outn ("typedef flex_uint8_t YY_CHAR;"); OUT_END_CODE (); if (C_plus_plus) { |