Skip to content

Commit fd4f47c

Browse files
committed
Add -Wall -Wextra -Werror cflags
1 parent 18329a8 commit fd4f47c

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
cflags.append("/experimental:c11atomics")
1717
else:
1818
cflags.append("-std=c17")
19+
cflags.append("-Wall")
20+
cflags.append("-Wextra")
21+
cflags.append("-Werror")
1922

2023
if py_limited_api:
2124
options["bdist_wheel"] = {"py_limited_api": "cp310"}

src/sonyflake_turbo/machine_ids.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bool has_machine_id_dupes(const uint16_t *machine_ids, int machine_ids_len) {
3838
return false;
3939
}
4040

41-
static PyObject *machine_id_lcg_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) {
41+
static PyObject *machine_id_lcg_new(PyTypeObject *type, PyObject *args, PyObject *Py_UNUSED(kwargs)) {
4242
unsigned int seed = 0;
4343

4444
if (!PyArg_ParseTuple(args, "I", &seed)) {
@@ -81,7 +81,7 @@ static PyObject *machine_id_lcg_repr(struct machine_id_lcg_state *self) {
8181
);
8282
}
8383

84-
static PyObject *machine_id_lcg_call(struct machine_id_lcg_state *self, PyObject *args, PyObject *kwargs) {
84+
static PyObject *machine_id_lcg_call(struct machine_id_lcg_state *self, PyObject *Py_UNUSED(args), PyObject *Py_UNUSED(kwargs)) {
8585
return machine_id_lcg_next(self);
8686
}
8787

@@ -100,7 +100,7 @@ PyType_Slot machine_id_lcg_slots[] = {
100100
{Py_tp_iternext, machine_id_lcg_next},
101101
{Py_tp_new, machine_id_lcg_new},
102102
{Py_tp_call, machine_id_lcg_call},
103-
{Py_tp_doc, machine_id_lcg_doc},
103+
{Py_tp_doc, (void *) machine_id_lcg_doc},
104104
{Py_tp_repr, machine_id_lcg_repr},
105105
{0, 0},
106106
};

src/sonyflake_turbo/sonyflake.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static inline void get_relative_current_time(struct sonyflake_state *self, struc
4343
sub_diff(sf_now, &self->start_time);
4444
}
4545

46-
static PyObject *sonyflake_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) {
46+
static PyObject *sonyflake_new(PyTypeObject *type, PyObject *Py_UNUSED(args), PyObject *Py_UNUSED(kwargs)) {
4747
allocfunc tp_alloc = PyType_GetSlot(type, Py_tp_alloc);
4848

4949
assert(tp_alloc != NULL);
@@ -411,7 +411,7 @@ PyType_Slot sonyflake_type_slots[] = {
411411
{Py_tp_new, sonyflake_new},
412412
{Py_tp_init, sonyflake_init},
413413
{Py_tp_call, sonyflake_call},
414-
{Py_tp_doc, sonyflake_doc},
414+
{Py_tp_doc, (void *) sonyflake_doc},
415415
{Py_tp_repr, sonyflake_repr},
416416
{0, 0},
417417
};

src/sonyflake_turbo/sonyflake.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern PyType_Spec sonyflake_type_spec;
2020
extern PyModuleDef_Slot sonyflake_slots[];
2121
extern struct PyModuleDef sonyflake_module;
2222

23-
const static struct timespec default_start_time = {
23+
static const struct timespec default_start_time = {
2424
.tv_sec = SONYFLAKE_EPOCH,
2525
.tv_nsec = 0
2626
};

0 commit comments

Comments
 (0)