diff options
author | Lukas Mai <l.mai@web.de> | 2017-06-20 21:44:29 +0200 |
---|---|---|
committer | Lukas Mai <l.mai@web.de> | 2017-06-20 21:44:29 +0200 |
commit | 9626630a64b0987a88ed571b009426cf8aa1a637 (patch) | |
tree | 1f08c62aa0628c0ea6ce5897098dc86ea81a3a01 /regcomp.c | |
parent | c6b8d200a892fd82c4dcf22caa543879e763f5ed (diff) | |
download | perl-9626630a64b0987a88ed571b009426cf8aa1a637.tar.gz |
wrap multi-statement macros in STMT_START/STMT_END
With the original code you'd have to be very, very careful:
if (foo)
CLEAR_POSIX_WARNINGS_AND_RETURN(42);
would have expanded to
if (foo)
CLEAR_POSIX_WARNINGS();
return 42; /* always returns! */
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -13992,12 +13992,16 @@ S_populate_ANYOF_from_invlist(pTHX_ regnode *node, SV** invlist_ptr) } \ } STMT_END #define CLEAR_POSIX_WARNINGS() \ - if (posix_warnings && RExC_warn_text) \ - av_clear(RExC_warn_text) + STMT_START { \ + if (posix_warnings && RExC_warn_text) \ + av_clear(RExC_warn_text); \ + } STMT_END #define CLEAR_POSIX_WARNINGS_AND_RETURN(ret) \ - CLEAR_POSIX_WARNINGS(); \ - return ret + STMT_START { \ + CLEAR_POSIX_WARNINGS(); \ + return ret; \ + } STMT_END STATIC int S_handle_possible_posix(pTHX_ RExC_state_t *pRExC_state, |