mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
vm.c: suppress GCC 12+ dangling pointer warning for jmpbuf
add pragma to suppress -Wdangling-pointer warning for intentional stack variable address storage in exception handling. the pointer is safely managed and cleared before function returns. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1709,7 +1709,21 @@ RETRY_TRY_BLOCK:
|
||||
goto L_BREAK;
|
||||
goto L_RAISE;
|
||||
}
|
||||
/* Intentionally store stack variable address for exception handling.
|
||||
* This is safe because the pointer is cleared before function returns.
|
||||
* Suppress GCC 12+ warning about dangling pointer. */
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#if __GNUC__ >= 12
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdangling-pointer"
|
||||
#endif
|
||||
#endif
|
||||
mrb->jmp = &c_jmp;
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#if __GNUC__ >= 12
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
INIT_DISPATCH {
|
||||
CASE(OP_NOP, Z) {
|
||||
|
||||
Reference in New Issue
Block a user