gh-87347: Add parenthesis around macro arguments (#93915)

Add unit test on Py_MEMBER_SIZE() and some other macros.
This commit is contained in:
Victor Stinner 2022-06-20 16:04:52 +02:00 • committed by GitHub
parent 61f24e7885
commit 7ad6f74fcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 171 additions and 143 deletions

View file

@ -252,16 +252,16 @@ extern int _PyStaticCode_InternStrings(PyCodeObject *co);
#ifdef Py_STATS
#define STAT_INC(opname, name) _py_stats.opcode_stats[opname].specialization.name++
#define STAT_DEC(opname, name) _py_stats.opcode_stats[opname].specialization.name--
#define OPCODE_EXE_INC(opname) _py_stats.opcode_stats[opname].execution_count++
#define STAT_INC(opname, name) _py_stats.opcode_stats[(opname)].specialization.name++
#define STAT_DEC(opname, name) _py_stats.opcode_stats[(opname)].specialization.name--
#define OPCODE_EXE_INC(opname) _py_stats.opcode_stats[(opname)].execution_count++
#define CALL_STAT_INC(name) _py_stats.call_stats.name++
#define OBJECT_STAT_INC(name) _py_stats.object_stats.name++
#define OBJECT_STAT_INC_COND(name, cond) \
do { if (cond) _py_stats.object_stats.name++; } while (0)
#define EVAL_CALL_STAT_INC(name) _py_stats.call_stats.eval_calls[name]++
#define EVAL_CALL_STAT_INC(name) _py_stats.call_stats.eval_calls[(name)]++
#define EVAL_CALL_STAT_INC_IF_FUNCTION(name, callable) \
do { if (PyFunction_Check(callable)) _py_stats.call_stats.eval_calls[name]++; } while (0)
do { if (PyFunction_Check(callable)) _py_stats.call_stats.eval_calls[(name)]++; } while (0)
// Used by the _opcode extension which is built as a shared library
PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);