Commit 9bd0dde
authored
Enable more compiler warnings and fix results (#546)
Add some basic flags compatible with gcc and clang, and fix the
resulting errors:
```
src/_time_machine.c:519:27: error: cast from 'PyCFunction' (aka 'struct _object *(*)(struct _object *, struct _object *)') to 'PyCFunctionFastWithKeywords' (aka 'struct _object
*(*)(struct _object *, struct _object *const *, long, struct _object *)') converts to incompatible function type [-Werror,-Wcast-function-type-mismatch]
519 | state->original_now = (PyCFunctionFastWithKeywords)datetime_datetime_now->m_ml->ml_meth;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_time_machine.c:523:44: error: cast from 'PyObject *(*)(PyTypeObject *, PyObject *const *, Py_ssize_t, PyObject *)' (aka 'struct _object *(*)(struct _typeobject *,
struct _object *const *, long, struct _object *)') to 'PyCFunction' (aka 'struct _object *(*)(struct _object *, struct _object *)') converts to incompatible function type
[-Werror,-Wcast-function-type-mismatch]
523 | datetime_datetime_now->m_ml->ml_meth = (PyCFunction)_time_machine_now;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_time_machine.c:620:9: error: cast from 'PyObject *(*)(PyObject *, PyObject *const *, Py_ssize_t, PyObject *)' (aka 'struct _object *(*)(struct _object *, struct
_object *const *, long, struct _object *)') to 'PyCFunction' (aka 'struct _object *(*)(struct _object *, struct _object *)') converts to incompatible function type
[-Werror,-Wcast-function-type-mismatch]
620 | (PyCFunction)_time_machine_original_now,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_time_machine.c:697:1: error: no previous prototype for function 'PyInit__time_machine' [-Werror,-Wmissing-prototypes]
697 | PyInit__time_machine(void)
| ^
src/_time_machine.c:696:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
696 | PyMODINIT_FUNC
| ^
/Users/chainz/.local/share/uv/python/cpython-3.13.6-macos-aarch64-none/include/python3.13/exports.h:103:58: note: expanded from macro 'PyMODINIT_FUNC'
103 | # define PyMODINIT_FUNC Py_EXPORTED_SYMBOL PyObject*
| ^
4 errors generated.
error: command '/usr/bin/cc' failed with exit code 1
```1 parent c45ad79 commit 9bd0dde
2 files changed
Lines changed: 32 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
516 | 520 | | |
517 | 521 | | |
518 | 522 | | |
519 | | - | |
| 523 | + | |
| 524 | + | |
520 | 525 | | |
521 | | - | |
| 526 | + | |
| 527 | + | |
522 | 528 | | |
523 | | - | |
| 529 | + | |
524 | 530 | | |
525 | 531 | | |
526 | 532 | | |
| |||
617 | 623 | | |
618 | 624 | | |
619 | 625 | | |
620 | | - | |
| 626 | + | |
621 | 627 | | |
622 | 628 | | |
623 | 629 | | |
| |||
0 commit comments