summaryrefslogtreecommitdiff
path: root/pp.h
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-05-20 07:44:06 -0400
committerSteffen Mueller <smueller@cpan.org>2014-05-28 12:34:06 +0200
commitaad79b331c21c962b6e0ce7b8027aa625d7445ec (patch)
treed12a2836f65c39bbcf71f6e8b7558ff04fbc0ccb /pp.h
parent626040f738fa96d23319f0d350f80eed39bdee15 (diff)
downloadperl-aad79b331c21c962b6e0ce7b8027aa625d7445ec.tar.gz
Avoid "unused sp" if EXTEND is the last mentioning sp.
Add PERL_UNUSED_VAR(sp) in case the EXTEND (or MEXTEND) is the last thing mentioning the sp. Addresses Coverity perl5 CIDs 29199..29201, 29204, 29205, 29206, 29208, 29210, 29212, 29213, 29215, 29216, 29219..29221.
Diffstat (limited to 'pp.h')
-rw-r--r--pp.h36
1 files changed, 22 insertions, 14 deletions
diff --git a/pp.h b/pp.h
index 97738c2d8d..09d8bb1a11 100644
--- a/pp.h
+++ b/pp.h
@@ -271,23 +271,31 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>.
*/
#ifdef STRESS_REALLOC
-# define EXTEND(p,n) (void)(sp = stack_grow(sp,p, (SSize_t)(n)))
+# define EXTEND(p,n) STMT_START { \
+ sp = stack_grow(sp,p,(SSize_t) (n)); \
+ PERL_UNUSED_VAR(sp); \
+ } } STMT_END
/* Same thing, but update mark register too. */
-# define MEXTEND(p,n) STMT_START { \
- const int markoff = mark - PL_stack_base; \
- sp = stack_grow(sp,p,(SSize_t) (n)); \
- mark = PL_stack_base + markoff; \
- } STMT_END
+# define MEXTEND(p,n) STMT_START { \
+ const int markoff = mark - PL_stack_base; \
+ sp = stack_grow(sp,p,(SSize_t) (n))); \
+ mark = PL_stack_base + markoff; \
+ PERL_UNUSED_VAR(sp); \
+ } STMT_END
#else
-# define EXTEND(p,n) (void)(UNLIKELY(PL_stack_max - p < (SSize_t)(n)) && \
- (sp = stack_grow(sp,p, (SSize_t) (n))))
-
+# define EXTEND(p,n) STMT_START { \
+ if (UNLIKELY(PL_stack_max - p < (int)(n))) { \
+ sp = stack_grow(sp,p,(SSize_t) (n)); \
+ PERL_UNUSED_VAR(sp); \
+ } } STMT_END
/* Same thing, but update mark register too. */
-# define MEXTEND(p,n) STMT_START {if (UNLIKELY(PL_stack_max - p < (int)(n))) {\
- const int markoff = mark - PL_stack_base; \
- sp = stack_grow(sp,p,(SSize_t) (n)); \
- mark = PL_stack_base + markoff; \
- } } STMT_END
+# define MEXTEND(p,n) STMT_START { \
+ if (UNLIKELY(PL_stack_max - p < (int)(n))) { \
+ const int markoff = mark - PL_stack_base; \
+ sp = stack_grow(sp,p,(SSize_t) (n)); \
+ mark = PL_stack_base + markoff; \
+ PERL_UNUSED_VAR(sp); \
+ } } STMT_END
#endif
#define PUSHs(s) (*++sp = (s))