Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autodoc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2681,7 +2681,7 @@ ($destpod)
# how this item is displayed.
if ($element->{flags}) {
$element->{flags} .=
$leader->{flags} =~ s/$item_flags_re//r;
$leader->{flags} =~ s/$item_flags_re//gr;
}
else {
$element->{flags} = $leader->{flags};
Expand Down
2 changes: 1 addition & 1 deletion av.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ If all you need is to look up an array element, then prefer C<av_fetch>.
* SvGETMAGIC(av); IV x = av_tindex_nomg(av);
*/
# define av_top_index_skip_len_mg(av) \
(__ASSERT_(SvTYPE(av) == SVt_PVAV) AvFILLp(av))
(assert(SvTYPE(av) == SVt_PVAV), AvFILLp(av))
# define av_tindex_skip_len_mg(av) av_top_index_skip_len_mg(av)

#define NEGATIVE_INDICES_VAR "NEGATIVE_INDICES"
Expand Down
28 changes: 14 additions & 14 deletions handy.h
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ or casts
*
* NOT suitable for void*
*/
#define ASSERT_IS_PTR(x) (__ASSERT_(sizeof(*(x))) (x))
#define ASSERT_IS_PTR(x) (assert(sizeof(*(x))), (x))

/* FITS_IN_8_BITS(c) returns true if c doesn't have a bit set other than in
* the lower 8. It is designed to be hopefully bomb-proof, making sure that no
Expand All @@ -1439,8 +1439,8 @@ or casts
* needed. (The NV casts stop any warnings about comparison always being true
* if called with an unsigned. The cast preserves the sign, which is all we
* care about.) */
#define withinCOUNT(c, l, n) (__ASSERT_((NV) (l) >= 0) \
__ASSERT_((NV) (n) >= 0) \
#define withinCOUNT(c, l, n) (assert((NV) (l) >= 0), \
assert((NV) (n) >= 0), \
withinCOUNT_KNOWN_VALID_((c), (l), (n)))

/* For internal use only, this can be used in places where it is known that the
Expand All @@ -1455,11 +1455,11 @@ or casts
/* Returns true if c is in the range l..u, where 'l' is non-negative
* Written this way so that after optimization, only one conditional test is
* needed. */
#define inRANGE(c, l, u) (__ASSERT_((NV) (l) >= 0) __ASSERT_((u) >= (l)) \
#define inRANGE(c, l, u) (assert((NV) (l) >= 0), assert((u) >= (l)), \
( (sizeof(c) == sizeof(U8)) ? inRANGE_helper_(U8, (c), (l), ((u))) \
: (sizeof(c) == sizeof(U16)) ? inRANGE_helper_(U16,(c), (l), ((u))) \
: (sizeof(c) == sizeof(U32)) ? inRANGE_helper_(U32,(c), (l), ((u))) \
: (__ASSERT_(sizeof(c) == sizeof(WIDEST_UTYPE)) \
: (assert(sizeof(c) == sizeof(WIDEST_UTYPE)), \
inRANGE_helper_(WIDEST_UTYPE,(c), (l), ((u))))))

/* For internal use, this is used by machine-generated code which generates
Expand Down Expand Up @@ -2098,7 +2098,7 @@ END_EXTERN_C
: ((UNLIKELY(((U8) (c)) == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS) \
? LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS \
: (UNLIKELY(((U8)(c)) == LATIN_SMALL_LETTER_SHARP_S) \
? (__ASSERT_(0) (c)) /* Fail on Sharp S in DEBUGGING */ \
? (assert(0), (c)) /* Fail on Sharp S in DEBUGGING */ \
: PL_mod_latin1_uc[ (U8) (c) ]))))))

/* In this macro, note that the result can be larger than a byte in a UTF-8
Expand All @@ -2110,8 +2110,8 @@ END_EXTERN_C
# define toFOLD_LC(c) \
((UNLIKELY((c) == MICRO_SIGN) && IN_UTF8_CTYPE_LOCALE) \
? GREEK_SMALL_LETTER_MU \
: (__ASSERT_( ! IN_UTF8_CTYPE_LOCALE \
|| LIKELY((c) != LATIN_SMALL_LETTER_SHARP_S)) \
: (assert( ! IN_UTF8_CTYPE_LOCALE \
|| LIKELY((c) != LATIN_SMALL_LETTER_SHARP_S)), \
toLOWER_LC(c)))
#endif

Expand Down Expand Up @@ -2286,7 +2286,7 @@ END_EXTERN_C
* class is TRUE for. Hence it can skip the tests for this range.
* 'above_latin1' should include its arguments */
#define generic_utf8_safe_no_upper_latin1_(classnum, p, e, above_latin1) \
(__ASSERT_(utf8_safe_assert_(p, e)) \
(assert(utf8_safe_assert_(p, e)), \
(isASCII(*(p))) \
? generic_isCC_(*(p), classnum) \
: (UTF8_IS_DOWNGRADEABLE_START(*(p))) \
Expand Down Expand Up @@ -2504,9 +2504,9 @@ END_EXTERN_C
* The conversion works both ways, so toCTRL('D') is 4, and toCTRL(4) is D,
* etc. */
#ifndef EBCDIC
# define toCTRL(c) (__ASSERT_(FITS_IN_8_BITS(c)) toUPPER(((U8)(c))) ^ 64)
# define toCTRL(c) (assert(FITS_IN_8_BITS(c)), toUPPER(((U8)(c))) ^ 64)
#else
# define toCTRL(c) (__ASSERT_(FITS_IN_8_BITS(c)) \
# define toCTRL(c) (assert(FITS_IN_8_BITS(c)), \
((isPRINT_A(c)) \
? (UNLIKELY((c) == '?') \
? QUESTION_MARK_CTRL \
Expand Down Expand Up @@ -2550,7 +2550,7 @@ typedef U32 line_t;
* position, and then to the eights position. Both are added together to form
* 0 if the input is '0'-'9' and to form 9 if alpha. This is added to the
* final four bits of the input to form the correct value. */
#define XDIGIT_VALUE(c) (__ASSERT_(isXDIGIT(c)) \
#define XDIGIT_VALUE(c) (assert(isXDIGIT(c)), \
((NATIVE_TO_LATIN1(c) >> 6) & 1) /* 1 if alpha; 0 if not */ \
+ ((NATIVE_TO_LATIN1(c) >> 3) & 8) /* 8 if alpha; 0 if not */ \
+ ((c) & 0xF)) /* 0-9 if input valid hex digit */
Expand All @@ -2561,7 +2561,7 @@ typedef U32 line_t;
/* Converts a character known to represent an octal digit (0-7) to its numeric
* value. The input is validated only by an assert() in DEBUGGING builds. In
* both ASCII and EBCDIC the last 3 bits of the octal digits range from 0-7. */
#define OCTAL_VALUE(c) (__ASSERT_(isOCTAL(c)) (7 & (c)))
#define OCTAL_VALUE(c) (assert(isOCTAL(c)), (7 & (c)))

/* Efficiently returns a boolean as to if two native characters are equivalent
* case-insensitively. At least one of the characters must be one of [A-Za-z];
Expand All @@ -2578,7 +2578,7 @@ typedef U32 line_t;
* just a single 0, in the bit position where the upper- and lowercase differ.
* */
#define isALPHA_FOLD_EQ(c1, c2) \
(__ASSERT_(isALPHA_A(c1) || isALPHA_A(c2)) \
(assert(isALPHA_A(c1) || isALPHA_A(c2)), \
((c1) & ~('A' ^ 'a')) == ((c2) & ~('A' ^ 'a')))
#define isALPHA_FOLD_NE(c1, c2) (! isALPHA_FOLD_EQ((c1), (c2)))

Expand Down
4 changes: 2 additions & 2 deletions locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -2776,11 +2776,11 @@ S_bool_setlocale_2008_i(pTHX_
* calculate_LC_ALL_string() for that. */
#ifdef USE_LOCALE_NUMERIC
# define query_nominal_locale_i(i) \
(__ASSERT_(i != LC_ALL_INDEX_) \
(assert(i != LC_ALL_INDEX_), \
((i == LC_NUMERIC_INDEX_) ? PL_numeric_name : querylocale_i(i)))
#elif defined(USE_LOCALE)
# define query_nominal_locale_i(i) \
(__ASSERT_(i != LC_ALL_INDEX_) querylocale_i(i))
(assert(i != LC_ALL_INDEX_), querylocale_i(i))
#else
# define query_nominal_locale_i(i) "C"
#endif
Expand Down
12 changes: 6 additions & 6 deletions perl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5178,8 +5178,8 @@ Gid_t getegid (void);
__FILE__, __LINE__));
/*
=for apidoc_section $directives
=for apidoc Am|void|assert_|bool expr
=for apidoc_item | |__ASSERT_
=for apidoc ATmp|void|assert_|bool expr
=for apidoc_item Tm| |__ASSERT_

These are synonymous, used to wrap the libc C<assert()> call in comma
expressions in macro expansions, but you probably don't want to use them nor
Expand Down Expand Up @@ -5233,13 +5233,13 @@ contexts in C, and in all contexts in C++.
" file \"" __FILE__ "\", line %" LINE_Tf, \
STRINGIFY(what), (line_t) __LINE__), \
(void) 0))
# define assert_(what) assert(what),
# define __ASSERT_(statement) assert(statement),
# define Perl_assert_(what) assert(what),
#else
# define Perl_assert(what) ((void) 0)
# define assert_(what)
# define __ASSERT_(statement)
# define Perl_assert_(what)
#endif
#define assert_(what) Perl_assert_(what)
#define __ASSERT_(statement) Perl_assert_(statement)

struct ufuncs {
I32 (*uf_val)(pTHX_ IV, SV*);
Expand Down
8 changes: 4 additions & 4 deletions regcomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,9 @@ struct regnode_ssc {
#define FLAGS(p) ((p)->head.data.u_8.flags) /* Caution: Doesn't apply to all \
regnode types. For some, it's the \
character set of the regnode */
#define STR_LENs(p) (__ASSERT_(OP(p) != LEXACT && OP(p) != LEXACT_REQ8) \
#define STR_LENs(p) (assert(OP(p) != LEXACT && OP(p) != LEXACT_REQ8), \
STR_LEN_U8((struct regnode_string *)p))
#define STRINGs(p) (__ASSERT_(OP(p) != LEXACT && OP(p) != LEXACT_REQ8) \
#define STRINGs(p) (assert(OP(p) != LEXACT && OP(p) != LEXACT_REQ8), \
((struct regnode_string *)p)->string)
#define OPERANDs(p) STRINGs(p)

Expand All @@ -510,9 +510,9 @@ struct regnode_ssc {
* node to be an ARG2L, using the second 32 bit field for the length, and not
* using the flags nor next_off fields at all. One could have an llstring node
* and even an lllstring type. */
#define STR_LENl(p) (__ASSERT_(OP(p) == LEXACT || OP(p) == LEXACT_REQ8) \
#define STR_LENl(p) (assert(OP(p) == LEXACT || OP(p) == LEXACT_REQ8), \
(((struct regnode_lstring *)p)->str_len_u32))
#define STRINGl(p) (__ASSERT_(OP(p) == LEXACT || OP(p) == LEXACT_REQ8) \
#define STRINGl(p) (assert(OP(p) == LEXACT || OP(p) == LEXACT_REQ8), \
(((struct regnode_lstring *)p)->string))
#define OPERANDl(p) STRINGl(p)

Expand Down
2 changes: 1 addition & 1 deletion regcomp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ static const scan_data_t zero_scan_data = {
/* Convert between a pointer to a node and its offset from the beginning of the
* program */
#define REGNODE_p(offset) (RExC_emit_start + (offset))
#define REGNODE_OFFSET(node) (__ASSERT_((node) >= RExC_emit_start) \
#define REGNODE_OFFSET(node) (assert((node) >= RExC_emit_start), \
(SSize_t) ((node) - RExC_emit_start))

#define ProgLen(ri) ri->proglen
Expand Down
4 changes: 2 additions & 2 deletions regen/regcomp.pl
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ sub print_process_EXACTish {
print $out <<EOP,

/* Is 'op', known to be of type EXACT, folding? */
#define isEXACTFish(op) (__ASSERT_(REGNODE_TYPE(op) == EXACT) (PL_EXACTFish_bitmask & (1U << (op - EXACT))))
#define isEXACTFish(op) (assert(REGNODE_TYPE(op) == EXACT), (PL_EXACTFish_bitmask & (1U << (op - EXACT))))

/* Do only UTF-8 target strings match 'op', known to be of type EXACT? */
#define isEXACT_REQ8(op) (__ASSERT_(REGNODE_TYPE(op) == EXACT) (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))
#define isEXACT_REQ8(op) (assert(REGNODE_TYPE(op) == EXACT), (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))

#ifndef DOINIT
EXTCONST U32 PL_EXACTFish_bitmask;
Expand Down
2 changes: 1 addition & 1 deletion regexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,7 @@ S_get_break_val_cp_checked(SV* const invlist, const UV cp_in) {
* And it takes the particular macro name that finds the desired value given a
* code point. Merely convert the UTF-8 to code point and call the cp macro */
#define generic_GET_BREAK_VAL_UTF8_(cp_macro, pos, strend) \
(__ASSERT_(pos < strend) \
(assert(pos < strend), \
/* Note assumes is valid UTF-8 */ \
(cp_macro(utf8_to_uv_or_die((pos), (strend), NULL))))

Expand Down
4 changes: 2 additions & 2 deletions regnodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2962,10 +2962,10 @@ EXTCONST U8 PL_simple_bitmask[] = {
#endif /* DOINIT */

/* Is 'op', known to be of type EXACT, folding? */
#define isEXACTFish(op) (__ASSERT_(REGNODE_TYPE(op) == EXACT) (PL_EXACTFish_bitmask & (1U << (op - EXACT))))
#define isEXACTFish(op) (assert(REGNODE_TYPE(op) == EXACT), (PL_EXACTFish_bitmask & (1U << (op - EXACT))))

/* Do only UTF-8 target strings match 'op', known to be of type EXACT? */
#define isEXACT_REQ8(op) (__ASSERT_(REGNODE_TYPE(op) == EXACT) (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))
#define isEXACT_REQ8(op) (assert(REGNODE_TYPE(op) == EXACT), (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))

#ifndef DOINIT
EXTCONST U32 PL_EXACTFish_bitmask;
Expand Down
Loading
Loading