diff options
author | Skip Montanaro <skip.montanaro@gmail.com> | 2022-11-22 20:13:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-22 20:13:54 (GMT) |
commit | d4cf192826b4c3bc91ac0de573a3a2d85760f1dd (patch) | |
tree | ae73da3a1fdcb8d753f76aeafd66b83c9ff0b5bb /Python/ceval.c | |
parent | 22d91c16bb03c3d87f53b5fee10325b876262a78 (diff) | |
download | cpython-d4cf192826b4c3bc91ac0de573a3a2d85760f1dd.zip cpython-d4cf192826b4c3bc91ac0de573a3a2d85760f1dd.tar.gz cpython-d4cf192826b4c3bc91ac0de573a3a2d85760f1dd.tar.bz2 |
gh-88226: Emit TARGET labels in Python/ceval.c when debugging, even if computed gotos aren't enabled (GH-98265)
Keep target labels when debugging, but don't warn about lack of use.
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index d28fdeb..80bfa21 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -678,11 +678,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) #endif #if USE_COMPUTED_GOTOS -#define TARGET(op) TARGET_##op: INSTRUCTION_START(op); -#define DISPATCH_GOTO() goto *opcode_targets[opcode] +# define TARGET(op) TARGET_##op: INSTRUCTION_START(op); +# define DISPATCH_GOTO() goto *opcode_targets[opcode] #else -#define TARGET(op) case op: INSTRUCTION_START(op); -#define DISPATCH_GOTO() goto dispatch_opcode +# define TARGET(op) case op: TARGET_##op: INSTRUCTION_START(op); +# define DISPATCH_GOTO() goto dispatch_opcode #endif /* PRE_DISPATCH_GOTO() does lltrace if enabled. Normally a no-op */ @@ -1056,6 +1056,18 @@ static inline void _Py_LeaveRecursiveCallPy(PyThreadState *tstate) { #define KWNAMES_LEN() \ (kwnames == NULL ? 0 : ((int)PyTuple_GET_SIZE(kwnames))) +/* Disable unused label warnings. They are handy for debugging, even + if computed gotos aren't used. */ + +/* TBD - what about other compilers? */ +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-label" +#elif defined(_MSC_VER) /* MS_WINDOWS */ +# pragma warning(push) +# pragma warning(disable:4102) +#endif + PyObject* _Py_HOT_FUNCTION _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag) { @@ -1435,6 +1447,11 @@ resume_with_error: goto error; } +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#elif defined(_MSC_VER) /* MS_WINDOWS */ +# pragma warning(pop) +#endif static void format_missing(PyThreadState *tstate, const char *kind, |