From 9497fcb742cebafb8d47f4cc3f0da796b0490498 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Mon, 4 Mar 2019 14:28:37 +0800 Subject: cbfstool: Change FMD annotation to flags The idea of "annotation" for firmware sections was pretty flexible, but in future we will want multiple attributes applied to same area. For example, indicate the section must be preserved when updating firmware so serial number or MAC address can be preserved. The solution here is to extend annotation so it can take multiple identifiers (flags) in a row. For example, to declare a 64KB COREBOOT section as CBFS using annotation: COREBOOT(CBFS)@0x0 64k If there's a new flag "PRESERVE" indicating the section must be preserved before update, we can declare it following CBFS flag: COREBOOT(CBFS PRESERVE)@0x0 64k The flags are directly parsed in fmd_parser, and stored in an union flashmap_flags. Output modules can choose to ignore or process the flags. Currently the only supported flag is "CBFS" (for backward compatible with annotation). There will be more new flags in follow up patches. BUG=chromium:936768 TEST=make; boots on x86 "google/eve" and arm "google/kukui" devices Change-Id: Ie2d99f570e6faff6ed3a4344d6af7526a4515fae Signed-off-by: Hung-Te Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/31706 Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) --- util/cbfstool/fmd_scanner.c_shipped | 266 +++++++++++++++++++----------------- 1 file changed, 142 insertions(+), 124 deletions(-) (limited to 'util/cbfstool/fmd_scanner.c_shipped') diff --git a/util/cbfstool/fmd_scanner.c_shipped b/util/cbfstool/fmd_scanner.c_shipped index 61215cf17c..b1b78e2603 100644 --- a/util/cbfstool/fmd_scanner.c_shipped +++ b/util/cbfstool/fmd_scanner.c_shipped @@ -8,7 +8,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 0 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -87,25 +87,13 @@ typedef unsigned int flex_uint32_t; #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ @@ -166,7 +154,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t yyleng; +extern int yyleng; extern FILE *yyin, *yyout; @@ -205,7 +193,7 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. @@ -233,7 +221,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -261,7 +249,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -281,10 +269,10 @@ 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 int yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ @@ -309,7 +297,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); @@ -346,7 +334,7 @@ void yyfree (void * ); typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; @@ -363,23 +351,20 @@ extern char *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[] ); +static void yynoreturn yy_fatal_error (yyconst char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 9 -#define YY_END_OF_BUFFER 10 +#define YY_NUM_RULES 12 +#define YY_END_OF_BUFFER 13 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -387,11 +372,12 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[24] = +static yyconst flex_int16_t yy_accept[32] = { 0, - 7, 7, 10, 7, 1, 1, 8, 8, 3, 4, - 7, 1, 0, 2, 5, 3, 7, 4, 4, 5, - 6, 6, 0 + 10, 10, 10, 10, 13, 10, 1, 1, 11, 3, + 11, 6, 7, 4, 10, 10, 1, 0, 2, 8, + 6, 10, 7, 7, 10, 8, 9, 10, 9, 5, + 0 } ; static yyconst YY_CHAR yy_ec[256] = @@ -400,16 +386,16 @@ static yyconst YY_CHAR yy_ec[256] = 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, - - 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, + 6, 1, 1, 1, 1, 1, 1, 7, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, + 1, 1, 1, 9, 10, 11, 12, 10, 10, 13, + 14, 1, 1, 1, 14, 1, 14, 1, 1, 1, + 1, 1, 15, 1, 1, 1, 1, 16, 1, 1, + 1, 1, 1, 1, 1, 1, 10, 10, 10, 10, + + 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, + 1, 1, 9, 1, 9, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -426,41 +412,56 @@ static yyconst YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst YY_CHAR yy_meta[11] = +static yyconst YY_CHAR yy_meta[17] = { 0, - 1, 2, 2, 3, 3, 1, 1, 1, 1, 1 + 1, 2, 2, 2, 2, 2, 1, 1, 2, 1, + 1, 1, 1, 1, 1, 1 } ; -static yyconst flex_uint16_t yy_base[27] = +static yyconst flex_uint16_t yy_base[35] = { 0, - 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 + 0, 0, 11, 12, 44, 0, 17, 19, 38, 77, + 77, 18, 28, 77, 29, 0, 25, 36, 77, 15, + 0, 42, 0, 0, 25, 0, 58, 22, 0, 0, + 77, 32, 74, 29 } ; -static yyconst flex_int16_t yy_def[27] = +static yyconst flex_int16_t yy_def[35] = { 0, - 23, 1, 23, 24, 25, 25, 26, 23, 23, 24, - 24, 25, 26, 23, 9, 24, 24, 10, 24, 24, - 17, 24, 0, 23, 23, 23 + 31, 1, 1, 1, 31, 32, 31, 31, 33, 31, + 31, 32, 32, 31, 32, 32, 31, 33, 31, 12, + 32, 34, 13, 32, 32, 32, 34, 32, 32, 32, + 0, 31, 31, 31 } ; -static yyconst flex_uint16_t yy_nxt[45] = +static yyconst flex_uint16_t yy_nxt[94] = { 0, - 4, 5, 6, 7, 8, 9, 10, 4, 4, 4, - 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 + 6, 7, 8, 9, 10, 11, 12, 13, 11, 6, + 6, 6, 6, 6, 6, 6, 14, 14, 17, 17, + 17, 17, 15, 15, 20, 20, 17, 17, 26, 27, + 16, 21, 16, 22, 23, 23, 30, 28, 19, 25, + 19, 24, 16, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 16, 16, 16, 16, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 29, 16, 16, 18, 18, 5, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31 + } ; -static yyconst flex_int16_t yy_chk[45] = +static yyconst flex_int16_t yy_chk[94] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 9, 25, 24, 21, 13, 9, 9, 9, 9, 9, - 10, 10, 7, 10, 15, 15, 17, 17, 17, 26, - 26, 26, 3, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23 + 1, 1, 1, 1, 1, 1, 3, 4, 7, 7, + 8, 8, 3, 4, 12, 12, 17, 17, 20, 34, + 20, 12, 32, 12, 13, 13, 28, 25, 18, 15, + 9, 13, 22, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 22, 22, 22, 27, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 27, 27, 27, 33, 33, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31 + } ; static yy_state_type yy_last_accepting_state; @@ -500,9 +501,11 @@ char *yytext; int parse_integer(char *src, int base); int copy_string(const char *src); -#line 504 "" + +#line 506 "" #define INITIAL 0 +#define FLAGS 1 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way @@ -539,7 +542,7 @@ FILE *yyget_out (void ); void yyset_out (FILE * _out_str ); -yy_size_t yyget_leng (void ); + int yyget_leng (void ); char *yyget_text (void ); @@ -598,7 +601,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -622,7 +625,7 @@ static int input (void ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -718,10 +721,9 @@ YY_DECL } { -#line 30 "fmd_scanner.l" - +#line 31 "fmd_scanner.l" -#line 725 "" +#line 727 "" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -748,13 +750,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 24 ) + if ( yy_current_state >= 32 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 34 ); + while ( yy_base[yy_current_state] != 77 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -793,39 +795,55 @@ YY_RULE_SETUP /* Eat comments. */ YY_BREAK case 3: -#line 35 "fmd_scanner.l" +YY_RULE_SETUP +#line 34 "fmd_scanner.l" +BEGIN(FLAGS); return *yytext; + YY_BREAK case 4: YY_RULE_SETUP #line 35 "fmd_scanner.l" -return parse_integer(yytext, 10); +BEGIN(INITIAL); return *yytext; YY_BREAK case 5: YY_RULE_SETUP #line 36 "fmd_scanner.l" -return OCTAL; +return FLAG_CBFS; YY_BREAK case 6: -YY_RULE_SETUP -#line 37 "fmd_scanner.l" -return parse_integer(yytext + 2, 16); - YY_BREAK +#line 38 "fmd_scanner.l" case 7: YY_RULE_SETUP #line 38 "fmd_scanner.l" -return copy_string(yytext); +return parse_integer(yytext, 10); YY_BREAK case 8: YY_RULE_SETUP #line 39 "fmd_scanner.l" -return *yytext; +return OCTAL; YY_BREAK case 9: YY_RULE_SETUP +#line 40 "fmd_scanner.l" +return parse_integer(yytext + 2, 16); + YY_BREAK +case 10: +YY_RULE_SETUP #line 41 "fmd_scanner.l" +return copy_string(yytext); + YY_BREAK +case 11: +YY_RULE_SETUP +#line 42 "fmd_scanner.l" +return *yytext; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 44 "fmd_scanner.l" ECHO; YY_BREAK -#line 828 "" +#line 845 "" case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(FLAGS): yyterminate(); case YY_END_OF_BUFFER: @@ -969,7 +987,7 @@ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); - yy_size_t number_to_move, i; + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -998,7 +1016,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1011,7 +1029,7 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1025,7 +1043,7 @@ static int yy_get_next_buffer (void) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1038,7 +1056,7 @@ static int yy_get_next_buffer (void) } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1080,7 +1098,7 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((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_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 ); @@ -1117,10 +1135,10 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 24 ) + if ( yy_current_state >= 32 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; } return yy_current_state; @@ -1145,11 +1163,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 24 ) + if ( yy_current_state >= 32 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 23); + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_is_jam = (yy_current_state == 31); return yy_is_jam ? 0 : yy_current_state; } @@ -1168,7 +1186,7 @@ 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. */ - yy_size_t number_to_move = (yy_n_chars) + 2; + int number_to_move = (yy_n_chars) + 2; char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; char *source = @@ -1180,7 +1198,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -1219,7 +1237,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1243,7 +1261,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) - return EOF; + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1491,7 +1509,7 @@ void yypop_buffer_state (void) */ static void yyensure_buffer_stack (void) { - yy_size_t num_to_alloc; + int num_to_alloc; if (!(yy_buffer_stack)) { @@ -1499,15 +1517,15 @@ 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; /* After all that talk, this was set to 1 anyways... */ + 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*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -1536,7 +1554,7 @@ static void yyensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { @@ -1546,7 +1564,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) @@ -1555,7 +1573,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 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 = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; @@ -1578,7 +1596,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { - return yy_scan_bytes(yystr,strlen(yystr) ); + return yy_scan_bytes(yystr,(int) strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will @@ -1588,15 +1606,15 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - yy_size_t i; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; + n = (yy_size_t) (_yybytes_len + 2); buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); @@ -1622,7 +1640,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); @@ -1652,7 +1670,7 @@ static void yy_fatal_error (yyconst char* msg ) */ int yyget_lineno (void) { - + return yylineno; } @@ -1675,7 +1693,7 @@ FILE *yyget_out (void) /** Get the length of the current token. * */ -yy_size_t yyget_leng (void) +int yyget_leng (void) { return yyleng; } @@ -1731,10 +1749,10 @@ static int yy_init_globals (void) * This function is called from yylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; @@ -1743,8 +1761,8 @@ static int yy_init_globals (void) yyin = stdin; yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -1802,7 +1820,7 @@ static int yy_flex_strlen (yyconst char * s ) void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } void *yyrealloc (void * ptr, yy_size_t size ) @@ -1815,7 +1833,7 @@ void *yyrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } void yyfree (void * ptr ) @@ -1825,7 +1843,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 41 "fmd_scanner.l" +#line 44 "fmd_scanner.l" -- cgit v1.2.3