diff options
author | Karl Williamson <khw@cpan.org> | 2018-01-29 20:07:51 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-01-30 11:38:12 -0700 |
commit | 597ee3f45b478da1456092f63d3ac698ee812786 (patch) | |
tree | 06b4bc7ca936eda234d98ba13502d48acb52c1b7 | |
parent | 9c13cd3cdfa6ab6920882a355869287a277989c3 (diff) | |
download | perl-597ee3f45b478da1456092f63d3ac698ee812786.tar.gz |
Use different scheme to handle MSVC6
Recent commit 0b08cab0fc46a5f381ca18a451f55cf12c81d966 caused a function
to not be compiled when running on MSVC6, and hence its callers needed
to use an alternative mechanism there. This is easy enough, it turns
out, but it also turns out that there are more opportunities to call
this function. Rather than having each caller have to know about the
MSVC6 problem, this current commit reimplements the function on that
platform to use a slow, dumb method, so knowing about the issue is
confined to just this one function.
-rw-r--r-- | embed.fnc | 2 | ||||
-rw-r--r-- | embed.h | 6 | ||||
-rw-r--r-- | inline.h | 27 | ||||
-rw-r--r-- | proto.h | 14 | ||||
-rw-r--r-- | regexec.c | 2 |
5 files changed, 31 insertions, 20 deletions
@@ -806,7 +806,7 @@ AndmoR |bool |is_utf8_invariant_string|NN const U8* const s \ AnidR |bool |is_utf8_invariant_string_loc|NN const U8* const s \ |STRLEN len \ |NULLOK const U8 ** ep -#if ! defined(EBCDIC) && ! defined USING_MSVC6 +#ifndef EBCDIC AniR |unsigned int|_variant_byte_number|PERL_UINTMAX_T word #endif #if defined(PERL_CORE) || defined(PERL_EXT) @@ -768,15 +768,15 @@ #define whichsig_sv(a) Perl_whichsig_sv(aTHX_ a) #define wrap_keyword_plugin(a,b) Perl_wrap_keyword_plugin(aTHX_ a,b) #define wrap_op_checker(a,b,c) Perl_wrap_op_checker(aTHX_ a,b,c) -#if ! defined(EBCDIC) && ! defined USING_MSVC6 -#define _variant_byte_number S__variant_byte_number -#endif #if !(defined(HAS_MEMMEM)) #define ninstr Perl_ninstr #endif #if !(defined(HAS_SIGACTION) && defined(SA_SIGINFO)) #define csighandler Perl_csighandler #endif +#if !defined(EBCDIC) +#define _variant_byte_number S__variant_byte_number +#endif #if !defined(HAS_TRUNCATE) && !defined(HAS_CHSIZE) && defined(F_FREESP) #define my_chsize(a,b) Perl_my_chsize(aTHX_ a,b) #endif @@ -401,8 +401,6 @@ S_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep) | ( ( (PTR2nat(x) \ & PERL_WORD_BOUNDARY_MASK) >> 2)))) -# ifndef USING_MSVC6 - /* Do the word-at-a-time iff there is at least one usable full word. That * means that after advancing to a word boundary, there still is at least a * full word left. The number of bytes needed to advance is 'wordsize - @@ -460,7 +458,6 @@ S_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep) } while (x + PERL_WORDSIZE <= send); } -# endif /* End of ! MSVC6 */ #endif /* End of ! EBCDIC */ /* Process per-byte */ @@ -479,10 +476,7 @@ S_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep) return TRUE; } -#if ! defined(EBCDIC) && ! defined(USING_MSVC6) - -/* Apparent compiler error with MSVC6, so can't use this function. All callers - * to it must be compiled to use the EBCDIC fallback on MSVC6 */ +#ifndef EBCDIC PERL_STATIC_INLINE unsigned int S__variant_byte_number(PERL_UINTMAX_T word) @@ -496,7 +490,24 @@ S__variant_byte_number(PERL_UINTMAX_T word) /* Get just the msb bits of each byte */ word &= PERL_VARIANTS_WORD_MASK; -# if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678 +# ifdef USING_MSVC6 /* VC6 has some issues with the normal code, and the + easiest thing is to hide that from the callers */ + { + unsigned int i; + const U8 * s = (U8 *) &word; + dTHX; + + for (i = 0; i < sizeof(word); i++ ) { + if (s[i]) { + return i; + } + } + + Perl_croak(aTHX_ "panic: %s: %d: unexpected zero word\n", + __FILE__, __LINE__); + } + +# elif BYTEORDER == 0x1234 || BYTEORDER == 0x12345678 /* Bytes are stored like * Byte8 ... Byte2 Byte1 @@ -3806,13 +3806,6 @@ PERL_CALLCONV int Perl_yylex(pTHX); PERL_CALLCONV int Perl_yyparse(pTHX_ int gramtype); PERL_CALLCONV void Perl_yyquit(pTHX); PERL_CALLCONV void Perl_yyunlex(pTHX); -#if ! defined(EBCDIC) && ! defined USING_MSVC6 -#ifndef PERL_NO_INLINE_FUNCTIONS -PERL_STATIC_INLINE unsigned int S__variant_byte_number(PERL_UINTMAX_T word) - __attribute__warn_unused_result__; -#endif - -#endif #if ! defined(HAS_MEMRCHR) && (defined(PERL_CORE) || defined(PERL_EXT)) #ifndef PERL_NO_INLINE_FUNCTIONS PERL_STATIC_INLINE void * S_my_memrchr(const char * s, const char c, const STRLEN len); @@ -3868,6 +3861,13 @@ PERL_CALLCONV_NO_RET int Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg) assert(sv); assert(mg) #endif +#if !defined(EBCDIC) +#ifndef PERL_NO_INLINE_FUNCTIONS +PERL_STATIC_INLINE unsigned int S__variant_byte_number(PERL_UINTMAX_T word) + __attribute__warn_unused_result__; +#endif + +#endif #if !defined(HAS_GETENV_LEN) PERL_CALLCONV char* Perl_getenv_len(pTHX_ const char *env_elem, unsigned long *len); #define PERL_ARGS_ASSERT_GETENV_LEN \ @@ -560,7 +560,7 @@ S_find_next_ascii(char * s, const char * send, const bool utf8_target) PERL_ARGS_ASSERT_FIND_NEXT_ASCII; -#if ! defined(EBCDIC) && ! defined(USING_MSVC6) +#ifndef EBCDIC if ((STRLEN) (send - s) >= PERL_WORDSIZE |