summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorLukas Mai <l.mai@web.de>2017-06-20 21:44:29 +0200
committerLukas Mai <l.mai@web.de>2017-06-20 21:44:29 +0200
commit9626630a64b0987a88ed571b009426cf8aa1a637 (patch)
tree1f08c62aa0628c0ea6ce5897098dc86ea81a3a01 /regcomp.c
parentc6b8d200a892fd82c4dcf22caa543879e763f5ed (diff)
downloadperl-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.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/regcomp.c b/regcomp.c
index 0a4ea78693..3f81daa136 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -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,