fmaptool: Accept hex values with uppercase letters

Due to a newer flex version with which the scanner was recreated, we
also have to make the compiler less strict on the generated code.

Change-Id: I3758c0dcb2f5661d072b54a30d6a4ebe094854e6
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: https://review.coreboot.org/15482
Tested-by: build bot (Jenkins)
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Patrick Georgi 2016-06-28 20:45:34 +02:00 committed by Patrick Georgi
parent e46dbcc53a
commit 2b80734811
4 changed files with 114 additions and 97 deletions

View File

@ -162,6 +162,7 @@ $(objutil)/cbfstool/fmd.o: $(objutil)/cbfstool/fmd_parser.h
$(objutil)/cbfstool/fmd.o: $(objutil)/cbfstool/fmd_scanner.h
$(objutil)/cbfstool/fmd_parser.o: $(objutil)/cbfstool/fmd.o
$(objutil)/cbfstool/fmd_scanner.o: $(objutil)/cbfstool/fmd.o
$(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-sign-compare
$(objutil)/cbfstool/%: $(top)/util/cbfstool/%_shipped
mkdir -p $(dir $@)

View File

@ -7,8 +7,8 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 39
#define YY_FLEX_MINOR_VERSION 6
#define YY_FLEX_SUBMINOR_VERSION 0
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@ -210,7 +210,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
yy_size_t yy_n_chars;
int 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
@ -280,7 +280,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
static int yy_n_chars; /* number of characters read into yy_ch_buf */
yy_size_t yyleng;
/* Points to current character in buffer. */
@ -341,7 +341,7 @@ void yyfree (void * );
/* Begin user sect3 */
#define yywrap() 1
#define yywrap() (/*CONSTCOND*/1)
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
@ -355,11 +355,17 @@ extern int yylineno;
int yylineno = 1;
extern char *yytext;
#ifdef yytext_ptr
#undef yytext_ptr
#endif
#define yytext_ptr yytext
static yy_state_type yy_get_previous_state (void );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
static int yy_get_next_buffer (void );
#if defined(__GNUC__) && __GNUC__ >= 3
__attribute__((__noreturn__))
#endif
static void yy_fatal_error (yyconst char msg[] );
/* Done after the current pattern has been matched and before the
@ -388,7 +394,7 @@ static yyconst flex_int16_t yy_accept[24] =
6, 6, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
static yyconst YY_CHAR yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
@ -396,13 +402,13 @@ static yyconst flex_int32_t yy_ec[256] =
1, 2, 1, 1, 4, 1, 1, 1, 1, 5,
5, 1, 1, 1, 1, 1, 1, 6, 7, 7,
7, 7, 7, 7, 7, 7, 7, 1, 1, 1,
1, 1, 1, 5, 1, 1, 1, 1, 1, 1,
8, 1, 1, 1, 8, 1, 8, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 9, 1, 1,
1, 1, 1, 1, 1, 1, 10, 10, 10, 10,
1, 1, 1, 5, 8, 8, 8, 8, 8, 8,
9, 1, 1, 1, 9, 1, 9, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 10, 1, 1,
1, 1, 1, 1, 1, 1, 8, 8, 8, 8,
10, 10, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 9,
8, 8, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 10,
1, 1, 5, 1, 5, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -420,16 +426,16 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
static yyconst flex_int32_t yy_meta[11] =
static yyconst YY_CHAR yy_meta[11] =
{ 0,
1, 2, 2, 3, 3, 1, 1, 1, 1, 1
} ;
static yyconst flex_int16_t yy_base[27] =
static yyconst flex_uint16_t yy_base[27] =
{ 0,
0, 0, 29, 0, 0, 0, 25, 34, 10, 15,
0, 0, 12, 34, 16, 0, 20, 0, 0, 0,
6, 0, 34, 12, 10, 30
0, 0, 33, 0, 0, 0, 20, 34, 10, 15,
0, 0, 12, 34, 16, 0, 21, 0, 0, 0,
5, 0, 34, 12, 10, 29
} ;
static yyconst flex_int16_t yy_def[27] =
@ -439,12 +445,12 @@ static yyconst flex_int16_t yy_def[27] =
17, 24, 0, 23, 23, 23
} ;
static yyconst flex_int16_t yy_nxt[45] =
static yyconst flex_uint16_t yy_nxt[45] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 4, 4, 4,
11, 12, 11, 22, 14, 15, 15, 16, 17, 11,
18, 18, 19, 20, 11, 21, 21, 14, 23, 21,
13, 13, 13, 3, 23, 23, 23, 23, 23, 23,
11, 12, 11, 22, 14, 15, 15, 11, 16, 17,
18, 18, 14, 19, 20, 11, 21, 21, 21, 13,
13, 13, 23, 3, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23
} ;
@ -452,8 +458,8 @@ static yyconst flex_int16_t yy_chk[45] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
9, 25, 24, 21, 13, 9, 9, 9, 9, 9,
10, 10, 10, 15, 15, 17, 17, 7, 3, 17,
26, 26, 26, 23, 23, 23, 23, 23, 23, 23,
10, 10, 7, 10, 15, 15, 17, 17, 17, 26,
26, 26, 3, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23
} ;
@ -485,12 +491,8 @@ char *yytext;
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.
*/
#line 21 "fmd_scanner.l"
#line 17 "fmd_scanner.l"
#include "fmd_parser.h"
#include <assert.h>
@ -498,7 +500,7 @@ char *yytext;
int parse_integer(char *src, int base);
int copy_string(const char *src);
#line 502 "<stdout>"
#line 504 "<stdout>"
#define INITIAL 0
@ -531,11 +533,11 @@ void yyset_extra (YY_EXTRA_TYPE user_defined );
FILE *yyget_in (void );
void yyset_in (FILE * in_str );
void yyset_in (FILE * _in_str );
FILE *yyget_out (void );
void yyset_out (FILE * out_str );
void yyset_out (FILE * _out_str );
yy_size_t yyget_leng (void );
@ -543,7 +545,7 @@ char *yyget_text (void );
int yyget_lineno (void );
void yyset_lineno (int line_number );
void yyset_lineno (int _line_number );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -557,8 +559,12 @@ extern int yywrap (void );
#endif
#endif
#ifndef YY_NO_UNPUT
static void yyunput (int c,char *buf_ptr );
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
@ -671,7 +677,7 @@ extern int yylex (void);
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#define YY_BREAK /*LINTED*/break;
#endif
#define YY_RULE_SETUP \
@ -681,9 +687,9 @@ extern int yylex (void);
*/
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
yy_state_type yy_current_state;
char *yy_cp, *yy_bp;
int yy_act;
if ( !(yy_init) )
{
@ -712,12 +718,12 @@ YY_DECL
}
{
#line 34 "fmd_scanner.l"
#line 30 "fmd_scanner.l"
#line 719 "<stdout>"
#line 725 "<stdout>"
while ( 1 ) /* loops until end-of-file is reached */
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
yy_cp = (yy_c_buf_p);
@ -733,7 +739,7 @@ YY_DECL
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@ -775,7 +781,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
#line 36 "fmd_scanner.l"
#line 32 "fmd_scanner.l"
/* Eat whitespace. */
YY_BREAK
case 2:
@ -783,42 +789,42 @@ case 2:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 37 "fmd_scanner.l"
#line 33 "fmd_scanner.l"
/* Eat comments. */
YY_BREAK
case 3:
#line 39 "fmd_scanner.l"
#line 35 "fmd_scanner.l"
case 4:
YY_RULE_SETUP
#line 39 "fmd_scanner.l"
#line 35 "fmd_scanner.l"
return parse_integer(yytext, 10);
YY_BREAK
case 5:
YY_RULE_SETUP
#line 40 "fmd_scanner.l"
#line 36 "fmd_scanner.l"
return OCTAL;
YY_BREAK
case 6:
YY_RULE_SETUP
#line 41 "fmd_scanner.l"
#line 37 "fmd_scanner.l"
return parse_integer(yytext + 2, 16);
YY_BREAK
case 7:
YY_RULE_SETUP
#line 42 "fmd_scanner.l"
#line 38 "fmd_scanner.l"
return copy_string(yytext);
YY_BREAK
case 8:
YY_RULE_SETUP
#line 43 "fmd_scanner.l"
#line 39 "fmd_scanner.l"
return *yytext;
YY_BREAK
case 9:
YY_RULE_SETUP
#line 45 "fmd_scanner.l"
#line 41 "fmd_scanner.l"
ECHO;
YY_BREAK
#line 822 "<stdout>"
#line 828 "<stdout>"
case YY_STATE_EOF(INITIAL):
yyterminate();
@ -961,9 +967,9 @@ case YY_STATE_EOF(INITIAL):
*/
static int yy_get_next_buffer (void)
{
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = (yytext_ptr);
register int number_to_move, i;
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
char *source = (yytext_ptr);
yy_size_t number_to_move, i;
int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
@ -992,7 +998,7 @@ static int yy_get_next_buffer (void)
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
@ -1074,9 +1080,9 @@ static int yy_get_next_buffer (void)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
@ -1095,14 +1101,14 @@ static int yy_get_next_buffer (void)
static yy_state_type yy_get_previous_state (void)
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_state_type yy_current_state;
char *yy_cp;
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@ -1127,10 +1133,10 @@ static int yy_get_next_buffer (void)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
{
register int yy_is_jam;
register char *yy_cp = (yy_c_buf_p);
int yy_is_jam;
char *yy_cp = (yy_c_buf_p);
register YY_CHAR yy_c = 1;
YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@ -1148,9 +1154,11 @@ static int yy_get_next_buffer (void)
return yy_is_jam ? 0 : yy_current_state;
}
static void yyunput (int c, register char * yy_bp )
#ifndef YY_NO_UNPUT
static void yyunput (int c, char * yy_bp )
{
register char *yy_cp;
char *yy_cp;
yy_cp = (yy_c_buf_p);
@ -1160,10 +1168,10 @@ 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 yy_size_t number_to_move = (yy_n_chars) + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
yy_size_t number_to_move = (yy_n_chars) + 2;
char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
register char *source =
char *source =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
@ -1185,6 +1193,8 @@ static int yy_get_next_buffer (void)
(yy_c_buf_p) = yy_cp;
}
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput (void)
@ -1334,7 +1344,7 @@ static void yy_load_buffer_state (void)
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.
@ -1489,7 +1499,7 @@ static void yyensure_buffer_stack (void)
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
*/
num_to_alloc = 1;
num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
@ -1506,7 +1516,7 @@ static void yyensure_buffer_stack (void)
if ((yy_buffer_stack_top) >= ((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_buffer_stack_max) + grow_size;
(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
@ -1680,29 +1690,29 @@ char *yyget_text (void)
}
/** Set the current line number.
* @param line_number
* @param _line_number line number
*
*/
void yyset_lineno (int line_number )
void yyset_lineno (int _line_number )
{
yylineno = line_number;
yylineno = _line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param in_str A readable stream.
* @param _in_str A readable stream.
*
* @see yy_switch_to_buffer
*/
void yyset_in (FILE * in_str )
void yyset_in (FILE * _in_str )
{
yyin = in_str ;
yyin = _in_str ;
}
void yyset_out (FILE * out_str )
void yyset_out (FILE * _out_str )
{
yyout = out_str ;
yyout = _out_str ;
}
int yyget_debug (void)
@ -1710,9 +1720,9 @@ int yyget_debug (void)
return yy_flex_debug;
}
void yyset_debug (int bdebug )
void yyset_debug (int _bdebug )
{
yy_flex_debug = bdebug ;
yy_flex_debug = _bdebug ;
}
static int yy_init_globals (void)
@ -1772,7 +1782,8 @@ int yylex_destroy (void)
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
register int i;
int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
@ -1781,7 +1792,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
register int n;
int n;
for ( n = 0; s[n]; ++n )
;
@ -1796,6 +1807,7 @@ void *yyalloc (yy_size_t size )
void *yyrealloc (void * ptr, yy_size_t size )
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
@ -1813,7 +1825,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 44 "fmd_scanner.l"
#line 41 "fmd_scanner.l"
@ -1849,3 +1861,4 @@ int copy_string(const char *src)
yylval.strval = strdup(src);
return STRING;
}

View File

@ -2,7 +2,7 @@
#define yyHEADER_H 1
#define yyIN_HEADER 1
#line 6 "fmd_scanner.h"
#line 6 "fmd_scanner.h_shipped"
#define YY_INT_ALIGNED short int
@ -10,8 +10,8 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 39
#define YY_FLEX_MINOR_VERSION 6
#define YY_FLEX_SUBMINOR_VERSION 0
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@ -155,7 +155,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
yy_size_t yy_n_chars;
int 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
@ -207,12 +207,15 @@ void yyfree (void * );
/* Begin user sect3 */
#define yywrap() 1
#define yywrap() (/*CONSTCOND*/1)
#define YY_SKIP_YYWRAP
extern int yylineno;
extern char *yytext;
#ifdef yytext_ptr
#undef yytext_ptr
#endif
#define yytext_ptr yytext
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
@ -247,11 +250,11 @@ void yyset_extra (YY_EXTRA_TYPE user_defined );
FILE *yyget_in (void );
void yyset_in (FILE * in_str );
void yyset_in (FILE * _in_str );
FILE *yyget_out (void );
void yyset_out (FILE * out_str );
void yyset_out (FILE * _out_str );
yy_size_t yyget_leng (void );
@ -259,7 +262,7 @@ char *yyget_text (void );
int yyget_lineno (void );
void yyset_lineno (int line_number );
void yyset_lineno (int _line_number );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -325,9 +328,9 @@ extern int yylex (void);
#undef YY_DECL
#endif
#line 44 "fmd_scanner.l"
#line 41 "fmd_scanner.l"
#line 332 "fmd_scanner.h"
#line 335 "fmd_scanner.h_shipped"
#undef yyIN_HEADER
#endif /* yyHEADER_H */

View File

@ -34,7 +34,7 @@ MULTIPLIER [KMG]
0{MULTIPLIER}? |
[1-9][0-9]*{MULTIPLIER}? return parse_integer(yytext, 10);
0[0-9]+{MULTIPLIER}? return OCTAL;
0[xX][0-9a-f]+{MULTIPLIER}? return parse_integer(yytext + 2, 16);
0[xX][0-9a-fA-F]+{MULTIPLIER}? return parse_integer(yytext + 2, 16);
[^#@{}()[:space:]]* return copy_string(yytext);
. return *yytext;