From 00a6ef3d4f014da9c1dffd33f0a37b5bc1627bd8 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Tue, 29 Mar 2011 09:49:39 -0700 Subject: [PATCH] Fix compile issues locally. --- libmemcached/options/scanner.cc | 51 ++++++++++++++++++--------------- libmemcached/options/scanner.h | 22 ++++++++------ tests/virtual_buckets.cc | 2 +- 3 files changed, 42 insertions(+), 33 deletions(-) diff --git a/libmemcached/options/scanner.cc b/libmemcached/options/scanner.cc index 8b5aa8e3..ecc818c0 100644 --- a/libmemcached/options/scanner.cc +++ b/libmemcached/options/scanner.cc @@ -226,11 +226,6 @@ typedef void* yyscan_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 - /* %if-not-reentrant */ /* %endif */ @@ -261,6 +256,11 @@ typedef size_t yy_size_t; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) +#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 @@ -283,7 +283,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 @@ -380,7 +380,7 @@ static void config__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanne YY_BUFFER_STATE config__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE config__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE config__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE config__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); /* %endif */ @@ -1393,8 +1393,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - yy_size_t yy_n_chars; - yy_size_t yyleng_r; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -1457,7 +1457,7 @@ FILE *config_get_out (yyscan_t yyscanner ); void config_set_out (FILE * out_str ,yyscan_t yyscanner ); -yy_size_t config_get_leng (yyscan_t yyscanner ); +int config_get_leng (yyscan_t yyscanner ); char *config_get_text (yyscan_t yyscanner ); @@ -1465,6 +1465,10 @@ int config_get_lineno (yyscan_t yyscanner ); void config_set_lineno (int line_number ,yyscan_t yyscanner ); +int config_get_column (yyscan_t yyscanner ); + +void config_set_column (int column_no ,yyscan_t yyscanner ); + /* %if-bison-bridge */ YYSTYPE * config_get_lval (yyscan_t yyscanner ); @@ -1528,7 +1532,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) /* %endif */ /* %if-c++-only C++ definition */ /* %endif */ @@ -1543,7 +1547,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1660,7 +1664,7 @@ YY_DECL -#line 1664 "libmemcached/options/scanner.cc" +#line 1668 "libmemcached/options/scanner.cc" yylval = yylval_param; @@ -2293,7 +2297,7 @@ YY_RULE_SETUP #line 224 "libmemcached/options/scanner.l" ECHO; YY_BREAK -#line 2297 "libmemcached/options/scanner.cc" +#line 2301 "libmemcached/options/scanner.cc" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2493,7 +2497,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 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 ) @@ -2507,7 +2511,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 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; @@ -2538,7 +2542,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); + yyg->yy_n_chars, (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -2685,7 +2689,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -2709,7 +2713,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) case EOB_ACT_END_OF_FILE: { if ( config_wrap(yyscanner ) ) - return 0; + return EOF; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -3031,7 +3035,7 @@ static void config_ensure_buffer_stack (yyscan_t yyscanner) /* %if-c++-only */ /* %endif */ { - yy_size_t num_to_alloc; + int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -3135,11 +3139,12 @@ YY_BUFFER_STATE config__scan_string (yyconst char * yystr , yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE config__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE config__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -3259,7 +3264,7 @@ FILE *config_get_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t config_get_leng (yyscan_t yyscanner) +int config_get_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; diff --git a/libmemcached/options/scanner.h b/libmemcached/options/scanner.h index 4572213d..062d9adf 100644 --- a/libmemcached/options/scanner.h +++ b/libmemcached/options/scanner.h @@ -187,11 +187,6 @@ typedef void* yyscan_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 - /* %if-not-reentrant */ /* %endif */ @@ -200,6 +195,11 @@ typedef size_t yy_size_t; /* %endif */ /* %endif */ +#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 @@ -222,7 +222,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 @@ -278,7 +278,7 @@ void config_pop_buffer_state (yyscan_t yyscanner ); YY_BUFFER_STATE config__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE config__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE config__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE config__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); /* %endif */ @@ -359,7 +359,7 @@ FILE *config_get_out (yyscan_t yyscanner ); void config_set_out (FILE * out_str ,yyscan_t yyscanner ); -yy_size_t config_get_leng (yyscan_t yyscanner ); +int config_get_leng (yyscan_t yyscanner ); char *config_get_text (yyscan_t yyscanner ); @@ -367,6 +367,10 @@ int config_get_lineno (yyscan_t yyscanner ); void config_set_lineno (int line_number ,yyscan_t yyscanner ); +int config_get_column (yyscan_t yyscanner ); + +void config_set_column (int column_no ,yyscan_t yyscanner ); + /* %if-bison-bridge */ YYSTYPE * config_get_lval (yyscan_t yyscanner ); @@ -469,6 +473,6 @@ extern int config_lex \ #line 224 "libmemcached/options/scanner.l" -#line 473 "libmemcached/options/scanner.h" +#line 477 "libmemcached/options/scanner.h" #undef config_IN_HEADER #endif /* config_HEADER_H */ diff --git a/tests/virtual_buckets.cc b/tests/virtual_buckets.cc index 60837d11..73db3001 100644 --- a/tests/virtual_buckets.cc +++ b/tests/virtual_buckets.cc @@ -56,7 +56,7 @@ static inline libtest_string_t libtest_string(const char *arg, size_t arg_size) static libtest_string_t libtest_string_t_null= { 0, 0}; -bool libtest_string_is_null(const libtest_string_t &string) +static bool libtest_string_is_null(const libtest_string_t &string) { if (string.c_str == 0 and string.size == 0) return true; -- 2.30.2