summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-09-21 22:07:58 -0600
committerKarl Williamson <khw@cpan.org>2014-09-29 11:07:40 -0600
commit9cba692be9578e72e0f03f616e61b7fa7a2fb79d (patch)
treede70242b397ac2d31ff1b6e14b9e970d5ee82810
parentbb62883ea327df0c836748360635ed9394e2264c (diff)
downloadperl-9cba692be9578e72e0f03f616e61b7fa7a2fb79d.tar.gz
Suppress some Solaris warnings
We get an integer overflow message when we left shift a 1 into the highest bit of a word. This changes the 1's into 1U's to indicate unsigned. This is done for all the flag bits in the affected word, as they could get reorderd by someone in the future, unintentionally reintroducing this problem again.
-rw-r--r--op.h26
-rw-r--r--op_reg_common.h30
-rw-r--r--regexp.h31
3 files changed, 44 insertions, 43 deletions
diff --git a/op.h b/op.h
index 64825acd81..df39d33080 100644
--- a/op.h
+++ b/op.h
@@ -278,45 +278,45 @@ struct pmop {
#define PMf_BASE_SHIFT (_RXf_PMf_SHIFT_NEXT+4)
/* 'use re "taint"' in scope: taint $1 etc. if target tainted */
-#define PMf_RETAINT (1<<(PMf_BASE_SHIFT+5))
+#define PMf_RETAINT (1U<<(PMf_BASE_SHIFT+5))
/* match successfully only once per reset, with related flag RXf_USED in
* re->extflags holding state. This is used only for ?? matches, and only on
* OP_MATCH and OP_QR */
-#define PMf_ONCE (1<<(PMf_BASE_SHIFT+6))
+#define PMf_ONCE (1U<<(PMf_BASE_SHIFT+6))
/* PMf_ONCE, i.e. ?pat?, has matched successfully. Not used under threading. */
-#define PMf_USED (1<<(PMf_BASE_SHIFT+7))
+#define PMf_USED (1U<<(PMf_BASE_SHIFT+7))
/* subst replacement is constant */
-#define PMf_CONST (1<<(PMf_BASE_SHIFT+8))
+#define PMf_CONST (1U<<(PMf_BASE_SHIFT+8))
/* keep 1st runtime pattern forever */
-#define PMf_KEEP (1<<(PMf_BASE_SHIFT+9))
+#define PMf_KEEP (1U<<(PMf_BASE_SHIFT+9))
-#define PMf_GLOBAL (1<<(PMf_BASE_SHIFT+10)) /* pattern had a g modifier */
+#define PMf_GLOBAL (1U<<(PMf_BASE_SHIFT+10)) /* pattern had a g modifier */
/* don't reset pos() if //g fails */
-#define PMf_CONTINUE (1<<(PMf_BASE_SHIFT+11))
+#define PMf_CONTINUE (1U<<(PMf_BASE_SHIFT+11))
/* evaluating replacement as expr */
-#define PMf_EVAL (1<<(PMf_BASE_SHIFT+12))
+#define PMf_EVAL (1U<<(PMf_BASE_SHIFT+12))
/* Return substituted string instead of modifying it. */
-#define PMf_NONDESTRUCT (1<<(PMf_BASE_SHIFT+13))
+#define PMf_NONDESTRUCT (1U<<(PMf_BASE_SHIFT+13))
/* the pattern has a CV attached (currently only under qr/...(?{}).../) */
-#define PMf_HAS_CV (1<<(PMf_BASE_SHIFT+14))
+#define PMf_HAS_CV (1U<<(PMf_BASE_SHIFT+14))
/* op_code_list is private; don't free it etc. It may well point to
* code within another sub, with different pad etc */
-#define PMf_CODELIST_PRIVATE (1<<(PMf_BASE_SHIFT+15))
+#define PMf_CODELIST_PRIVATE (1U<<(PMf_BASE_SHIFT+15))
/* the PMOP is a QR (we should be able to detect that from the op type,
* but the regex compilation API passes just the pm flags, not the op
* itself */
-#define PMf_IS_QR (1<<(PMf_BASE_SHIFT+16))
-#define PMf_USE_RE_EVAL (1<<(PMf_BASE_SHIFT+17)) /* use re'eval' in scope */
+#define PMf_IS_QR (1U<<(PMf_BASE_SHIFT+16))
+#define PMf_USE_RE_EVAL (1U<<(PMf_BASE_SHIFT+17)) /* use re'eval' in scope */
/* See comments at the beginning of these defines about adding bits. The
* highest bit position should be used, so that if PMf_BASE_SHIFT gets
diff --git a/op_reg_common.h b/op_reg_common.h
index ee404dcb95..9f7227d4e3 100644
--- a/op_reg_common.h
+++ b/op_reg_common.h
@@ -28,12 +28,12 @@
* INT_PAT_MODS in regexp.h for the reason contiguity is needed */
/* Make sure to update lib/re.pm when changing these! */
/* Make sure you keep the pure PMf_ versions below in sync */
-#define RXf_PMf_MULTILINE (1 << (RXf_PMf_STD_PMMOD_SHIFT+0)) /* /m */
-#define RXf_PMf_SINGLELINE (1 << (RXf_PMf_STD_PMMOD_SHIFT+1)) /* /s */
-#define RXf_PMf_FOLD (1 << (RXf_PMf_STD_PMMOD_SHIFT+2)) /* /i */
-#define RXf_PMf_EXTENDED (1 << (RXf_PMf_STD_PMMOD_SHIFT+3)) /* /x */
-#define RXf_PMf_EXTENDED_MORE (1 << (RXf_PMf_STD_PMMOD_SHIFT+4)) /* /xx */
-#define RXf_PMf_KEEPCOPY (1 << (RXf_PMf_STD_PMMOD_SHIFT+5)) /* /p */
+#define RXf_PMf_MULTILINE (1U << (RXf_PMf_STD_PMMOD_SHIFT+0)) /* /m */
+#define RXf_PMf_SINGLELINE (1U << (RXf_PMf_STD_PMMOD_SHIFT+1)) /* /s */
+#define RXf_PMf_FOLD (1U << (RXf_PMf_STD_PMMOD_SHIFT+2)) /* /i */
+#define RXf_PMf_EXTENDED (1U << (RXf_PMf_STD_PMMOD_SHIFT+3)) /* /x */
+#define RXf_PMf_EXTENDED_MORE (1U << (RXf_PMf_STD_PMMOD_SHIFT+4)) /* /xx */
+#define RXf_PMf_KEEPCOPY (1U << (RXf_PMf_STD_PMMOD_SHIFT+5)) /* /p */
/* The character set for the regex is stored in a field of more than one bit
* using an enum, for reasons of compactness and to ensure that the options are
@@ -88,7 +88,7 @@ get_regex_charset(const U32 flags)
be used by regex engines to check whether they should set
RXf_SKIPWHITE
*/
-#define RXf_PMf_SPLIT (1<<(RXf_PMf_STD_PMMOD_SHIFT+9))
+#define RXf_PMf_SPLIT (1U<<(RXf_PMf_STD_PMMOD_SHIFT+9))
/* Next available bit after the above. Name begins with '_' so won't be
* exported by B */
@@ -108,14 +108,14 @@ get_regex_charset(const U32 flags)
/* These copies need to be numerical or ext/B/Makefile.PL won't think they are
* constants */
-#define PMf_MULTILINE 1<<0
-#define PMf_SINGLELINE 1<<1
-#define PMf_FOLD 1<<2
-#define PMf_EXTENDED 1<<3
-#define PMf_EXTENDED_MORE 1<<4
-#define PMf_KEEPCOPY 1<<5
-#define PMf_CHARSET 7<<6
-#define PMf_SPLIT 1<<9
+#define PMf_MULTILINE 1U<<0
+#define PMf_SINGLELINE 1U<<1
+#define PMf_FOLD 1U<<2
+#define PMf_EXTENDED 1U<<3
+#define PMf_EXTENDED_MORE 1U<<4
+#define PMf_KEEPCOPY 1U<<5
+#define PMf_CHARSET 7U<<6
+#define PMf_SPLIT 1U<<9
#if PMf_MULTILINE != RXf_PMf_MULTILINE || PMf_SINGLELINE != RXf_PMf_SINGLELINE || PMf_FOLD != RXf_PMf_FOLD || PMf_EXTENDED != RXf_PMf_EXTENDED || PMf_EXTENDED_MORE != RXf_PMf_EXTENDED_MORE || PMf_KEEPCOPY != RXf_PMf_KEEPCOPY || PMf_SPLIT != RXf_PMf_SPLIT || PMf_CHARSET != RXf_PMf_CHARSET
# error RXf_PMf defines are wrong
diff --git a/regexp.h b/regexp.h
index 7622d6706a..ff16410684 100644
--- a/regexp.h
+++ b/regexp.h
@@ -391,37 +391,38 @@ and check for NULL.
#define RXf_BASE_SHIFT (_RXf_PMf_SHIFT_NEXT + 4)
/* What we have seen */
-#define RXf_NO_INPLACE_SUBST (1<<(RXf_BASE_SHIFT+2))
-#define RXf_EVAL_SEEN (1<<(RXf_BASE_SHIFT+3))
+#define RXf_NO_INPLACE_SUBST (1U<<(RXf_BASE_SHIFT+2))
+#define RXf_EVAL_SEEN (1U<<(RXf_BASE_SHIFT+3))
/* Special */
-#define RXf_UNBOUNDED_QUANTIFIER_SEEN (1<<(RXf_BASE_SHIFT+4))
-#define RXf_CHECK_ALL (1<<(RXf_BASE_SHIFT+5))
+#define RXf_UNBOUNDED_QUANTIFIER_SEEN (1U<<(RXf_BASE_SHIFT+4))
+#define RXf_CHECK_ALL (1U<<(RXf_BASE_SHIFT+5))
/* UTF8 related */
-#define RXf_MATCH_UTF8 (1<<(RXf_BASE_SHIFT+6)) /* $1 etc are utf8 */
+#define RXf_MATCH_UTF8 (1U<<(RXf_BASE_SHIFT+6)) /* $1 etc are utf8 */
/* Intuit related */
-#define RXf_USE_INTUIT_NOML (1<<(RXf_BASE_SHIFT+7))
-#define RXf_USE_INTUIT_ML (1<<(RXf_BASE_SHIFT+8))
-#define RXf_INTUIT_TAIL (1<<(RXf_BASE_SHIFT+9))
+#define RXf_USE_INTUIT_NOML (1U<<(RXf_BASE_SHIFT+7))
+#define RXf_USE_INTUIT_ML (1U<<(RXf_BASE_SHIFT+8))
+#define RXf_INTUIT_TAIL (1U<<(RXf_BASE_SHIFT+9))
#define RXf_USE_INTUIT (RXf_USE_INTUIT_NOML|RXf_USE_INTUIT_ML)
/* Do we have some sort of anchor? */
-#define RXf_IS_ANCHORED (1<<(RXf_BASE_SHIFT+10))
+#define RXf_IS_ANCHORED (1U<<(RXf_BASE_SHIFT+10))
/* Copy and tainted info */
-#define RXf_COPY_DONE (1<<(RXf_BASE_SHIFT+11))
+#define RXf_COPY_DONE (1U<<(RXf_BASE_SHIFT+11))
/* post-execution: $1 et al are tainted */
-#define RXf_TAINTED_SEEN (1<<(RXf_BASE_SHIFT+12))
+#define RXf_TAINTED_SEEN (1U<<(RXf_BASE_SHIFT+12))
/* this pattern was tainted during compilation */
-#define RXf_TAINTED (1<<(RXf_BASE_SHIFT+13))
+#define RXf_TAINTED (1U<<(RXf_BASE_SHIFT+13))
/* Flags indicating special patterns */
-#define RXf_START_ONLY (1<<(RXf_BASE_SHIFT+14)) /* Pattern is /^/ */
-#define RXf_SKIPWHITE (1<<(RXf_BASE_SHIFT+15)) /* Pattern is for a split " " */
-#define RXf_WHITE (1<<(RXf_BASE_SHIFT+16)) /* Pattern is /\s+/ */
+#define RXf_START_ONLY (1U<<(RXf_BASE_SHIFT+14)) /* Pattern is /^/ */
+#define RXf_SKIPWHITE (1U<<(RXf_BASE_SHIFT+15)) /* Pattern is for a */
+ /* split " " */
+#define RXf_WHITE (1U<<(RXf_BASE_SHIFT+16)) /* Pattern is /\s+/ */
#define RXf_NULL (1U<<(RXf_BASE_SHIFT+17)) /* Pattern is // */
/* See comments at the beginning of these defines about adding bits. The