From 961119bebde396f558423069f9fa354dd61f7c09 Mon Sep 17 00:00:00 2001 From: juliannguyen4 <109386615+juliannguyen4@users.noreply.github.com> Date: Thu, 24 Aug 2023 08:58:11 -0700 Subject: [PATCH] [CLIENT-2527] CI/CD: compile Python client with -Werror (#496) * Fix all warning errors --- .github/workflows/tests.yml | 2 ++ VERSION | 2 +- setup.py | 4 ++++ src/main/aerospike.c | 4 ++-- src/main/client/bit_operate.c | 4 ++-- src/main/conversions.c | 5 ++--- src/main/query/where.c | 1 - 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a4a0ae07c..5c243db31 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,6 +57,8 @@ jobs: - name: Build client run: python3 -m build + env: + CFLAGS: '-Werror' - name: Send wheel to test jobs uses: actions/upload-artifact@v3 diff --git a/VERSION b/VERSION index 6c3e91de8..0902f2789 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -14.0.0-rc.2 +14.0.0-rc.4 diff --git a/setup.py b/setup.py index fafcca248..24e8fac4c 100644 --- a/setup.py +++ b/setup.py @@ -91,6 +91,10 @@ 'z' ] +########################## +# GITHUB ACTIONS SETTINGS +########################## + if COVERAGE: extra_compile_args.append('-fprofile-arcs') extra_compile_args.append('-ftest-coverage') diff --git a/src/main/aerospike.c b/src/main/aerospike.c index 8cb0c8c81..75003df69 100644 --- a/src/main/aerospike.c +++ b/src/main/aerospike.c @@ -138,7 +138,7 @@ static int Aerospike_Clear(PyObject *aerospike) PyMODINIT_FUNC PyInit_aerospike(void) { - const char version[] = "14.0.0-rc.2"; + const char version[] = "14.0.0-rc.4"; // Makes things "thread-safe" Py_Initialize(); int i = 0; @@ -155,7 +155,7 @@ PyMODINIT_FUNC PyInit_aerospike(void) PyObject *aerospike = PyModule_Create(&moduledef); // In case adding objects to module fails, we can properly deallocate the module state later - memset(Aerospike_State(aerospike), NULL, sizeof(struct Aerospike_State)); + memset(Aerospike_State(aerospike), 0, sizeof(struct Aerospike_State)); Aerospike_Enable_Default_Logging(); diff --git a/src/main/client/bit_operate.c b/src/main/client/bit_operate.c index ce72448a3..c18c6b1d7 100644 --- a/src/main/client/bit_operate.c +++ b/src/main/client/bit_operate.c @@ -396,7 +396,7 @@ static as_status add_op_bit_add(AerospikeClient *self, as_error *err, char *bin, return err->code; } - uint64_t action_int64; + int64_t action_int64; if (get_int64_t(err, ACTION_KEY, op_dict, &action_int64) != AEROSPIKE_OK) { return err->code; } @@ -808,7 +808,7 @@ static as_status add_op_bit_subtract(AerospikeClient *self, as_error *err, return err->code; } - uint64_t action_int64; + int64_t action_int64; if (get_int64_t(err, ACTION_KEY, op_dict, &action_int64) != AEROSPIKE_OK) { return err->code; } diff --git a/src/main/conversions.c b/src/main/conversions.c index 79d0ff606..a79b4d1f9 100644 --- a/src/main/conversions.c +++ b/src/main/conversions.c @@ -657,7 +657,6 @@ as_status pyobject_to_strArray(as_error *err, PyObject *py_list, char **arr, { as_error_reset(err); - PyObject *py_u_str = NULL; if (!PyList_Check(py_list)) { return as_error_update(err, AEROSPIKE_ERR_CLIENT, "not a list"); @@ -834,7 +833,7 @@ as_status pyobject_to_val(AerospikeClient *self, as_error *err, Py_DECREF(py_parameter); PyObject *geospatial_dump = AerospikeGeospatial_DoDumps(py_data, err); - char *geo_value = PyUnicode_AsUTF8(geospatial_dump); + const char *geo_value = PyUnicode_AsUTF8(geospatial_dump); char *geo_value_cpy = strdup(geo_value); Py_DECREF(py_data); @@ -919,7 +918,7 @@ as_status pyobject_to_record(AerospikeClient *self, as_error *err, PyObject *key = NULL, *value = NULL; Py_ssize_t pos = 0; Py_ssize_t size = PyDict_Size(py_rec); - char *name = NULL; + const char *name; long ret_val = 0; as_record_init(rec, size); diff --git a/src/main/query/where.c b/src/main/query/where.c index 7fbb2b107..6dba7d744 100644 --- a/src/main/query/where.c +++ b/src/main/query/where.c @@ -354,7 +354,6 @@ AerospikeQuery *AerospikeQuery_Where_Invoke(AerospikeQuery *self, AerospikeQuery *AerospikeQuery_Where(AerospikeQuery *self, PyObject *args) { as_error err; - PyObject *py_err = NULL; PyObject *py_pred = NULL; PyObject *py_cdt_ctx = NULL;