From 84465fe991e930ebc5f6116d6e4f4f6dd1f7bdc1 Mon Sep 17 00:00:00 2001 From: dgram0 Date: Fri, 26 Feb 2016 14:41:37 -0500 Subject: [PATCH 1/3] CLN/BUILD: Fix warnings on build --- pandas/src/datetime/np_datetime_strings.c | 2 +- pandas/src/klib/khash.h | 2 +- pandas/src/msgpack/unpack.h | 4 ++-- pandas/src/msgpack/unpack_template.h | 2 +- pandas/src/parser/io.h | 2 +- pandas/src/parser/tokenizer.c | 4 ++-- pandas/src/parser/tokenizer.h | 2 +- pandas/src/period_helper.c | 6 ++---- pandas/src/ujson/lib/ultrajsondec.c | 6 ------ 9 files changed, 11 insertions(+), 19 deletions(-) diff --git a/pandas/src/datetime/np_datetime_strings.c b/pandas/src/datetime/np_datetime_strings.c index 1e59b31da1e65..e92b7dbddc808 100644 --- a/pandas/src/datetime/np_datetime_strings.c +++ b/pandas/src/datetime/np_datetime_strings.c @@ -400,7 +400,7 @@ parse_iso_8601_datetime(char *str, int len, * an error code will be retuned because the date is ambigous */ int has_sep = 0; - char sep; + char sep = NULL; char valid_sep[] = {'-', '.', '/', '\\', ' '}; int valid_sep_len = 5; diff --git a/pandas/src/klib/khash.h b/pandas/src/klib/khash.h index 10c437c22fe1d..0f1a17c6333f4 100644 --- a/pandas/src/klib/khash.h +++ b/pandas/src/klib/khash.h @@ -152,7 +152,7 @@ typedef khint_t khiter_t; #define __ac_set_isempty_false(flag, i) (flag[i>>5]&=~(1ul<<(i&0x1fU))) #define __ac_set_isempty_true(flag, i) (flag[i>>5]|=(1ul<<(i&0x1fU))) #define __ac_set_isboth_false(flag, i) __ac_set_isempty_false(flag, i) -#define __ac_set_isdel_true(flag, i) (0) +#define __ac_set_isdel_true(flag, i) ((void)0) #ifdef KHASH_LINEAR #define __ac_inc(k, m) 1 diff --git a/pandas/src/msgpack/unpack.h b/pandas/src/msgpack/unpack.h index 3f9d0f1b64895..591fad1ae4661 100644 --- a/pandas/src/msgpack/unpack.h +++ b/pandas/src/msgpack/unpack.h @@ -265,9 +265,9 @@ static inline int unpack_callback_ext(unpack_user* u, const char* base, const ch } // length also includes the typecode, so the actual data is length-1 #if PY_MAJOR_VERSION == 2 - py = PyObject_CallFunction(u->ext_hook, "(is#)", typecode, pos, (Py_ssize_t)length-1); + py = PyObject_CallFunction(u->ext_hook, (char*)"(is#)", typecode, pos, (Py_ssize_t)length-1); #else - py = PyObject_CallFunction(u->ext_hook, "(iy#)", typecode, pos, (Py_ssize_t)length-1); + py = PyObject_CallFunction(u->ext_hook, (char*)"(iy#)", typecode, pos, (Py_ssize_t)length-1); #endif if (!py) return -1; diff --git a/pandas/src/msgpack/unpack_template.h b/pandas/src/msgpack/unpack_template.h index d34eceda6ab69..95af6735520fc 100644 --- a/pandas/src/msgpack/unpack_template.h +++ b/pandas/src/msgpack/unpack_template.h @@ -89,7 +89,7 @@ static inline int unpack_execute(unpack_context* ctx, const char* data, size_t l */ unpack_user* user = &ctx->user; - PyObject* obj; + PyObject* obj = NULL; unpack_stack* c = NULL; int ret; diff --git a/pandas/src/parser/io.h b/pandas/src/parser/io.h index f5831ad9971a1..2ae72ff8a7fe0 100644 --- a/pandas/src/parser/io.h +++ b/pandas/src/parser/io.h @@ -29,7 +29,7 @@ typedef struct _file_source { #define FS(source) ((file_source *)source) -#if !defined(_WIN32) +#if !defined(_WIN32) && !defined(HAVE_MMAP) #define HAVE_MMAP #endif diff --git a/pandas/src/parser/tokenizer.c b/pandas/src/parser/tokenizer.c index 8fd3674047301..a19930a5cef30 100644 --- a/pandas/src/parser/tokenizer.c +++ b/pandas/src/parser/tokenizer.c @@ -2185,7 +2185,7 @@ double xstrtod(const char *str, char **endptr, char decimal, p++; num_digits++; - p += (tsep != '\0' & *p == tsep); + p += (tsep != '\0' && *p == tsep); } // Process decimal part @@ -2358,7 +2358,7 @@ double precise_xstrtod(const char *str, char **endptr, char decimal, ++exponent; p++; - p += (tsep != '\0' & *p == tsep); + p += (tsep != '\0' && *p == tsep); } // Process decimal part diff --git a/pandas/src/parser/tokenizer.h b/pandas/src/parser/tokenizer.h index 6aac34ecce41e..a2d7925df08e2 100644 --- a/pandas/src/parser/tokenizer.h +++ b/pandas/src/parser/tokenizer.h @@ -267,7 +267,7 @@ double xstrtod(const char *p, char **q, char decimal, char sci, char tsep, int s double precise_xstrtod(const char *p, char **q, char decimal, char sci, char tsep, int skip_trailing); double round_trip(const char *p, char **q, char decimal, char sci, char tsep, int skip_trailing); //int P_INLINE to_complex(char *item, double *p_real, double *p_imag, char sci, char decimal); -int P_INLINE to_longlong(char *item, long long *p_value); +//int P_INLINE to_longlong(char *item, long long *p_value); //int P_INLINE to_longlong_thousands(char *item, long long *p_value, char tsep); int to_boolean(const char *item, uint8_t *val); diff --git a/pandas/src/period_helper.c b/pandas/src/period_helper.c index 86672e1a753ea..6078be6fc3d19 100644 --- a/pandas/src/period_helper.c +++ b/pandas/src/period_helper.c @@ -30,8 +30,6 @@ static int floordiv(int x, int divisor) { } } -static asfreq_info NULL_AF_INFO; - /* Table with day offsets for each month (0-based, without and with leap) */ static int month_offset[2][13] = { { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, @@ -299,7 +297,7 @@ PANDAS_INLINE int get_freq_group_index(int freq) { return freq/1000; } -static int calc_conversion_factors_matrix_size() { +static int calc_conversion_factors_matrix_size(void) { int matrix_size = 0; int index; for (index=0;; index++) { @@ -348,7 +346,7 @@ static npy_int64 calculate_conversion_factor(int start_value, int end_value) { return conversion_factor; } -static void populate_conversion_factors_matrix() { +static void populate_conversion_factors_matrix(void) { int row_index_index; int row_value, row_index; int column_index_index; diff --git a/pandas/src/ujson/lib/ultrajsondec.c b/pandas/src/ujson/lib/ultrajsondec.c index 3e316eb26e6e1..9a4d5972b101b 100644 --- a/pandas/src/ujson/lib/ultrajsondec.c +++ b/pandas/src/ujson/lib/ultrajsondec.c @@ -76,12 +76,6 @@ static JSOBJ SetError( struct DecoderState *ds, int offset, const char *message) return NULL; } -static void ClearError( struct DecoderState *ds) -{ - ds->dec->errorOffset = 0; - ds->dec->errorStr = NULL; -} - double createDouble(double intNeg, double intValue, double frcValue, int frcDecimalCount) { static const double g_pow10[] = {1.0, 0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001,0.0000001, 0.00000001, 0.000000001, 0.0000000001, 0.00000000001, 0.000000000001, 0.0000000000001, 0.00000000000001, 0.000000000000001}; From 926e201da026cb2858627af9f87f85dd2deff5e0 Mon Sep 17 00:00:00 2001 From: dgram0 Date: Fri, 26 Feb 2016 14:48:55 -0500 Subject: [PATCH 2/3] Document warning cleanup --- doc/source/whatsnew/v0.18.1.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/source/whatsnew/v0.18.1.txt b/doc/source/whatsnew/v0.18.1.txt index 70a1ad4a335ea..309e8b35e2df1 100644 --- a/doc/source/whatsnew/v0.18.1.txt +++ b/doc/source/whatsnew/v0.18.1.txt @@ -43,3 +43,5 @@ Performance Improvements Bug Fixes ~~~~~~~~~ + +- Removed some compiler warnings (:issue:`5385`) From e7c243722a0eb1400cbd0509909852d3ad50397a Mon Sep 17 00:00:00 2001 From: dgram0 Date: Fri, 26 Feb 2016 16:07:27 -0500 Subject: [PATCH 3/3] Null assignments to char should be written as '\0'. --- pandas/src/datetime/np_datetime_strings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/src/datetime/np_datetime_strings.c b/pandas/src/datetime/np_datetime_strings.c index e92b7dbddc808..33ddc6c6e1f27 100644 --- a/pandas/src/datetime/np_datetime_strings.c +++ b/pandas/src/datetime/np_datetime_strings.c @@ -400,7 +400,7 @@ parse_iso_8601_datetime(char *str, int len, * an error code will be retuned because the date is ambigous */ int has_sep = 0; - char sep = NULL; + char sep = '\0'; char valid_sep[] = {'-', '.', '/', '\\', ' '}; int valid_sep_len = 5;