summaryrefslogtreecommitdiff
path: root/handy.h
Commit message (Collapse)AuthorAgeFilesLines
* perlapi: safemalloc doesn't take a pointerTomasz Konojacki2022-05-191-1/+1
|
* perlapi: document safe(?:c|re|m)allocTomasz Konojacki2022-05-171-0/+6
| | | | They're widely used on CPAN, especially safemalloc.
* perlapi: Consolidate sv_setpv entriesKarl Williamson2022-05-081-8/+0
| | | | | | Making these a single entry makes perlapi more concise with less repetition, and clarifies the similarities and distinctions between the variant forms.
* perlapi: Consolidate (Copy|Move|Zero)D?Karl Williamson2022-05-031-11/+9
| | | | | This commit consolidates the D form of each function in perlapi with the plain form.
* handy.h: space isn't graphKarl Williamson2022-04-191-1/+6
|
* Add ASSERT_IS_PTR macroKarl Williamson2022-03-031-0/+4
| | | | To make sure at compile time that its argument is a ptr
* Add 'ASSERT_IS_LITERAL' macroKarl Williamson2022-03-031-10/+12
| | | | | This is intended to make it obvious what this relatively obscure C construct is doing.
* Print a deprecation warning if downgrading to a use VERSION below v5.11Paul "LeoNerd" Evans2022-02-131-2/+2
|
* Simplify cBOOL defnKarl Williamson2022-02-061-6/+6
| | | | | | | | | | | | | | | This existed because there wasn't a compiler bool necessarily, and made complicated to workaround a bug in an AIX compiler as of 2010-ish. Now that C99 is required, there always is a bool type; we don't know if the bug existed in a C99 mode for the broken compiler, and sufficient time has passed that it should have been fixed nonetheless. This was tested on IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72) Version: 12.01.0000.0012 which dates to about 2012.
* Remove HAS_BOOLKarl Williamson2022-02-061-2/+0
| | | | | | This is no longer used in core. It occurs twice in metacpan, both to define it so as to fool core into thinking it is there; hence it isn't actually used at all in cpan.
* Remove PERL_BOOL_AS_CHAR uses; always define HAS_BOOLKarl Williamson2022-02-061-27/+2
| | | | | | | | | | Now that C99 is required, bool is always defined, so HAS_BOOL should also always be defined. PERL_BOOL_AS_CHAR was used to workaround problems when no bool type existed, so it is obsolete, and in fact perl won't compile if PERL_BOOL_AS_CHAR is #defined. So remove it completely from being looked at.
* Evaluate arg to FITS_IN_8_BITS just onceKarl Williamson2021-09-071-4/+4
| | | | | | | | | | | | | | | This had been changed by 9555181b32f9b30122a8ea4e779c2c9916cec9f8 to evaluating multiple times. (sizeof() also is called with the parameter, but that doesn't actually evaluate the parameter.) The previous version of this commit used a comparison with 0xFF, but gcc is smart enough to realise that `comparison is always true due to limited range of data type`, but not smart enough to realise that the sizeof makes that code unreachable. Hence with -Wtype-limits we get thousands of warnings. Using >> defeats the warnings.
* handy.h: Skip non-ptr assertion on old gcc'sKarl Williamson2021-08-251-4/+11
| | | | See https://github.com/Perl/perl5/issues/18655, which this fixes.
* Make paradigm into a macroKarl Williamson2021-08-251-7/+9
| | | | | | | | | | | | | | | | | | | | These macros use (x) | 0 to get a compiler error if x is a pointer rather than a value. This was instituted because there was confusion in them as to what they were called with. But the purpose of the paradigm wasn't obvious to even some experts; it was documented in every file in which it was used, but not at every occurrence. And, not every compiler can cope with them, it turns out. Making the paradigm into a macro, which this commit does, makes the uses self-documenting, albeit at the expense of cluttering up the macro definition somewhat; and allows the mechanism to be turned off if necessary for some compilers. Since it will be enabled for the majority of compilers, the potential bugs will be caught anyway.
* handy.h: Fix internal macroKarl Williamson2021-08-071-1/+1
| | | | | | | | | | I found this reading code. The macro is supposed to check for something not being in the ASCII range, but instead checked that the input is invariant under UTF-8. These concepts evaluate to the same thing on ASCII platforms, but differently on EBCDIC ones. The calls to this macro are such that there isn't a bug that surfaces here, but the code generated is slightly different, and it should be fixed to prevent any future issues.
* Remove EBCDIC-only codeKarl Williamson2021-08-071-4/+1
| | | | The previous commit stopped using this code, so can just get rid of it.
* handy.h: Refactor FITS_IN_8_BITS()Karl Williamson2021-07-301-3/+3
| | | | | By using a cast to U8, the '&' operation can be elminated, and the macro easier to read.
* perlapi: Consolidate and revise pod for toCASE_CHANGEfoo()Karl Williamson2021-07-171-111/+151
| | | | | | This finishes the work started by 3cb048e540f681a46e641b466030b55feaf5d337 for toLOWERfoo, using the same paradigm, for the rest of the case changing macros and functions.
* handy.h: Fix #ifdefKarl Williamson2021-02-281-1/+1
| | | | | | The prior code had a comment that indicated uncertainty about its correctness. I found a case where it didn't work, and am changing it accordingly. I have more confidence that this is right.
* handy.h: Add clarifying commentKarl Williamson2021-02-021-0/+1
|
* style: Detabify indentation of the C code maintained by the core.Michael G. Schwern2021-01-171-21/+21
| | | | | | | | | | | This just detabifies to get rid of the mixed tab/space indentation. Applying consistent indentation and dealing with other tabs are another issue. Done with `expand -i`. * vutil.* left alone, it's part of version. * Left regen managed files alone for now.
* perlapi: Document line_tKarl Williamson2020-12-271-1/+8
|
* Revert "Don't test for 16-bit inputs in inRANGE()"Karl Williamson2020-12-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This effectively reverts commit 4c2aa7c802893d0276551ade1b9d5dcd1226afc4. That commit removed checking for 16 bit inputs because an assert in a macro was making compilations fail in some compilers that couldn't handle the complexity. This inadvertently broke systems which use C language shorts in certain places, such Mingw and Win32 with their use of UTF16, not typically found on other platforms. At the time, we weren't smoking Mingw so we didn't know about it there, but the Win32 failures on Win32 were "fixed" by another commit which disabled assertions of this type completely. It turns out the issue was passing too long a string to assert(). Commits 92a0bb2 and 88086fd removed a bunch of unnecessary and/or duplicate asserts, bringing the size down, so that the 16 bit checks can be added back in without breaking these compilers. The reverted commit mentioned HP compilers as having problems. The only such box we currently have available for testing is HP-31, and the reversion works fine on it, even before 92a0bb2 and 88086fd. This fixes GH #18364
* inRANGE, withinCOUNT: Split so can avoid assertsKarl Williamson2020-12-061-8/+22
| | | | | | | | | | This commit splits these macros up into components that are separately callable. The components are considered internal core only, and the purpose is to avoid duplicate assert() calls that were causing some compilers to crash from not being able to handle the size. In particular, this commit refactors inRANGE so that the asserts are done only once, shortening what it expands to.
* handy.h: Fix typo in commentKarl Williamson2020-12-061-1/+1
|
* Fix and update documentation of memEQ, memNE, ...Karl Williamson2020-12-031-4/+6
| | | | This fixes GH #18379
* Restrict scope/Shorten some very long macro namesKarl Williamson2020-11-221-6/+11
| | | | | | The names were intended to force people to not use them outside their intended scopes. But by restricting those scopes in the first place, we don't need such unwieldy names
* Make API some C99 typedef work-aroundsKarl Williamson2020-11-181-8/+13
| | | | | I added these some releases ago, but kept them private. No untoward things have happened, so I'm now making them API.
* Fix defns of e.g. U8_MAX/MINKarl Williamson2020-11-101-36/+56
| | | | | | Actually trying to compile these with Devel::PPPort revealed that there were combinations of the conditionals which led to some of the symbols not getting defined.
* autodoc.pl: Enhance apidoc_section featureKarl Williamson2020-11-061-23/+23
| | | | | | | | | | | This feature allows documentation destined for perlapi or perlintern to be split into sections of related functions, no matter where the documentation source is. Prior to this commit the line had to contain the exact text of the title of the section. Now it can be a $variable name that autodoc.pl expands to the title. It still has to be an exact match for the variable in autodoc, but now, the expanded text can be changed in autodoc alone, without other files needing to be updated at the same time.
* perlapi: WIDEST_UTYPE is a typedefKarl Williamson2020-11-021-1/+1
|
* perlapi: StructCopy isn't conventionalKarl Williamson2020-11-021-1/+1
| | | | so suppress the usage line.
* Consolidate and revise pod for toLOWERfoo()Karl Williamson2020-10-171-42/+56
|
* Fix typosSamanta Navarro2020-10-031-2/+2
| | | | | | | | | For: https://github.com/Perl/perl5/pull/18201 Committer: Samanta Navarro is now a Perl author. To keep 'make test_porting' happy: Increment $VERSION in several files. Regenerate uconfig.h via './perl -Ilib regen/uconfig_h.pl'.
* perlapi: Fix function prototypesKarl Williamson2020-09-141-4/+4
| | | | These were wrong, and Devel::PPPort found the mistakes.
* perlapi: Fix typo.Karl Williamson2020-09-141-1/+1
|
* Fix input type on isFOO macrosKarl Williamson2020-09-141-114/+114
| | | | These macros accept any UV as input, but not a signed number
* gv_fetchpvn and gv_fetchpvn_flags are identicalKarl Williamson2020-09-141-2/+1
|
* Use macro instead of its expansionKarl Williamson2020-09-091-1/+1
| | | | | We already have a macro that expands to what this code does; it's clearer to use it.
* perlapi: Fix poor wording in MUTABLE_PTRKarl Williamson2020-09-071-2/+2
|
* perlapi: Display PERL_VERSION_xy betterKarl Williamson2020-09-051-10/+5
| | | | Now that we have the tools to show these as a whole list, do so
* Document MUTABLE_PTR, MUTABLE_AV, ...Karl Williamson2020-09-051-7/+23
|
* perlapi: Don't show a return type for __ASSERT_Karl Williamson2020-09-051-1/+1
|
* Change formal parameter name of gv_fetchpv*Karl Williamson2020-09-051-4/+5
| | | | This is a flags parameter, not a particular single flag
* perlapi: Improve display of isFOOKarl Williamson2020-09-051-254/+198
| | | | The character classification macro variants are now presented as a list
* perlapi: Display toFOO betterKarl Williamson2020-09-041-9/+9
| | | | | The character case change macro variants are now displayed all together
* Reorganize perlapiKarl Williamson2020-09-041-10/+40
| | | | | This uses a new organization of sections that I came up with. I asked for comments on p5p, but there were none.
* Change some =head1 to apidoc_section linesKarl Williamson2020-09-041-2/+2
| | | | | apidoc_section is slightly favored over head1, as it is known only to autodoc, and can't be confused with real pod.
* Fixup handy.h to use PERL_VERSION macro☢ ℕicolas ℝ2020-08-021-10/+10
| | | | | | | | | | | handy.h was recently updated in 4a1bbd3d but this is not using the accurate definitions of the new semantic versions introduced as part of #18020 They are: - PERL_VERSION_MAJOR - PERL_VERSION_MINOR - PERL_VERSION_PATCH
* More preparation for 7.0 in versioningKarl Williamson2020-08-021-15/+75
| | | | | | | | | | | | This modifies the macros introduced in 9b6e95106e18e4fd33678d0df9b2293fd4f8ab9c that allow one to determine how the version of the perl currently being compiled compares to an arbitrary one. The modification is based on changes in the plan, including renaming of variables. This also introduces the use of '*' for the subversion (or micro as it is now called) to make conversion from the soon-to-be deprecated PERL_VERSION macro more rote, with less thinking involved.