Skip to content

Commit 94e7bcf

Browse files
author
Anselm Kruis
committed
Stackless issue python#140: Fix compiler warnings
- Assign to '*valid' in function slp_find_execname(). - Disable GCC warning -Waddress in macro TASKLET_SETVAL(task, val). - Update Stackless/changelog.txt for issues python#138, python#140 (cherry picked from commit 3461ccf)
1 parent 9f3b0cc commit 94e7bcf

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

Stackless/changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ What's New in Stackless 2.7.XX?
1010

1111
*Release date: XXXX-XX-XX*
1212

13+
- https://github.com/stackless-dev/stackless/issues/140
14+
Fix bugs in prickelpit.c slp_find_execname().
15+
16+
- https://github.com/stackless-dev/stackless/issues/138
17+
Correctly propose Stackless calls for C-functions.
18+
1319
- https://github.com/stackless-dev/stackless/issues/135
1420
Fix small memory leaks for types with Stackless extensions.
1521

Stackless/core/stackless_impl.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,11 +676,23 @@ do { \
676676
} while(0)
677677

678678
/* ditto, without incref. Made no sense to optimize. */
679+
#if defined(__GNUC__) && defined(__STDC__) && (__STDC_VERSION__ >= 199901L)
680+
#define SLP_DISABLE_GCC_W_ADDRESS \
681+
_Pragma("GCC diagnostic push") \
682+
_Pragma("GCC diagnostic ignored \"-Waddress\"")
683+
#define SLP_RESTORE_WARNINGS \
684+
_Pragma("GCC diagnostic pop")
685+
#else
686+
#define SLP_DISABLE_GCC_W_ADDRESS /**/
687+
#define SLP_RESTORE_WARNINGS /**/
688+
#endif
679689

680690
#define TASKLET_SETVAL_OWN(task, val) \
681691
do { \
682692
PyObject *hold = (task)->tempval; \
693+
SLP_DISABLE_GCC_W_ADDRESS /* suppress warning, if val == Py_NONE */ \
683694
assert(val != NULL); \
695+
SLP_RESTORE_WARNINGS \
684696
(task)->tempval = (PyObject *) val; \
685697
Py_DECREF(hold); \
686698
} while(0)

Stackless/pickling/prickelpit.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ slp_find_execname(PyFrameObject *f, int *valid)
410410
PyObject *dic = dp ? dp->dict : NULL;
411411
PyObject *exec_addr = PyLong_FromVoidPtr(f->f_execute);
412412

413+
assert(valid != NULL);
414+
413415
if (exec_addr == NULL) return NULL;
414416
exec_name = dic ? PyDict_GetItem(dic, exec_addr) : NULL;
415417
if (exec_name == NULL) {
@@ -418,7 +420,7 @@ slp_find_execname(PyFrameObject *f, int *valid)
418420
sprintf(msg, "frame exec function at %p is not registered!",
419421
(void *)f->f_execute);
420422
PyErr_SetString(PyExc_ValueError, msg);
421-
valid = 0;
423+
*valid = 0;
422424
}
423425
else {
424426
PyFrame_ExecFunc *good, *bad;
@@ -427,7 +429,7 @@ slp_find_execname(PyFrameObject *f, int *valid)
427429
goto err_exit;
428430
}
429431
if (f->f_execute == bad)
430-
valid = 0;
432+
*valid = 0;
431433
else if (f->f_execute != good) {
432434
PyErr_SetString(PyExc_SystemError,
433435
"inconsistent c?frame function registration");

0 commit comments

Comments
 (0)