summaryrefslogtreecommitdiff
path: root/mathoms.c
Commit message (Collapse)AuthorAgeFilesLines
* Eliminated 3 '-Wparentheses' warnings detected by g++-8.James E Keenan2018-10-101-2/+2
| | | | For: RT # 133557
* mathoms.c: Use my_strnlen, not strnlenKarl Williamson2018-08-041-1/+1
| | | | Spotted by H. Merijn Brand.
* mathoms.c: Make safer a deprecated functionKarl Williamson2018-08-031-2/+3
| | | | | | | This function is deprecated because it is lacking a length parameter, so malformed UTF-8 may cause it to read beyond the buffer. This commit causes it to not read beyond a NUL character, which makes it safe for the common case that the input is a C string.
* Revert "Remove some deprecated functions from mathoms.c"Karl Williamson2018-07-191-0/+241
| | | | | | This reverts commit e6e9f5a198d7e054e6857a9c6e99a07d639f7f3c. I think it best to revert this until I'm ready for stating in perldelta exactly the options for replacing uses of these functions.
* Remove some deprecated functions from mathoms.cKarl Williamson2018-06-281-241/+0
| | | | | These have been deprecated since 5.18, and have security issues, as they can try to read beyond the end of the buffer.
* fix -DNO_MATHOMS build, mathomed syms were not removed from perldll.defDaniel Dragan2018-04-151-0/+2
| | | | | | | | | | | | | | | | | | | Commit 3f1866a8f6 assumed "A" flag means a function can't be mathomed. Not true. Many funcs were listed in embed.fnc as "A" yet were in mathoms.c. This caused a missing symbol link failure on Win32 with -DNO_MATHOMS, since the "A" mathomed funcs were now put into perlldll.def while previously they were parsed out of mathoms.c by makedef.pl. Revise the logic so "b" means instant removal from the export list on a no mathoms build. embed.fnc "b" flag adds were generated from a missing symbol list from my linker, some funcs not in my build/platform config might need to be "b" flagged in future. Some funcs like ASCII_TO_NEED were already marked "b" but still being by mistake exported because they were also "A". sv_2bool, sv_eq and sv_collxfrm also needed a "p" flag or a Perl_-less symbol was declared in proto.h. sv_2bool and sv_collxfrm also failed porting/args_assert.t so add those macros to mathoms.c
* Move utf8_to_uvchr out of mathoms.cKarl Williamson2018-04-151-30/+0
| | | | | | This function can't be in mathoms because of its use in Devel::PPPort. I tried fixing that, but the tools just hung, so this commit moves it back to utf8.c, while still deprecated.
* widen size-type variables in pack/unpackZefram2017-12-161-1/+1
| | | | | | Most size-type variables in pp_pack.c were of type I32, with a smattering of other types. Use SSize_t in place of I32, and generally use size_t-width variables as appropriate. Fixes [perl #119367].
* Use cBOOL() instead of ? TRUE : FALSEDagfinn Ilmari Mannsåker2017-01-251-4/+2
| | | | Except under cpan/ and dist/
* regcomp.c, mathoms.c: Convert to use preferred macroKarl Williamson2016-12-231-4/+4
| | | | Better to use the macro than to directly call the function it wraps
* Clean up warnings uncovered by 'clang -Weverything'.Andy Lester2016-12-051-0/+2
| | | | For: RT #130195
* inline.h: Add 'const's; avoid hiding outer variableKarl Williamson2016-09-171-1/+1
| | | | | This changes some formal parameters to be const, and avoids reusing the same variable name within an inner block, to avoid confusion
* mathoms.c: Restore previous behaviour of sv_copypvFather Chrysostomos2016-08-111-1/+1
| | | | | | | | | | | | | | | This commit made it a simple wrapper around the new sv_copypv_flags: commit 4bac9ae47b5ad7845a24e26b0e95609805de688a Author: Chip Salzenberg <chip@pobox.com> Date: Fri Jun 22 15:18:18 2012 -0700 Magic flags harmonization. But in so doing it changed the behaviour of the functional version (Perl_sv_copypv), while preserving the existing behaviour in the new macro (sv_copypv). The latter invokes get-magic, while the former used to but stopped doing so.
* Unmathomize save_ivFather Chrysostomos2016-07-271-11/+0
| | | | I need to call it from toke.c.
* mv function from locale.c to mathoms.cKarl Williamson2016-05-241-0/+12
| | | | | | The previous commit causes this function being moved to be just a wrapper not called in core. Just in case someone is calling it, it is retained, but moved to mathoms.c
* mathoms.c: Remove obsolete textKarl Williamson2016-05-241-3/+0
| | | | | makedef.pl no longer needs special handling for any functions that get moved to mathoms.c
* mathoms.c: consolidate commentsDavid Mitchell2016-05-231-18/+17
| | | | | | | | | | | The head of this source file contains quite a few general comment paragraphs. Consolidate them all into one /* * */ block.
* mathoms.c: add explanation why fns must be keptDavid Mitchell2016-05-231-2/+10
| | | | See http://nntp.perl.org/group/perl.perl5.porters/236384.
* mathoms.c: Add instructions for moving code hereKarl Williamson2016-05-171-3/+17
| | | | Suggested by Dave Mitchell.
* mathoms.c: Remove special casing from instr()Karl Williamson2016-05-121-9/+2
| | | | | | | This function was recently moved to mathoms. Now that various changes have been made to the system, the special casing needed to get things to compile can be removed. Also, it can just call the macro implementation, instead of what the macro expands to.
* embed.fnc: Alter 'b' flag meaningKarl Williamson2016-05-121-61/+1
| | | | | | | | | | | | | This commit changes this flag to mean that the backward compatibility functions are compiled unless the -DNO_MATHOMS cflag is specified to Configure. Previously the meaning was sort of like that but not precisely. Doing this means that the prototypes that needed to be manually added to mathoms.c are no longer needed. No special parameter assertions have to be made. makedef.pl no longer needs to parse mathoms.c and have special cases for it. And several special case entries in embed.fnc can be non-special cased.
* mathoms.c: Fix prototypeKarl Williamson2016-05-121-3/+2
| | | | | This would probably have refused to compile if anyone were actually using this function in a threaded build.
* Finish mathomizing Perl_instr.Craig A. Berry2016-05-091-0/+20
| | | | | | | | | | | | | | | | | | | | | | fea1d2dd5d210564d4 turned instr into a macro. It also left the actual function in util.c while commenting out the prototype in proto.h (via the m flag in embed.fnc). A function compiled without a prototype under C++ does not get declared with extern "C" and thus gets mangled, which breaks the build with a strict linker (VMS, possibly AIX) because the expected symbol name is no longer produced. Without a strict linker, it just breaks the binary compatibility that was presumably the nominal reason for leaving the function around in the first place. So move the function into mathoms.c and put its prototype in the extern "C"-guarded section at the top of the same file. We also have to fake the PERL_ARGS_ASSERT_INSTR macro since its original declaration in proto.h is commented out but the porting test t/porting/args_assert.t will take revenge if it doesn't find the macro being used somewhere.
* Various pods: Add C<> around many typed-as-is thingsKarl Williamson2015-09-031-14/+14
| | | | Removes 'the' in front of parameter names in some instances.
* perlapi, perlintern: Add L<> links to podKarl Williamson2015-09-031-3/+3
|
* perlapi: Use C<> instead of I<> for parameter names, etcKarl Williamson2015-08-011-1/+1
| | | | | The majority of perlapi uses C<> to specify these things, but a few things used I<> instead. Standardize to C<>.
* Revert "Mathomise save_re_context"David Mitchell2015-03-301-6/+0
| | | | | | This reverts commit 0ddd4a5b1910c8bfa9b7e55eb0db60a115fe368c. Turns out we need the save_re_context() function after all.
* Replace common Emacs file-local variables with dir-localsDagfinn Ilmari Mannsåker2015-03-221-6/+0
| | | | | | | | | | | | | | | | An empty cpan/.dir-locals.el stops Emacs using the core defaults for code imported from CPAN. Committer's work: To keep t/porting/cmp_version.t and t/porting/utils.t happy, $VERSION needed to be incremented in many files, including throughout dist/PathTools. perldelta entry for module updates. Add two Emacs control files to MANIFEST; re-sort MANIFEST. For: RT #124119.
* Remove out-dated comment from mathoms.cSteve Hay2015-01-271-2/+0
| | | | | | | The previous commit did not honour this comment, and was evidently not the first to have not seen it either: at least 09d7a3ba91 and 0d7d409d8d have already added new functions in the 'wrong' place, so just remove the comment.
* move functions marked as mathomed in embed.fnc to mathoms.cDaniel Dragan2015-01-271-0/+24
| | | | | | | | | | | | | | | | Ever since commit 075eb5c9b6 mathom functions must be in mathoms.c for their symbols to be skipped in makedef.pl on Win32 Perl. If a function is marked 'b' in embed.fnc, regen.pl does NOT add its prototype to proto.h (it is commented out). Without the proto.h entry, EXTERN_C will be missing and a -DNO_MATHOMS + C++ Win32 Perl build will not link, since the C function will have a mangled name and the symbol will not be found for creating the perl linking library. Also add EXTERN_C to Win32CORE, the init_Win32CORE symbol is special cased for exporting in makedef.pl. Perl_is_utf8_char_buf was marked as 'b' in commit 3cedd9d930 Perl_sv_copypv was marked as 'b' in commit 4bac9ae47b
* makedef.pl: don't hard-code list of mathomsAaron Crane2014-12-141-1/+2
| | | | | | | | | | | | | | | It's easy enough to read the list out of mathoms.c directly, and this should prevent almost all bugs of the sort that were fixed by 083750a56b7927292a4bf7b1bf64aa26dd2a6858. (Only names that don't begin with "Perl_" will cause a problem.) The list of names detected automatically may actually differ slightly from the hard-coded list; for example, the definition of Perl_huge() is inside "#if defined(HUGE_VAL) || (defined(USE_LONG_DOUBLE) && defined(HUGE_VALL))", but the new code in makedef.pl ignores preprocessor conditions. However, the list is used as names to *skip*, rather than to include, so it's not a problem if makedef.pl is willing to skip names that it will never be asked to include.
* fix incomplete mathoming of Perl_pad_compname_typeDaniel Dragan2014-12-011-0/+2
| | | | | commit 09d7a3ba91 moved Perl_pad_compname_type to mathoms but didn't update makedef.pl. This causes a link failure of perl521.dll on Win32.
* Mathomise pad_compname_typeFather Chrysostomos2014-11-301-0/+16
|
* Mathomise save_re_contextFather Chrysostomos2014-09-121-0/+7
| | | | at Jarkko’s suggestion.
* Remove or downgrade unnecessary dVAR.Jarkko Hietaniemi2014-06-251-58/+0
| | | | | | | | You need to configure with g++ *and* -Accflags=-DPERL_GLOBAL_STRUCT or -Accflags=-DPERL_GLOBAL_STRUCT_PRIVATE to see any difference. (g++ does not do the "post-annotation" form of "unused".) The version code has some of these issues, reported upstream.
* Silence -Wunused-parameter my_perl under threads.Jarkko Hietaniemi2014-06-191-0/+27
| | | | | | | | | | | | | | For S_ functions, remove the context. For Perl_ functions, add PERL_UNUSED_CONTEXT. Tricky because sometimes depends on DEBUGGING, and sometimes on whether we are have PERL_IMPLICIT_SYS. (Why all the mathoms Perl_is_uni_... and Perl_is_utf8_... functions are not being whined about is a mystery.) vutil.c (included via util.c) has one of these, but it's cpan/, and a known problem: https://rt.cpan.org/Ticket/Display.html?id=96100
* perlapi: Refactor placements, headings of some functionsKarl Williamson2014-06-051-0/+8
| | | | | | | | | | | | | | It is not very user friendly to list functions as "Functions found in file FOO". Better is to group them by purpose, as many were already. I went through and placed the ones that weren't already so grouped into groups. Patches welcome if you have a better classification. I changed the headings of some so that the important disctinction was the first word so that they are placed in the file more appropriately. And a couple of ones that I had created myself, I came up with a name that I think is better than the original
* Move some deprecated utf8-handling functions to mathomsKarl Williamson2014-05-311-0/+162
| | | | | This entailed creating new internal functions for some of them to call so that the functionality can be retained during the deprecation period.
* add va_end() calls where missing for a va_start() or va_end().Jarkko Hietaniemi2014-05-291-2/+8
| | | | | | | | | | | | | Fix for Coverity perl5 CIDs 29225, 29226, 29227, 29228, 29229: Missing varargs init or cleanup (VARARGS) missing va_end: va_end was not called for foo. Use of va_args must be finished off with va_end (in other words, use of va_start or va_copy must be bracketed off with va_end). In most platforms va_end is a no-op, but in some platforms it is required for proper cleanup (or face stack smash, or memory leak). Tony: move va_start() out of the declaration block
* Taint more operands with case changesKarl Williamson2014-01-271-4/+4
| | | | | | | | | | The documentation says that Perl taints certain operations when subject to locale rules, such as lc() and ucfirst(). Prior to this commit there were exceptions when the operand to these functions contained no characters whose case change actually varied depending on the locale, for example the empty string or above-Latin1 code points. Changing to conform to the documentation simplifies the core code, and yields more consistent results.
* utf8.c: Move a bunch of deprecated fcns to mathoms.cKarl Williamson2014-01-051-0/+395
| | | | | These functions will be out of the way in mathoms. There were a few that could not be moved, as-is, so I left them.
* perlapi: Consistent spaces after dotsFather Chrysostomos2013-12-291-17/+19
| | | | plus some typo fixes. I probably changed some things in perlintern, too.
* [perl #115736] fix undocumented param from newATTRSUB_flagsDaniel Dragan2013-12-231-1/+1
| | | | | flags param was poorly designed and didn't have a formal api. Replace it with the bool it really is. See #115736 for details.
* remove almost unreachable NULL sv arg code from sv_2*n_flagsDaniel Dragan2013-11-281-0/+6
| | | | | | | | | | | The NULL sv code being removed dates to commit e334a159a5 Perl 1.0 as the pre-SV str_2ptr and str_2num calls. When SVs were intoduced in commit 79072805bf Perl 5.0 alpha 2, the NULL sv code was copied to the new SV functions. The functions were bulk marked non-NULL in commit f54cb97a39 during 5.9.3 development. The docs were corrected to say NULLOK support in commit 53e8571218 during 5.11.0. See the perldelta part of this patch for the rest of commit body.
* fix multi-eval of Perl_custom_op_xop in XopENTRYDaniel Dragan2013-11-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 1830b3d9c8 introduced a flaw where XopENTRY calls Perl_custom_op_xop twice to retrieve the same XOP *. This is inefficient and causes extra machine code. Since I found no CPAN or upstream=blead usage of Perl_custom_op_xop, and its previous docs say it isn't 100% public, it is being converted to a macro. Most usage of Perl_custom_op_xop is to conditionally fetch a member of the XOP struct, which was previously implemented by XopENTRY. Move the XopENTRY logic and picking defaults to an expanded version of Perl_custom_op_xop. The union allows Perl_custom_op_get_field to return its result in 1 register, since the union is similar to a void * or IV, but with the machine code overhead of casting, if any, being done in the callee (Perl_custom_op_get_field), not the caller. Perl_custom_op_get_field can also return the XOP * without looking inside it to implement Perl_custom_op_xop. XopENTRYCUSTOM is a wrapper around Perl_custom_op_get_field with XopENTRY-like usage. XopENTRY is used by the OP_* macros, which are heavily used (but rarely called, since custom ops are rare) by Perl lang warnings system. The vararg warning arguments are usually evaluted no matter if the warning will be printed to STDERR or not. Since some people like to ignore warnings or run no strict; and warnings branches are frequent in pp_*, it is beneficial to make the OP_* macros smaller in machine code. The design of Perl_custom_op_get_field supports these goals. This commit does not pass judgement on Ben Morrow's unclear public or private API designation of Perl_custom_op_xop, and whether Perl_custom_op_xop should deprecated and removed from public API. It was trivial to leave a form of Perl_custom_op_xop in the new design. XOPe enums are identical to XOPf constants so no conversion has to be done between the field selector parameter and the field flag to test in machine code. ASSUME and NOT_REACHED are being introduced. The closest to the 2 previously was "assert(0)". Perl has not used ASSUME or CC specific versions of it before. Clang, GCC >= 4.5, and Visual C are supported. For completeness, ARMCC's __promise was added, but Perl is not known to have any support for ARMCC by this commiter. This patch is part of perl #115032.
* Move functions prematurely placed into mathoms back to utf8.cKarl Williamson2013-09-041-54/+0
| | | | | | | These functions are still called by some CPAN-upstream modules, so can't go into mathoms until those are fixed. There are other changes needed in these modules, so I'm deferring sending patching to their maintainers until I know all the necessary changes.
* utf8.c: Remove wrapper functions.Karl Williamson2013-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that the Unicode data is stored in native character set order, it is rare to need to work with the Unicode order. Traditionally, the real work was done in functions that worked with the Unicode order, and wrapper functions (or macros) were used to translate to/from native. There are two groups of functions: one that translates from code point to UTF-8, and the other group goes the opposite direction. This commit changes the base function that translates from UTF-8 to code point to output native instead of Unicode. Those extremely rare instances where Unicode output is needed instead will have to hand-wrap calls to this function with a translation macro, as now described in the API pod. Prior to this, it was the other way, the native was wrapped, and the rare, strict Unicode wasn't. This eliminates a layer of function call overhead for a common case. The base function that translates from code point to UTF-8 retains its Unicode input, as that is more natural to process. However, it is de-emphasized in the pod, with the functionality description moved to the pod for a native input wrapper function. And, those wrappers are now macros in all cases; previously there was function call overhead sometimes. (Equivalent exported functions are retained, however, for XS code that uses the Perl_foo() form.) I had hoped to rebase this commit, squashing it with an earlier commit in this series, eliminating the use of a temporary function name change, but the work involved turns out to be large, with no real payoff.
* utf8.c: Stop using two functionsKarl Williamson2013-08-291-1/+46
| | | | | | | | | | | | | | | | | This is in preparation for deprecating these functions, to force any code that has been using these functions to change. Since the Unicode tables are now stored in native order, these functions should only rarely be needed. However, the functionality of these is needed, and in actuality, on ASCII platforms, the native functions are #defined to these. So what this commit does is rename the functions to something else, and create wrappers with the old names, so that anyone using them will get the deprecation when it actually goes into effect: we are waiting for CPAN files distributed with the core to change before doing the deprecation. According to cpan.grep.me, this should affect fewer than 10 additional CPAN distributions.
* Deprecate NATIVE_TO_NEED and ASCII_TO_NEEDKarl Williamson2013-08-291-0/+15
| | | | | | | | | | | | | | | | | | These macros are no longer called in the Perl core. This commit turns them into functions so that they can use gcc's deprecation facility. I believe these were defective right from the beginning, and I have struggled to understand what's going on. From the name, it appears NATIVE_TO_NEED taks a native byte and turns it into UTF-8 if the appropriate parameter indicates that. But that is impossible to do correctly from that API, as for variant characters, it needs to return two bytes. It could only work correctly if ch is an I8 byte, which isn't native, and hence the name would be wrong. Similar arguments for ASCII_TO_NEED. The function S_append_utf8_from_native_byte(const U8 byte, U8** dest) does what I think NATIVE_TO_NEED intended.
* embed.fnc, mathoms.c: Add commentsKarl Williamson2012-11-281-0/+2
|