summaryrefslogtreecommitdiff
path: root/perl.h
Commit message (Collapse)AuthorAgeFilesLines
* implement diagnostics ignore/restore macros for Visual C++Tomasz Konojacki2019-04-051-0/+13
|
* Use POSIX locale functions if setlocale not availableKarl Williamson2019-03-061-20/+34
| | | | | | POSIX 2008 added an independent set of locale handling functions beyond the venerable setlocale. This commit changes so they can be used rather than have no locale handling if there is, say, a problem with setlocale.
* perl.h: Improve a comment's wordingKarl Williamson2019-03-041-1/+1
|
* Add mutex for dealing with qr/\p{user-defined}/Karl Williamson2019-02-141-0/+8
| | | | This will be used in future commits
* regen/warnings.pl: Fix undefined C behaviorKarl Williamson2019-01-051-0/+5
| | | | | | | | | This fixes compiler warnings "performing pointer arithmetic on a null pointer has undefined behavior" There are several ways to fix this. This one was suggested by Tomasz Konojacki++. Instead of trying to point to address 1 and 2, two variables are created, and we point to them. const is cast away.
* perl.h: Fix typo in commentKarl Williamson2018-12-311-1/+0
|
* perl.h - support C99 math for mingwsisyphus2018-12-111-1/+1
|
* regexec.c: Use mnemonics instead of "256"Karl Williamson2018-12-071-2/+2
| | | | | | | | | | | | | There are only three valid numbers in Computer Science: 0, 1, and "as many as you like". 256 is not therefore a valid number, and its use should be commented, or better, a mnemonic used instead. These uses were spotted by lgtm as being unnecessary, and some people were confused as to their purpose. This commit changes the 256, to in one case, a sizeof() that indicates its a guard against going outside the array bounds of that data structure. And in the 2nd case, it verifies that it fits inside the space allotted to a function parameter. A comment helps clarify that.
* Allow forcing use of POSIX 2008 locale fcnsKarl Williamson2018-11-191-2/+7
| | | | | | | These thread-safe functions are not normally used on unthreaded builds, retaining the use of the library functions that have long been used. But, it is now possible to tell Configure to use them on unthreaded builds.
* perl.h: White-space, commentKarl Williamson2018-11-161-6/+6
|
* regcomp.c: Test that code block exists before cleaningKarl Williamson2018-10-201-1/+1
| | | | This is defensive coding progress, to avoid dereferencing a NULL ptr.
* regcomp.h: Swap struct vs typedefKarl Williamson2018-10-201-3/+2
| | | | | | | This struct has two names. I previously left the less descriptive one as the primary because of back compat issues. But I now realize that regcomp.h is only used in the core, so it's ok to swap for the better name to be primary.
* Create Ptrdiff_t typeKarl Williamson2018-09-201-1/+10
| | | | | | which evaluates to SSize_t in the unlikely event that there isn't a ptrdiff_t on the platform. ptrdiff_t is safer than ssize_t, as the latter need not contain any negative number besides -1.
* (perl #133510) use quadmath versions of log10, ldexp and signbitTony Cook2018-09-121-1/+4
| | | | | | | | | | | | With -Dquadmath C++ builds, the calls to log10() and ldexp() would cause ambiguous overloaded function errors, since all of log10(float), log10(double) and log10(long double) were canidates for a log10(__float128) call. Similarly for ldexp(). signbit() had a different problem, two of the tests in ext/POSIX/t/math.t failed with the default signbit() macro, presumably because the __float128 was being converted to a long double, since the macro in math.h didn't special case for __float128.
* perl.h - mingw-w64 builds use __mingw_strtold instead of strtoldsisyphus2018-08-091-1/+11
| | | | | | | There are bugs in strtold(). James Keenan fixed a file permissions problem originally introduced by this commit, but the fix has been squashed into it.
* perl.h: Use TAINT_get, instead of PL_tainting.Karl Williamson2018-08-051-1/+1
| | | | The former is designed to be compilable out.
* Make new EBCDIC tables global.Craig A. Berry2018-07-081-6/+6
| | | | | | | They are defined in the Perl library but referenced in the Perl executable, but the Perl executable can't see them unless they are exported by the library, and some linkers only make a symbol a public export if they've been told to explicitly.
* perl.h: Properly indent a #ifKarl Williamson2018-07-071-1/+1
|
* Make isC9_STRICT_UTF8_CHAR() an inline dfaKarl Williamson2018-07-051-0/+94
| | | | | This replaces a complicated trie with a dfa. This should cut down the number of conditionals encountered in parsing many code points.
* Add dfa for strict translation from UTF-8Karl Williamson2018-07-051-0/+154
|
* Make UTF-8 dfa table an EXTCONSTKarl Williamson2018-07-051-0/+172
| | | | This will allow it to be used inline.
* Fix to compile under -DNO_LOCALEKarl Williamson2018-07-011-0/+3
| | | | | Several problems with this compile option were not caught before 5.28 was frozen.
* perl.h: Add parens around macro argumentsKarl Williamson2018-07-011-1/+1
| | | | | | Arguments used within macros need to be parenthesized in case they are called with an expression. This commit changes _CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG() to do that.
* Create my_atof3()Karl Williamson2018-06-251-1/+2
| | | | | | | | | | | | | | This is like my_atof2(), but with an extra argument signifying the length of the input string to parse. If that length is 0, it uses strlen() to determine it. Then my_atof2() just calls my_atof3() with a zero final parameter. And this commit just uses the bulk of the current my_atof2() as the core of my_atof3(). Changes were needed however, because it relied on NUL-termination in a number of places. This allows one to convert a string that isn't necessarily NUL-terminated to an NV.
* Finally fix C++ build with VS2017Steve Hay2018-04-281-2/+9
| | | | | | Dodge the "offsetof has a builtin meaning; use /Zc:offsetof- to revert to old, non-conforming definition" error when compiling Socket.xs by reverting to an old definition of STRUCT_OFFSET for that compiler.
* fix linkage of PL_inf/nan under C++David Mitchell2018-04-251-5/+4
| | | | | | | | | | | RT #132955 Commit 0879cd66ef3f00 fixed perl to still build under C++ after changes to PL_inf and PL_nan. Unfortunately this seems to have broken C++ builds under Windows. Handle the extern 'C' stuff in a different way - as suggested by Leon T - that hopefully satisfies all platforms.
* perl.h: Clarify commentKarl Williamson2018-03-311-1/+1
|
* Fix locale problems on mingwKarl Williamson2018-03-191-0/+3
| | | | | | | | | | | | | | | | Various symbols get exported (or not) by makedef.pl. The determination of some of the new ones is fairly complex in perl.h, and unfortunately in general the code logic to do so must be copied into makedef.pl (until a volunteer fixes this). I thought I could avoid a bunch of this by using the symbol ${^SAFE_LOCALES} which in fact was created so that programs wouldn't have to know about this complexity. The problem is that on Windows, miniperl is always compiled single-thread and so locales are always safe, and so makedef.pl (which is called by miniperl) got the wrong information. The solution, unfortunately, is to reproduce the complexity in makedef.pl Spotted by Daniel Dragan.
* Fix comments/pod for LC_NUMERIC not always CKarl Williamson2018-03-121-15/+17
| | | | | | | | | | | In recent Perl versions, the underlying locale for LC_NUMERIC has been kept in C because XS code is expecting a dot radix character. But if the LC_NUMERIC locale has a dot, that is unnecessary. (There is also the thousands grouping separator which for safety we verify is empty.) Thus 5.27 doesn't always keep the underlying locale in C; it does so only if necessary. This commit updates various comments and pods to reflect this change.
* perl.h: White-space, comment changes onlyKarl Williamson2018-03-121-22/+22
|
* Work around Microsoft threaded locale bug for localeconv()Karl Williamson2018-03-121-6/+39
| | | | | | | | | | | | Prior to Visual Studio 2015, the localeconv() function only looks at the global locale, not the per-thread one it should. This works around this by creating critical sections, switching to the global locale to call localeconv(), then switching back. For the most common usage, it avoids the switch by parsing a string it generates that should contain the desired substring. This leaves the switch required for retrieving the floating point grouping separator and the currency string, plus POSIX::localeconv(). The first two could be avoided by extra code as detailed in the pod for switch_to_global_locale(); patches welcome!
* perl.h: Move macros to earlier in the fileKarl Williamson2018-03-121-31/+32
| | | | There should be no other differences
* perl.h: Refactor some #definesKarl Williamson2018-03-121-23/+21
| | | | | These put the defines dealing with locale critical sections in one place, more logically set out.
* Resync duplicated code in perl.h makedef.plKarl Williamson2018-03-121-2/+3
| | | | These had gotten out of sync
* Don't create locale object unless threadedKarl Williamson2018-03-121-3/+1
| | | | | | PL_C_locale_obj is now only created on threaded builds on systems with POSIX 2008. On unthreaded builds, we really should continue to use the old tried and true library calls.
* perl.h: Move some locale definitions aroundKarl Williamson2018-03-121-97/+101
| | | | | | | | | For clarity, this places these locale definitions that depend solely on having locales or not earlier, and by themselves, so don't get mixed up with the definitions that have more complicated provenances. In moving them, I also changed white space to accepted indentations, and vertical alignment.
* perl.h: Rmv dummy definitionsKarl Williamson2018-03-121-4/+0
| | | | | These macros are core-only, so should generate a compiler error if used outside of core, instead of compiling as no-ops.
* subtly change meaning of XATTRBLOCK, XATTRTERMDavid Mitchell2018-03-021-2/+2
| | | | | | | | | | | | | | Currently they tell the toker that the next thing will be attributes, followed by an XBLOCK or XTERMBLOCK respectively. This commit subtly changes their meanings so that they indicate that attributes legally *might* follow. This makes the code which initially sets them slightly simpler (no need to check whether the next char is ':'), and the code elsewhere in yylex() which handles XATTR* only triggers if the next char is ':' anyway. Doing it this way will shortly make detection simpler of an attribute illegally following a signature.
* perl.h: Add comment about clang warningsKarl Williamson2018-03-011-1/+5
| | | | | | Commit b2f82b52000c3bfe6e6df200c775e2a639d91552 failed to document details about the clang warnings. This commit adds a link to clang's documentation
* Silence wrong clang warningsKarl Williamson2018-03-011-2/+4
| | | | | Clang thread-safety analysis fails to correctly work in this situation (and is documented as failing), so turn off that warning here.
* perl.h: Add, revise some locale debugging infoKarl Williamson2018-02-181-14/+20
|
* Add thread-safe locale handlingKarl Williamson2018-02-181-9/+15
| | | | | | This (large) commit allows locales to be used in threaded perls on platforms that support it. This includes recent Windows and Posix 2008 ones.
* perl.h: Add debugging statements for mutex opsKarl Williamson2018-02-181-2/+12
|
* Latch LC_NUMERIC during critical sectionsKarl Williamson2018-02-181-33/+142
| | | | | | | | | | | | | | It is possible for operations on threaded perls which don't 'use locale' to still change the locale. This happens when calling POSIX::localeconv() and I18N::Langinfo(), and in earlier perls, it can happen for other operations when perl has been initialized with the environment causing the various locale categories to not have a uniform locale. This commit causes the areas where the locale for this category should predictably be in one or the other state to be a critical section where another thread can't interrupt and change it. This is a separate mutex, so that only these particular operations will be held up.
* perl.h: Add dTHX_DEBUGGINGKarl Williamson2018-02-181-1/+7
| | | | which is a NOOP except on DEBUGGING builds
* perl.h Move some #definesKarl Williamson2018-02-181-18/+19
| | | | | | These are used so that they appear ahead of #include intrpvar.h, so they can be used by that file. This enables this commit to simplify some #ifdefs
* perl.h: Remove some obsolete macrosKarl Williamson2018-01-301-20/+0
| | | | These no longer make sense; were for core internal use only
* Simplify some LC_NUMERIC macrosKarl Williamson2018-01-301-21/+10
| | | | | | | These macros are marked as subject to change and are not documented externally. I don't know what I was thinking when I named some of them, but whatever no longer makes sense to me. Simplify them, and change so there is only one restore macro to remember.
* perl.h: Remove unused locale core macroKarl Williamson2018-01-301-7/+0
| | | | | | This undocumented macro is unused in the core, and all these are commented that they are subject to change. And it confuses things, so just remove it.
* Avoid some unnecessary changing of localesKarl Williamson2018-01-301-0/+5
| | | | | | | | | | The LC_NUMERIC locale category is kept so that generally the decimal point (radix) is a dot. For some (mostly) output purposes, it needs to be swapped into the program's current underlying locale so that a non-dot can be printed. This commit changes things so that if the current underlying locale uses a decimal point, the swap doesn't happen, as it's not needed.