This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
embed.fnc: Remove pure function flag for static functions
authorKarl Williamson <khw@cpan.org>
Mon, 12 Dec 2016 21:47:33 +0000 (14:47 -0700)
committerKarl Williamson <khw@cpan.org>
Wed, 14 Dec 2016 17:45:02 +0000 (10:45 -0700)
As mentioned in the comments added in the commit immediately before this
one, declaring a static function pure doesn't tell the compiler anything
more than it can already figure out, and may be destructive if the
compiler decides to skip checking for pureness because we mistakenly
declared something pure that isn't

I added the R flag to the ones that didn't have it, as all these are run
to get their return values.

embed.fnc
proto.h

index aacc195..f2cda86 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -739,7 +739,7 @@ ADMpR       |bool   |isIDFIRST_lazy |NN const char* p
 ADMpR  |bool   |isALNUM_lazy   |NN const char* p
 #ifdef PERL_IN_UTF8_C
 snR    |U8     |to_lower_latin1|const U8 c|NULLOK U8 *p|NULLOK STRLEN *lenp
-inPR   |bool   |is_utf8_cp_above_31_bits|NN const U8 * const s|NN const U8 * const e
+in   |bool   |is_utf8_cp_above_31_bits|NN const U8 * const s|NN const U8 * const e
 #endif
 #if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C)
 EXp    |UV        |_to_fold_latin1|const U8 c|NN U8 *p|NN STRLEN *lenp|const unsigned int flags
@@ -767,16 +767,16 @@ ADMpR     |bool   |is_uni_lower_lc|UV c
 ADMpR  |bool   |is_uni_print_lc|UV c
 ADMpR  |bool   |is_uni_punct_lc|UV c
 ADMpPR |bool   |is_uni_xdigit_lc|UV c
-AnidRP |bool   |is_utf8_invariant_string|NN const U8* const s|STRLEN const len
+AnidR  |bool   |is_utf8_invariant_string|NN const U8* const s|STRLEN const len
 AmnpdRP        |bool   |is_ascii_string|NN const U8* const s|const STRLEN len
 AmnpdRP        |bool   |is_invariant_string|NN const U8* const s|const STRLEN len
 AnpdD  |STRLEN |is_utf8_char   |NN const U8 *s
 Abmnpd |STRLEN |is_utf8_char_buf|NN const U8 *buf|NN const U8 *buf_end
-AnipdP |bool   |is_utf8_string |NN const U8 *s|const STRLEN len
-AnidP  |bool   |is_utf8_string_flags                                       \
+AnipdR |bool   |is_utf8_string |NN const U8 *s|const STRLEN len
+AnidR  |bool   |is_utf8_string_flags                                       \
                |NN const U8 *s|const STRLEN len|const U32 flags
-AnidP  |bool   |is_strict_utf8_string|NN const U8 *s|const STRLEN len
-AnidP  |bool   |is_c9strict_utf8_string|NN const U8 *s|const STRLEN len
+AnidR  |bool   |is_strict_utf8_string|NN const U8 *s|const STRLEN len
+AnidR  |bool   |is_c9strict_utf8_string|NN const U8 *s|const STRLEN len
 Anpdmb |bool   |is_utf8_string_loc                                         \
                |NN const U8 *s|const STRLEN len|NN const U8 **ep
 Andm   |bool   |is_utf8_string_loc_flags                                   \
@@ -808,7 +808,7 @@ Anid        |bool   |is_utf8_fixed_width_buf_loclen_flags                       \
                |NULLOK const U8 **ep|NULLOK STRLEN *el|const U32 flags
 AmndP  |bool   |is_utf8_valid_partial_char                                 \
                |NN const U8 * const s|NN const U8 * const e
-AnidP  |bool   |is_utf8_valid_partial_char_flags                           \
+AnidR  |bool   |is_utf8_valid_partial_char_flags                           \
                |NN const U8 * const s|NN const U8 * const e|const U32 flags
 AMpR   |bool   |_is_uni_FOO|const U8 classnum|const UV c
 AMpR   |bool   |_is_utf8_FOO|const U8 classnum|NN const U8 *p
@@ -910,7 +910,7 @@ EMpRX       |bool   |grok_bslash_o  |NN char** s|NN UV* uv           \
                                |const bool utf8
 EMiR   |char*|form_short_octal_warning|NN const char * const s  \
                                |const STRLEN len
-EiPRn  |I32    |regcurly       |NN const char *s
+EiRn   |I32    |regcurly       |NN const char *s
 #endif
 Apd    |UV     |grok_hex       |NN const char* start|NN STRLEN* len_p|NN I32* flags|NULLOK NV *result
 Apd    |int    |grok_infnan    |NN const char** sp|NN const char *send
@@ -1705,9 +1705,9 @@ ApdD      |UV     |to_utf8_case   |NN const U8 *p                                 \
                                |NN const char *normal|                         \
                                NULLOK const char *special
 #if defined(PERL_IN_UTF8_C)
-inRP   |bool   |does_utf8_overflow|NN const U8 * const s|NN const U8 * e
-inRP   |bool   |is_utf8_overlong_given_start_byte_ok|NN const U8 * const s|const STRLEN len
-inRP   |bool   |isFF_OVERLONG  |NN const U8 * const s|const STRLEN len
+inR    |bool   |does_utf8_overflow|NN const U8 * const s|NN const U8 * e
+inR    |bool   |is_utf8_overlong_given_start_byte_ok|NN const U8 * const s|const STRLEN len
+inR    |bool   |isFF_OVERLONG  |NN const U8 * const s|const STRLEN len
 sMR    |char * |unexpected_non_continuation_text                       \
                |NN const U8 * const s                                  \
                |STRLEN print_len                                       \
@@ -1756,11 +1756,11 @@ p       |void   |utilize        |int aver|I32 floor|NULLOK OP* version|NN OP* idop|NULLOK OP* a
 Ap     |U8*    |utf16_to_utf8  |NN U8* p|NN U8 *d|I32 bytelen|NN I32 *newlen
 Ap     |U8*    |utf16_to_utf8_reversed|NN U8* p|NN U8 *d|I32 bytelen|NN I32 *newlen
 AdpPR  |STRLEN |utf8_length    |NN const U8* s|NN const U8 *e
-AipdPR |IV     |utf8_distance  |NN const U8 *a|NN const U8 *b
-AipdPRn        |U8*    |utf8_hop       |NN const U8 *s|SSize_t off
-AipdPRn        |U8*    |utf8_hop_back|NN const U8 *s|SSize_t off|NN const U8 *start
-AipdPRn        |U8*    |utf8_hop_forward|NN const U8 *s|SSize_t off|NN const U8 *end
-AipdPRn        |U8*    |utf8_hop_safe  |NN const U8 *s|SSize_t off|NN const U8 *start|NN const U8 *end
+Aipd |IV     |utf8_distance  |NN const U8 *a|NN const U8 *b
+AipdRn |U8*    |utf8_hop       |NN const U8 *s|SSize_t off
+AipdRn |U8*    |utf8_hop_back|NN const U8 *s|SSize_t off|NN const U8 *start
+AipdRn |U8*    |utf8_hop_forward|NN const U8 *s|SSize_t off|NN const U8 *end
+AipdRn |U8*    |utf8_hop_safe  |NN const U8 *s|SSize_t off|NN const U8 *start|NN const U8 *end
 ApMd   |U8*    |utf8_to_bytes  |NN U8 *s|NN STRLEN *len
 Apd    |int    |bytes_cmp_utf8 |NN const U8 *b|STRLEN blen|NN const U8 *u \
                                |STRLEN ulen
@@ -2287,7 +2287,7 @@ Ei        |regnode*|handle_named_backref|NN RExC_state_t *pRExC_state         \
                                |NN I32 *flagp                              \
                                |NN char * parse_start                      \
                                |char ch
-EsnP   |unsigned int|regex_set_precedence|const U8 my_operator
+EsnR   |unsigned int|regex_set_precedence|const U8 my_operator
 Es     |regnode*|handle_regex_sets|NN RExC_state_t *pRExC_state \
                                |NULLOK SV ** return_invlist            \
                                |NN I32 *flagp|U32 depth                \
@@ -2385,8 +2385,8 @@ Es        |I32    |make_trie      |NN RExC_state_t *pRExC_state \
                                |U32 word_count|U32 flags|U32 depth
 Es     |regnode *|construct_ahocorasick_from_trie|NN RExC_state_t *pRExC_state \
                                 |NN regnode *source|U32 depth
-EnPs   |const char *|cntrl_to_mnemonic|const U8 c
-EnPs   |int    |edit_distance  |NN const UV *src                   \
+EnsR   |const char *|cntrl_to_mnemonic|const U8 c
+EnsR   |int    |edit_distance  |NN const UV *src                   \
                                |NN const UV *tgt                   \
                                |const STRLEN x                     \
                                |const STRLEN y                     \
diff --git a/proto.h b/proto.h
index b760924..8a2c9d6 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -1331,8 +1331,7 @@ PERL_CALLCONV bool        Perl_isIDFIRST_lazy(pTHX_ const char* p)
                        __attribute__pure__; */
 
 PERL_STATIC_INLINE bool        S_is_c9strict_utf8_string(const U8 *s, const STRLEN len)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_IS_C9STRICT_UTF8_STRING       \
        assert(s)
 
@@ -1348,8 +1347,7 @@ PERL_CALLCONV I32 Perl_is_lvalue_sub(pTHX)
                        __attribute__warn_unused_result__;
 
 PERL_STATIC_INLINE bool        S_is_strict_utf8_string(const U8 *s, const STRLEN len)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_IS_STRICT_UTF8_STRING \
        assert(s)
 
@@ -1563,8 +1561,7 @@ PERL_CALLCONV bool        Perl_is_utf8_idfirst(pTHX_ const U8 *p)
        assert(p)
 
 PERL_STATIC_INLINE bool        S_is_utf8_invariant_string(const U8* const s, STRLEN const len)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_IS_UTF8_INVARIANT_STRING      \
        assert(s)
 
@@ -1617,14 +1614,12 @@ PERL_CALLCONV bool      Perl_is_utf8_space(pTHX_ const U8 *p)
        assert(p)
 
 PERL_STATIC_INLINE bool        Perl_is_utf8_string(const U8 *s, const STRLEN len)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_IS_UTF8_STRING        \
        assert(s)
 
 PERL_STATIC_INLINE bool        S_is_utf8_string_flags(const U8 *s, const STRLEN len, const U32 flags)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_IS_UTF8_STRING_FLAGS  \
        assert(s)
 
@@ -1651,8 +1646,7 @@ PERL_CALLCONV bool        Perl_is_utf8_upper(pTHX_ const U8 *p)
                        __attribute__pure__; */
 
 PERL_STATIC_INLINE bool        S_is_utf8_valid_partial_char_flags(const U8 * const s, const U8 * const e, const U32 flags)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_IS_UTF8_VALID_PARTIAL_CHAR_FLAGS      \
        assert(s); assert(e)
 
@@ -3492,32 +3486,27 @@ PERL_CALLCONV U8*       Perl_utf16_to_utf8_reversed(pTHX_ U8* p, U8 *d, I32 bytelen, I
 #define PERL_ARGS_ASSERT_UTF16_TO_UTF8_REVERSED        \
        assert(p); assert(d); assert(newlen)
 PERL_STATIC_INLINE IV  Perl_utf8_distance(pTHX_ const U8 *a, const U8 *b)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_UTF8_DISTANCE \
        assert(a); assert(b)
 
 PERL_STATIC_INLINE U8* Perl_utf8_hop(const U8 *s, SSize_t off)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_UTF8_HOP      \
        assert(s)
 
 PERL_STATIC_INLINE U8* Perl_utf8_hop_back(const U8 *s, SSize_t off, const U8 *start)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_UTF8_HOP_BACK \
        assert(s); assert(start)
 
 PERL_STATIC_INLINE U8* Perl_utf8_hop_forward(const U8 *s, SSize_t off, const U8 *end)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_UTF8_HOP_FORWARD      \
        assert(s); assert(end)
 
 PERL_STATIC_INLINE U8* Perl_utf8_hop_safe(const U8 *s, SSize_t off, const U8 *start, const U8 *end)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_UTF8_HOP_SAFE \
        assert(s); assert(start); assert(end)
 
@@ -4904,8 +4893,7 @@ PERL_STATIC_INLINE void   S_alloc_maybe_populate_EXACT(pTHX_ RExC_state_t *pRExC_s
 #define PERL_ARGS_ASSERT_ALLOC_MAYBE_POPULATE_EXACT    \
        assert(pRExC_state); assert(node); assert(flagp)
 STATIC const char *    S_cntrl_to_mnemonic(const U8 c)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 
 PERL_STATIC_INLINE U8  S_compute_EXACTish(RExC_state_t *pRExC_state);
 #define PERL_ARGS_ASSERT_COMPUTE_EXACTISH      \
@@ -4914,8 +4902,7 @@ STATIC regnode *  S_construct_ahocorasick_from_trie(pTHX_ RExC_state_t *pRExC_sta
 #define PERL_ARGS_ASSERT_CONSTRUCT_AHOCORASICK_FROM_TRIE       \
        assert(pRExC_state); assert(source)
 STATIC int     S_edit_distance(const UV *src, const UV *tgt, const STRLEN x, const STRLEN y, const SSize_t maxDistance)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_EDIT_DISTANCE \
        assert(src); assert(tgt)
 
@@ -5027,8 +5014,7 @@ STATIC regnode*   S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 dept
 #define PERL_ARGS_ASSERT_REGCLASS      \
        assert(pRExC_state); assert(flagp)
 STATIC unsigned int    S_regex_set_precedence(const U8 my_operator)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 
 STATIC void    S_reginsert(pTHX_ RExC_state_t *pRExC_state, U8 op, regnode *opnd, U32 depth);
 #define PERL_ARGS_ASSERT_REGINSERT     \
@@ -5184,8 +5170,7 @@ PERL_CALLCONV bool        Perl_grok_bslash_x(pTHX_ char** s, UV* uv, const char** error
        assert(s); assert(uv); assert(error_msg)
 
 PERL_STATIC_INLINE I32 S_regcurly(const char *s)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_REGCURLY      \
        assert(s)
 
@@ -5613,14 +5598,12 @@ STATIC UV       S_check_locale_boundary_crossing(pTHX_ const U8* const p, const UV res
        assert(p); assert(ustrp); assert(lenp)
 
 PERL_STATIC_INLINE bool        S_does_utf8_overflow(const U8 * const s, const U8 * e)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_DOES_UTF8_OVERFLOW    \
        assert(s); assert(e)
 
 PERL_STATIC_INLINE bool        S_isFF_OVERLONG(const U8 * const s, const STRLEN len)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_ISFF_OVERLONG \
        assert(s)
 
@@ -5630,14 +5613,12 @@ PERL_STATIC_INLINE bool S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, co
        assert(p); assert(swash); assert(swashname)
 
 PERL_STATIC_INLINE bool        S_is_utf8_cp_above_31_bits(const U8 * const s, const U8 * const e)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_IS_UTF8_CP_ABOVE_31_BITS      \
        assert(s); assert(e)
 
 PERL_STATIC_INLINE bool        S_is_utf8_overlong_given_start_byte_ok(const U8 * const s, const STRLEN len)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_IS_UTF8_OVERLONG_GIVEN_START_BYTE_OK  \
        assert(s)