Skip to content

Commit 2e6cda0

Browse files
committed
Convert all calls to __ASSERT_() to assert_()
The former symbol is undefined behavior in C and C++.
1 parent a285955 commit 2e6cda0

File tree

11 files changed

+63
-63
lines changed

11 files changed

+63
-63
lines changed

av.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ If all you need is to look up an array element, then prefer C<av_fetch>.
122122
* SvGETMAGIC(av); IV x = av_tindex_nomg(av);
123123
*/
124124
# define av_top_index_skip_len_mg(av) \
125-
(__ASSERT_(SvTYPE(av) == SVt_PVAV) AvFILLp(av))
125+
(assert_(SvTYPE(av) == SVt_PVAV) AvFILLp(av))
126126
# define av_tindex_skip_len_mg(av) av_top_index_skip_len_mg(av)
127127

128128
#define NEGATIVE_INDICES_VAR "NEGATIVE_INDICES"

handy.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@ or casts
14121412
*
14131413
* NOT suitable for void*
14141414
*/
1415-
#define ASSERT_IS_PTR(x) (__ASSERT_(sizeof(*(x))) (x))
1415+
#define ASSERT_IS_PTR(x) (assert_(sizeof(*(x))) (x))
14161416

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

14441444
/* For internal use only, this can be used in places where it is known that the
@@ -1453,11 +1453,11 @@ or casts
14531453
/* Returns true if c is in the range l..u, where 'l' is non-negative
14541454
* Written this way so that after optimization, only one conditional test is
14551455
* needed. */
1456-
#define inRANGE(c, l, u) (__ASSERT_((NV) (l) >= 0) __ASSERT_((u) >= (l)) \
1456+
#define inRANGE(c, l, u) (assert_((NV) (l) >= 0) assert_((u) >= (l)) \
14571457
( (sizeof(c) == sizeof(U8)) ? inRANGE_helper_(U8, (c), (l), ((u))) \
14581458
: (sizeof(c) == sizeof(U16)) ? inRANGE_helper_(U16,(c), (l), ((u))) \
14591459
: (sizeof(c) == sizeof(U32)) ? inRANGE_helper_(U32,(c), (l), ((u))) \
1460-
: (__ASSERT_(sizeof(c) == sizeof(WIDEST_UTYPE)) \
1460+
: (assert_(sizeof(c) == sizeof(WIDEST_UTYPE)) \
14611461
inRANGE_helper_(WIDEST_UTYPE,(c), (l), ((u))))))
14621462

14631463
/* For internal use, this is used by machine-generated code which generates
@@ -2096,7 +2096,7 @@ END_EXTERN_C
20962096
: ((UNLIKELY(((U8) (c)) == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS) \
20972097
? LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS \
20982098
: (UNLIKELY(((U8)(c)) == LATIN_SMALL_LETTER_SHARP_S) \
2099-
? (__ASSERT_(0) (c)) /* Fail on Sharp S in DEBUGGING */ \
2099+
? (assert_(0) (c)) /* Fail on Sharp S in DEBUGGING */ \
21002100
: PL_mod_latin1_uc[ (U8) (c) ]))))))
21012101

21022102
/* In this macro, note that the result can be larger than a byte in a UTF-8
@@ -2108,7 +2108,7 @@ END_EXTERN_C
21082108
# define toFOLD_LC(c) \
21092109
((UNLIKELY((c) == MICRO_SIGN) && IN_UTF8_CTYPE_LOCALE) \
21102110
? GREEK_SMALL_LETTER_MU \
2111-
: (__ASSERT_( ! IN_UTF8_CTYPE_LOCALE \
2111+
: (assert_( ! IN_UTF8_CTYPE_LOCALE \
21122112
|| LIKELY((c) != LATIN_SMALL_LETTER_SHARP_S)) \
21132113
toLOWER_LC(c)))
21142114
#endif
@@ -2284,7 +2284,7 @@ END_EXTERN_C
22842284
* class is TRUE for. Hence it can skip the tests for this range.
22852285
* 'above_latin1' should include its arguments */
22862286
#define generic_utf8_safe_no_upper_latin1_(classnum, p, e, above_latin1) \
2287-
(__ASSERT_(_utf8_safe_assert(p, e)) \
2287+
(assert_(_utf8_safe_assert(p, e)) \
22882288
(isASCII(*(p))) \
22892289
? generic_isCC_(*(p), classnum) \
22902290
: (UTF8_IS_DOWNGRADEABLE_START(*(p))) \
@@ -2317,15 +2317,15 @@ END_EXTERN_C
23172317
#define isASCII_utf8_safe(p, e) \
23182318
/* Because ASCII is invariant under utf8, the non-utf8 macro \
23192319
* works */ \
2320-
(__ASSERT_(_utf8_safe_assert(p, e)) isASCII(*(p)))
2320+
(assert_(_utf8_safe_assert(p, e)) isASCII(*(p)))
23212321
#define isBLANK_utf8_safe(p, e) \
23222322
generic_non_invlist_utf8_safe_(CC_BLANK_, is_HORIZWS_high, p, e)
23232323

23242324
#ifdef EBCDIC
23252325
/* Because all controls are UTF-8 invariants in EBCDIC, we can use this
23262326
* more efficient macro instead of the more general one */
23272327
# define isCNTRL_utf8_safe(p, e) \
2328-
(__ASSERT_(_utf8_safe_assert(p, e)) isCNTRL_L1(*(p)))
2328+
(assert_(_utf8_safe_assert(p, e)) isCNTRL_L1(*(p)))
23292329
#else
23302330
# define isCNTRL_utf8_safe(p, e) generic_utf8_safe_(CC_CNTRL_, p, e, 0)
23312331
#endif
@@ -2404,7 +2404,7 @@ END_EXTERN_C
24042404
* point in 'p' is within the 0-255 range, it uses locale rules from the
24052405
* passed-in 'macro' parameter */
24062406
#define generic_LC_utf8_safe_(macro, p, e, above_latin1) \
2407-
(__ASSERT_(_utf8_safe_assert(p, e)) \
2407+
(assert_(_utf8_safe_assert(p, e)) \
24082408
(UTF8_IS_INVARIANT(*(p))) \
24092409
? macro(*(p)) \
24102410
: (UTF8_IS_DOWNGRADEABLE_START(*(p)) \
@@ -2434,7 +2434,7 @@ END_EXTERN_C
24342434
#define isALPHA_LC_utf8_safe(p, e) \
24352435
generic_LC_invlist_utf8_safe_(isALPHA_LC, CC_ALPHA_, p, e)
24362436
#define isASCII_LC_utf8_safe(p, e) \
2437-
(__ASSERT_(_utf8_safe_assert(p, e)) isASCII_LC(*(p)))
2437+
(assert_(_utf8_safe_assert(p, e)) isASCII_LC(*(p)))
24382438
#define isBLANK_LC_utf8_safe(p, e) \
24392439
generic_LC_non_invlist_utf8_safe_(isBLANK_LC, is_HORIZWS_high, p, e)
24402440
#define isCNTRL_LC_utf8_safe(p, e) \
@@ -2502,9 +2502,9 @@ END_EXTERN_C
25022502
* The conversion works both ways, so toCTRL('D') is 4, and toCTRL(4) is D,
25032503
* etc. */
25042504
#ifndef EBCDIC
2505-
# define toCTRL(c) (__ASSERT_(FITS_IN_8_BITS(c)) toUPPER(((U8)(c))) ^ 64)
2505+
# define toCTRL(c) (assert_(FITS_IN_8_BITS(c)) toUPPER(((U8)(c))) ^ 64)
25062506
#else
2507-
# define toCTRL(c) (__ASSERT_(FITS_IN_8_BITS(c)) \
2507+
# define toCTRL(c) (assert_(FITS_IN_8_BITS(c)) \
25082508
((isPRINT_A(c)) \
25092509
? (UNLIKELY((c) == '?') \
25102510
? QUESTION_MARK_CTRL \
@@ -2548,7 +2548,7 @@ typedef U32 line_t;
25482548
* position, and then to the eights position. Both are added together to form
25492549
* 0 if the input is '0'-'9' and to form 9 if alpha. This is added to the
25502550
* final four bits of the input to form the correct value. */
2551-
#define XDIGIT_VALUE(c) (__ASSERT_(isXDIGIT(c)) \
2551+
#define XDIGIT_VALUE(c) (assert_(isXDIGIT(c)) \
25522552
((NATIVE_TO_LATIN1(c) >> 6) & 1) /* 1 if alpha; 0 if not */ \
25532553
+ ((NATIVE_TO_LATIN1(c) >> 3) & 8) /* 8 if alpha; 0 if not */ \
25542554
+ ((c) & 0xF)) /* 0-9 if input valid hex digit */
@@ -2559,7 +2559,7 @@ typedef U32 line_t;
25592559
/* Converts a character known to represent an octal digit (0-7) to its numeric
25602560
* value. The input is validated only by an assert() in DEBUGGING builds. In
25612561
* both ASCII and EBCDIC the last 3 bits of the octal digits range from 0-7. */
2562-
#define OCTAL_VALUE(c) (__ASSERT_(isOCTAL(c)) (7 & (c)))
2562+
#define OCTAL_VALUE(c) (assert_(isOCTAL(c)) (7 & (c)))
25632563

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

locale.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,11 +2776,11 @@ S_bool_setlocale_2008_i(pTHX_
27762776
* calculate_LC_ALL_string() for that. */
27772777
#ifdef USE_LOCALE_NUMERIC
27782778
# define query_nominal_locale_i(i) \
2779-
(__ASSERT_(i != LC_ALL_INDEX_) \
2779+
(assert_(i != LC_ALL_INDEX_) \
27802780
((i == LC_NUMERIC_INDEX_) ? PL_numeric_name : querylocale_i(i)))
27812781
#elif defined(USE_LOCALE)
27822782
# define query_nominal_locale_i(i) \
2783-
(__ASSERT_(i != LC_ALL_INDEX_) querylocale_i(i))
2783+
(assert_(i != LC_ALL_INDEX_) querylocale_i(i))
27842784
#else
27852785
# define query_nominal_locale_i(i) "C"
27862786
#endif

regcomp.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,9 @@ struct regnode_ssc {
488488
#define FLAGS(p) ((p)->head.data.u_8.flags) /* Caution: Doesn't apply to all \
489489
regnode types. For some, it's the \
490490
character set of the regnode */
491-
#define STR_LENs(p) (__ASSERT_(OP(p) != LEXACT && OP(p) != LEXACT_REQ8) \
491+
#define STR_LENs(p) (assert_(OP(p) != LEXACT && OP(p) != LEXACT_REQ8) \
492492
STR_LEN_U8((struct regnode_string *)p))
493-
#define STRINGs(p) (__ASSERT_(OP(p) != LEXACT && OP(p) != LEXACT_REQ8) \
493+
#define STRINGs(p) (assert_(OP(p) != LEXACT && OP(p) != LEXACT_REQ8) \
494494
((struct regnode_string *)p)->string)
495495
#define OPERANDs(p) STRINGs(p)
496496

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

regcomp_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ static const scan_data_t zero_scan_data = {
11001100
/* Convert between a pointer to a node and its offset from the beginning of the
11011101
* program */
11021102
#define REGNODE_p(offset) (RExC_emit_start + (offset))
1103-
#define REGNODE_OFFSET(node) (__ASSERT_((node) >= RExC_emit_start) \
1103+
#define REGNODE_OFFSET(node) (assert_((node) >= RExC_emit_start) \
11041104
(SSize_t) ((node) - RExC_emit_start))
11051105

11061106
#define ProgLen(ri) ri->proglen

regen/regcomp.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ sub print_process_EXACTish {
302302
print $out <<EOP,
303303
304304
/* Is 'op', known to be of type EXACT, folding? */
305-
#define isEXACTFish(op) (__ASSERT_(REGNODE_TYPE(op) == EXACT) (PL_EXACTFish_bitmask & (1U << (op - EXACT))))
305+
#define isEXACTFish(op) (assert_(REGNODE_TYPE(op) == EXACT) (PL_EXACTFish_bitmask & (1U << (op - EXACT))))
306306
307307
/* Do only UTF-8 target strings match 'op', known to be of type EXACT? */
308-
#define isEXACT_REQ8(op) (__ASSERT_(REGNODE_TYPE(op) == EXACT) (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))
308+
#define isEXACT_REQ8(op) (assert_(REGNODE_TYPE(op) == EXACT) (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))
309309
310310
#ifndef DOINIT
311311
EXTCONST U32 PL_EXACTFish_bitmask;

regexec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,7 @@ S_get_break_val_cp_checked(SV* const invlist, const UV cp_in) {
22122212
* And it takes the particular macro name that finds the desired value given a
22132213
* code point. Merely convert the UTF-8 to code point and call the cp macro */
22142214
#define _generic_GET_BREAK_VAL_UTF8(cp_macro, pos, strend) \
2215-
(__ASSERT_(pos < strend) \
2215+
(assert_(pos < strend) \
22162216
/* Note assumes is valid UTF-8 */ \
22172217
(cp_macro(utf8_to_uv_or_die((pos), (strend), NULL))))
22182218

regnodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2962,10 +2962,10 @@ EXTCONST U8 PL_simple_bitmask[] = {
29622962
#endif /* DOINIT */
29632963

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

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

29702970
#ifndef DOINIT
29712971
EXTCONST U32 PL_EXACTFish_bitmask;

0 commit comments

Comments
 (0)