summaryrefslogtreecommitdiff
path: root/handy.h
Commit message (Collapse)AuthorAgeFilesLines
* perl.h - silence certain warnings on HPUX globally.Yves Orton2023-03-291-0/+1
| | | | | | | | | | | | | | | | | There are two warnings classes which account for a very large number of the warnings produced when building on HPUX Itanium. We know the cause of these warnings and we are ok with ignoring them. One set comes from our memory wrap checks, where we end up doing a comparison against constants in certain conditions. See the comments in handy.h line 2723 related to PERL_MALLOC_WRAP. The other set comes from our common "trick" of doing OO in C code with casting. This is the foundation of how we manage SV types and how we manage regular expression ops (regops). If this logic really was a problem then we would have lots of test failures and segfaults, and we do not, so we can silence them.
* handy.h - fixup for deprecated warnings and docsYves Orton2023-03-181-21/+37
|
* embed.fnc - document deprecate_xxx() macros and add them to handy.hYves Orton2023-03-181-9/+28
| | | | Also do not generate PERL_ARGS style macros for macros.
* warnings.pm - add deprecated::version_downgrade categoryYves Orton2023-03-181-4/+4
| | | | | This also fixes the version_downgrade to show the correct version that version downgrades will be removed in.
* warnings.pm - add deprecated::goto_construct categoryYves Orton2023-03-181-1/+1
| | | | | This category applies to attempts to goto the internals of a block construct.
* Delete dangling sv_catxmlpvs definitionDagfinn Ilmari Mannsåker2023-02-161-2/+0
| | | | | | This was part of MAD, which was removed in 2014 (commit b5bbe64ad2ec51417ef02ac52304ed45fe37be3f), but the wrapper macro was missed.
* handy.h - add NewCopy() macro to combine New and Copy.Yves Orton2023-01-121-0/+9
|
* handy.h - fix typo in commentYves Orton2022-12-301-1/+1
|
* handy.h - join a comment together into one lineYves Orton2022-12-301-2/+1
| | | | a later commit will resplit this again
* handy.h - remove unused macrosYves Orton2022-12-301-7/+0
| | | | | None of these are used anymore. See c62fdeb784c7643c90d2ea8c2ec0f03a548da338 for more details.
* handy.h: Manual correction of typos from GH 20435James E Keenan2022-12-291-2/+2
|
* regcomp.c - decompose into smaller filesYves Orton2022-12-091-1/+1
| | | | | | | | | | | | | | | | | This splits a bunch of the subcomponents of the regex engine into smaller files. regcomp_debug.c regcomp_internal.h regcomp_invlist.c regcomp_study.c regcomp_trie.c The only real change besides to the build machine to achieve the split is to also adds some new defines which can be used in embed.fnc to control exports without having to enumerate /every/ regex engine file. For instance all of regcomp*.c defines PERL_IN_REGCOMP_ANY, and this is used in embed.fnc to manage exports.
* handy.h: "base"' => "posix"Karl Williamson2022-12-071-62/+62
| | | | | | | | | | | These internal macros were originaly called "porcelain" due to my misperception of what that term means. Commit cbc5b6f1526f9eb657d61241e54b383c2d053b44 changed that to 'base'. But I realize now that the real purpose of these macros is to create an API that returns a POSIX-compliant result. Most platforms return such a value already, so the macros expand to just the platform's underlying value. But on platforms that aren't compliant, these add logic to make their results compliant. The better name then is 'posix'.
* Define some xV_FROM_REF() macrosPaul "LeoNerd" Evans2022-10-291-0/+28
| | | | | | These macros contain assert() calls to check that the `ref` SV really is a reference (SvROK) and that the SvTYPE it points to is that which is expected.
* handy.h: Set macro to false if can't ever be trueKarl Williamson2022-10-101-1/+7
| | | | | | | | | | | | It's unlikely that perl will be compiled with out the LC_CTYPE locale category being enabled. But if it isn't, there is no sense in having per-interpreter variables for various conditions in it, and no sense having code that tests those variables. This commit changes a macro to always yield 'false' when this is disabled, adds a new similar macro, and changes some occurrences that test for a variable to use the macros instead of the variables. That way the compiler knows these to conditions can never be true.
* cop.h - show function nameYves Orton2022-09-051-1/+4
| | | | | Also add SAFE_FUNCTION__ which ensures that the value is "UNKNOWN" on platforms that dont support __func__.
* Add a new env var PERL_RAND_SEEDYves Orton2022-08-121-9/+63
| | | | | | | | | | | | | | | | | | | | | This env var can be used to trigger a repeatable run of a script which calls C<srand()> with no arguments, either explicitly or implicitly via use of C<rand()> prior to calling srand(). This is implemented in such a way that calling C<srand()> with no arguments in forks or subthreads (again explicitly or implicitly) will receive their own seed but the seeds they receive will be repeatable. This is intended for debugging and perl development performance testing, and for running the test suite consistently. It is documented that the exact seeds used to initialize the random state are unspecified, and that they may change between releases or even builds. The only guarantee provided is that the same perl executable will produce the same results twice all other things being equal. In practice and in core testing we do expect consistency, but adding the tightest set of restrictions on our commitments seemed sensible. The env var is ignored when perl is run setuid or setgid similarly to the C<PERL_INTERNAL_RAND_SEED> env var.
* hv.c/handy.h - move logic from hv.c to handy.hYves Orton2022-08-121-0/+25
| | | | | | | | | | | | | | These mathematical/RNG functions are handy for various internal uses, so expose them in a way they can be reused. These are Marsaglia RNG "permutation" XORSHIFT triplets, from the famous article he wrote on fast random number generation. By modern standards they are only mediocre as far as RNGs go, but they still aren't bad. But they are very fast, and have a few useful properties which can be handy in places where we want a cheap source of pseudo random bits, or where we want to get a random(ish) sequence of positive integers. This will be used in a follow up patch.
* handy.h: 'porcelain" => "base"Karl Williamson2022-07-181-62/+62
| | | | | | | | | | | | | | | I intended to convery in the names of these macros that they exist to present a uniform api to the layers above, minimally processing the layer below to achieve that. So for example, is_porcelain_BLANK hides the fact that isblank() doesn't exist on all platforms, or is_porcelain_DIGIT matches the same set of 0..9 on all platforms, fixing the non-standard definition Windows has. I thought this is what git had meant when it used 'porcelain', but Tony Cook informed me that it actually means something else. So to avoid confusing people who might be aware of the real git meaning, this commit changes 'porcelain' to 'base', which, while not entirely satisfactory, is the best short name I have been able to think of.
* Add LINE_Tf format for line_t variablesKarl Williamson2022-07-181-0/+1
| | | | This is so you can print them without having to know their length.
* Fix breakage in e91f88ad549Karl Williamson2022-07-021-1/+0
| | | | Two files were included in that commit that shouldn't have been
* mktables: Don't generate pod for Name.pmKarl Williamson2022-07-021-0/+1
| | | | | | | This is a relic from long ago. mktables creates lib/unicore/Name.pm. And in that file which is for internal core use only, it was creating the beginnings of some pod, but quite incomplete; this was confusing buildtoc, which perhaps could be hardened against such inputs.
* handy.h: Comment MUTABLE_PTRKarl Williamson2022-06-221-1/+3
| | | | Tony Cook and Leon Timmermans explained this to me.
* Follow on to 6d21409fd4b749511b9ec73e2dbaaff513f6eae8Karl Williamson2022-06-181-101/+102
| | | | | This was meant to be a part of the previous commit, but somehow got omitted.
* perlapi: Split two groups of entriesKarl Williamson2022-06-181-17/+24
| | | | | The sorting order of perlapi is supposed to be dictionary order. These synonyms were grouped with other names in a non-ordered way.
* handy.h: White space onlyKarl Williamson2022-06-161-3/+3
| | | | These shouldn't be indented
* allow building with -DPERL_MEM_LOG on Win32Tony Cook2022-06-161-4/+0
| | | | | | | | This appears to have been broken for a while, and became more broken with 75acd14e, which made newSV_type() inline. This will also prevent warnings about calls to undeclared functions on systems that don't need symbols to be exported.
* handy.h: Add layer for char classification/case changeKarl Williamson2022-06-121-40/+100
| | | | | This layer currently expands to just the layer below it, but that will be changed in a future commit.
* handy.h: Add isCASED_LCKarl Williamson2022-06-121-0/+5
| | | | As a convenience to other code.
* handy.h: Add wrapper layer macros for isalnum() etcKarl Williamson2022-06-121-58/+76
| | | | | | | | | | | | | | | | | | This adds a new set of macros, forming a lower layer to what is currently there, to wrap the character classification libc functions, isdigit() etc, and case changing ones, tolower(), toupper(). On most platforms these expand simply to the libc function call. But on Windows, they expand to something more complex, to bring the Windows calls into POSIX compliance. Similarly, but not as extensive, IBM products have some non-compliant behavior, and one macro is made more comples to fix that. Previously compliance was achieved at a higher level, with the result that lower level calls were broken. This resulted in parts of the test suite being skipped on Windows and IBM, which remain for now. The current level is rewritten to use the new lower layer, with the result that it is simpler, as the complexity is now done further down.
* handy.h: Collapse some macrosKarl Williamson2022-06-121-11/+6
| | | | These 3 sets of macros can be collapsed trivially into 3 macros.
* handy.h: Move some macro defns aroundKarl Williamson2022-06-121-45/+45
| | | | | | | This is to make the difference listing in future commits smaller. This change includes some comment changes, and some extra parens around some subexpressions
* handy.h: Collapse two sets of macrosKarl Williamson2022-06-121-29/+15
| | | | | | By redefining a wrapper macro used in one set based on compile-time info; the other set can be defined in terms of it, and the separate entries removed.
* No locales => don't use isspace(), toLower() etc.Karl Williamson2022-06-121-16/+16
| | | | | | | | | This commit changes what happens on platforms without locale handling to use our precomputed definitions of what the various character class definitions and case changing operations are. Previously, it just called the libc locale-dependent functions and made sure the result was ASCII. I think this is a holdover from before we had the precomputed definitions
* handy.h: #define one macro in terms of anotherKarl Williamson2022-06-121-1/+1
| | | | | | These two macros are equivalent as folding and lowercasing are the same for this input domain. Better to say so rather than to replicate the definitions.
* handy.h: Rmv unnecessary parameter to internal macrosKarl Williamson2022-06-121-9/+9
| | | | | The cast is required to be U8 by the POSIX standard. There is no need to have this added generality.
* handy.h: Refactor some internal macrosKarl Williamson2022-06-121-15/+12
| | | | This changes the parameters etc, in preparation for further changes
* handy.h: Rmv internal macroKarl Williamson2022-06-121-5/+2
| | | | | | LC_CAST_ was my attempt at generality, but I didn't realize that the POSIX standard specifies the type that this was meant to generalize, so there isn't any need for it.
* Change handy.h macro names to be C standard conformantKarl Williamson2022-06-121-160/+159
| | | | | | | C reserves symbols beginning with underscores for its own use. This commit moves the underscore so it is trailing, which is legal. The symbols changed here are many of the ones in handy.h that have significant uses outside it.
* handy.h: Don't use char class if no LC_CTYPEKarl Williamson2022-06-121-1/+1
| | | | | | It is possible to compile perl to not pay attention to LC_CTYPE. This was testing for no locales at all; whereas the stricter requirement should be used.
* handy.h: White-space, comment onlyKarl Williamson2022-06-121-82/+92
|
* handy.h: Add some branch predictionsKarl Williamson2022-06-121-6/+6
|
* handy.h: Refactor some #ifdef's for commonalityKarl Williamson2022-06-121-34/+30
| | | | | | | | | This changes these compilation conditionals so that things in common between Windows and other platforms are only defined once. It changes the isIDFIRST_LC and isWORDCHAR_LC definitions for non-Windows to match that platform superficially, though expanding to what it previously did to.
* handy.h: Remove the only 2 calls to internal macroKarl Williamson2022-06-121-9/+2
| | | | | Replace isIDFIRST_LC and isWORD_CHAR_LC isIDFIRST_LC with slightly faster implementations.
* Change handy.h macro names to be C standard conformantKarl Williamson2022-06-121-176/+176
| | | | | | | C reserves symbols beginning with underscores for its own use. This commit moves the underscore so it is trailing, which is legal. The symbols changed here are most of the ones in handy.h that have few uses outside it.
* handy.h: WIDEST_UTYPE is just PERL_UINTMAX_TKarl Williamson2022-06-081-5/+1
| | | | No need to re-derive it
* Make STRLENs() available to coreKarl Williamson2022-05-311-0/+6
| | | | | This may cause problems when not used correctly; so continue to restrict it.
* handy.h: ASSERT_NOT_PTR doesn't work for void*Karl Williamson2022-05-311-1/+4
| | | | Add comment to that
* perlapi: Consolidate hv_store(s?), into 1 entry,improveKarl Williamson2022-05-301-6/+0
| | | | | The text has been expanded to discuss what happens if the any of the pointer parameters are NULL.
* handy.h: White-space onlyKarl Williamson2022-05-291-7/+7
| | | | Indent preprocessor directives to clarify that they are in #ifdef