From: Brian Aker Date: Tue, 21 Jun 2011 08:50:04 +0000 (-0700) Subject: Fix up warnings on linux. X-Git-Tag: 0.51~3^2~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=c443673eaba8b14b3aa1dce9a7059cd7a41d03e9;p=m6w6%2Flibmemcached Fix up warnings on linux. --- diff --git a/ChangeLog b/ChangeLog index 3e7cc639..eaf1862e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,6 @@ -0.50 - +0.50 Mon Jun 20 10:36:57 PDT 2011 * Updates to C++ interface * Custom free allocators need to now check for value before calling free. - * memcached_fetch_result() now uses the internal result when available (about 25 to 50% faster). 0.49 Thu Apr 14 08:43:37 PDT 2011 diff --git a/libmemcached/options/scanner.cc b/libmemcached/options/scanner.cc index 686db323..fd5a0cb9 100644 --- a/libmemcached/options/scanner.cc +++ b/libmemcached/options/scanner.cc @@ -227,11 +227,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 */ @@ -262,6 +257,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 @@ -284,7 +284,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 @@ -381,7 +381,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 */ @@ -1172,8 +1172,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; @@ -1236,7 +1236,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 ); @@ -1244,6 +1244,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 ); @@ -1307,7 +1311,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 */ @@ -1322,7 +1326,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; \ @@ -1439,7 +1443,7 @@ YY_DECL -#line 1443 "libmemcached/options/scanner.cc" +#line 1447 "libmemcached/options/scanner.cc" yylval = yylval_param; @@ -1915,7 +1919,7 @@ YY_RULE_SETUP #line 196 "libmemcached/options/scanner.l" ECHO; YY_BREAK -#line 1919 "libmemcached/options/scanner.cc" +#line 1923 "libmemcached/options/scanner.cc" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2115,7 +2119,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 ) @@ -2129,7 +2133,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; @@ -2160,7 +2164,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; } @@ -2307,7 +2311,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 ) ) @@ -2331,7 +2335,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; @@ -2653,7 +2657,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) { @@ -2757,11 +2761,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; @@ -2881,7 +2886,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 26031bac..3e7b5aee 100644 --- a/libmemcached/options/scanner.h +++ b/libmemcached/options/scanner.h @@ -188,11 +188,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 */ @@ -201,6 +196,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 @@ -223,7 +223,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 @@ -279,7 +279,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 */ @@ -360,7 +360,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 ); @@ -368,6 +368,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 ); @@ -470,6 +474,6 @@ extern int config_lex \ #line 196 "libmemcached/options/scanner.l" -#line 474 "libmemcached/options/scanner.h" +#line 478 "libmemcached/options/scanner.h" #undef config_IN_HEADER #endif /* config_HEADER_H */ diff --git a/tests/mem_udp.cc b/tests/mem_udp.cc index 3bee8cc4..650134ad 100644 --- a/tests/mem_udp.cc +++ b/tests/mem_udp.cc @@ -31,6 +31,9 @@ #define SERVERS_TO_CREATE 5 +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif /** @note This should be testing to see if the server really supports the binary protocol.