[coreboot-gerrit] New patch to review for coreboot: 0ececca cbfstool: Fix fmd_scanner build compatibility
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Sat May 9 10:09:18 CEST 2015
Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10162
-gerrit
commit 0ececca05d63e7f0496e43077530b6e1fbecbb2e
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date: Sat May 9 08:06:02 2015 +0300
cbfstool: Fix fmd_scanner build compatibility
Fixes this:
error: declaration of ‘input’ shadows a global declaration [-Werror=shadow]
Change-Id: I4563d36e5389db4fdc5be3ca4e0e88af2642f7f8
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
util/cbfstool/fmd_scanner.c | 85 +++++++++++++++++++++++----------------------
util/cbfstool/fmd_scanner.h | 20 +++++------
util/cbfstool/fmd_scanner.l | 12 +++----
3 files changed, 59 insertions(+), 58 deletions(-)
diff --git a/util/cbfstool/fmd_scanner.c b/util/cbfstool/fmd_scanner.c
index d0d93d3..2513009 100644
--- a/util/cbfstool/fmd_scanner.c
+++ b/util/cbfstool/fmd_scanner.c
@@ -8,7 +8,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 39
+#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -161,12 +161,7 @@ typedef unsigned int flex_uint32_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-extern yy_size_t yyleng;
+extern int yyleng;
extern FILE *yyin, *yyout;
@@ -175,7 +170,6 @@ extern FILE *yyin, *yyout;
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
- #define YY_LINENO_REWIND_TO(ptr)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
@@ -193,6 +187,11 @@ extern FILE *yyin, *yyout;
#define unput(c) yyunput( c, (yytext_ptr) )
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
@@ -210,7 +209,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,8 +279,8 @@ 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 */
-yy_size_t yyleng;
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+int yyleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
@@ -309,7 +308,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 );
@@ -341,7 +340,7 @@ void yyfree (void * );
/* Begin user sect3 */
-#define yywrap() 1
+#define yywrap(n) 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
@@ -496,9 +495,9 @@ char *yytext;
#include <assert.h>
#include <string.h>
-int parse_integer(char *input, int base);
-int copy_string(const char *input);
-#line 502 "<stdout>"
+int parse_integer(char *src, int base);
+int copy_string(const char *src);
+#line 501 "<stdout>"
#define INITIAL 0
@@ -537,7 +536,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 );
@@ -685,6 +684,11 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
+#line 34 "fmd_scanner.l"
+
+
+#line 691 "<stdout>"
+
if ( !(yy_init) )
{
(yy_init) = 1;
@@ -711,12 +715,6 @@ YY_DECL
yy_load_buffer_state( );
}
- {
-#line 34 "fmd_scanner.l"
-
-
-#line 719 "<stdout>"
-
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = (yy_c_buf_p);
@@ -733,7 +731,7 @@ YY_DECL
yy_match:
do
{
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
+ register 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;
@@ -818,7 +816,7 @@ YY_RULE_SETUP
#line 45 "fmd_scanner.l"
ECHO;
YY_BREAK
-#line 822 "<stdout>"
+#line 820 "<stdout>"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -949,7 +947,6 @@ case YY_STATE_EOF(INITIAL):
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
- } /* end of user's declarations */
} /* end of yylex */
/* yy_get_next_buffer - try to read in a new buffer
@@ -1005,21 +1002,21 @@ 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 )
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
int yy_c_buf_p_offset =
(int) ((yy_c_buf_p) - b->yy_ch_buf);
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;
@@ -1050,7 +1047,7 @@ static int yy_get_next_buffer (void)
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- (yy_n_chars), num_to_read );
+ (yy_n_chars), (size_t) num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
@@ -1145,7 +1142,7 @@ static int yy_get_next_buffer (void)
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 23);
- return yy_is_jam ? 0 : yy_current_state;
+ return yy_is_jam ? 0 : yy_current_state;
}
static void yyunput (int c, register char * yy_bp )
@@ -1160,7 +1157,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. */
- register yy_size_t number_to_move = (yy_n_chars) + 2;
+ register int number_to_move = (yy_n_chars) + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
register char *source =
@@ -1209,7 +1206,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( ) )
@@ -1369,6 +1366,10 @@ static void yy_load_buffer_state (void)
yyfree((void *) b );
}
+#ifndef __cplusplus
+extern int isatty (int );
+#endif /* __cplusplus */
+
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a yyrestart() or at EOF.
@@ -1481,7 +1482,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)) {
@@ -1578,12 +1579,12 @@ 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;
@@ -1665,7 +1666,7 @@ FILE *yyget_out (void)
/** Get the length of the current token.
*
*/
-yy_size_t yyget_leng (void)
+int yyget_leng (void)
{
return yyleng;
}
@@ -1813,14 +1814,14 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 44 "fmd_scanner.l"
+#line 45 "fmd_scanner.l"
-int parse_integer(char *input, int base)
+int parse_integer(char *src, int base)
{
char *multiplier = NULL;
- unsigned val = strtoul(input, &multiplier, base);
+ unsigned val = strtoul(src, &multiplier, base);
if (*multiplier) {
switch(*multiplier) {
@@ -1844,9 +1845,9 @@ int parse_integer(char *input, int base)
return INTEGER;
}
-int copy_string(const char *input)
+int copy_string(const char *src)
{
- yylval.strval = strdup(input);
+ yylval.strval = strdup(src);
return STRING;
}
diff --git a/util/cbfstool/fmd_scanner.h b/util/cbfstool/fmd_scanner.h
index 595b530..6a56c5f 100644
--- a/util/cbfstool/fmd_scanner.h
+++ b/util/cbfstool/fmd_scanner.h
@@ -11,7 +11,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 39
+#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -129,15 +129,15 @@ typedef unsigned int flex_uint32_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
+extern int yyleng;
+
+extern FILE *yyin, *yyout;
+
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
-extern yy_size_t yyleng;
-
-extern FILE *yyin, *yyout;
-
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
@@ -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
@@ -199,7 +199,7 @@ void yypop_buffer_state (void );
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 );
@@ -207,7 +207,7 @@ void yyfree (void * );
/* Begin user sect3 */
-#define yywrap() 1
+#define yywrap(n) 1
#define YY_SKIP_YYWRAP
extern int yylineno;
@@ -253,7 +253,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 );
@@ -325,7 +325,7 @@ extern int yylex (void);
#undef YY_DECL
#endif
-#line 44 "fmd_scanner.l"
+#line 45 "fmd_scanner.l"
#line 332 "fmd_scanner.h"
diff --git a/util/cbfstool/fmd_scanner.l b/util/cbfstool/fmd_scanner.l
index d2cc43d..0a58210 100644
--- a/util/cbfstool/fmd_scanner.l
+++ b/util/cbfstool/fmd_scanner.l
@@ -23,8 +23,8 @@
#include <assert.h>
#include <string.h>
-int parse_integer(char *input, int base);
-int copy_string(const char *input);
+int parse_integer(char *src, int base);
+int copy_string(const char *src);
%}
%option noyywrap
@@ -44,10 +44,10 @@ MULTIPLIER [KMG]
%%
-int parse_integer(char *input, int base)
+int parse_integer(char *src, int base)
{
char *multiplier = NULL;
- unsigned val = strtoul(input, &multiplier, base);
+ unsigned val = strtoul(src, &multiplier, base);
if (*multiplier) {
switch(*multiplier) {
@@ -71,8 +71,8 @@ int parse_integer(char *input, int base)
return INTEGER;
}
-int copy_string(const char *input)
+int copy_string(const char *src)
{
- yylval.strval = strdup(input);
+ yylval.strval = strdup(src);
return STRING;
}
More information about the coreboot-gerrit
mailing list