X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/3145e81474d3ad96e89a613fdaa83d082b5a3eda..097ac3f8d72c31cfde2f68c417ec54ada7e055fc:/perl.h diff --git a/perl.h b/perl.h index 7c3066d..327e1b5 100644 --- a/perl.h +++ b/perl.h @@ -180,6 +180,14 @@ Otherwise ends a section of code already begun by a C>. * implementation of multiplicity using C++ objects. They have been left * here solely for the sake of XS code which has incorrectly * cargo-culted them. + * + * The only one Devel::PPPort handles is this; list it as deprecated + +=for apidoc_section Concurrency +=for apidoc AmD|void|CPERLscope|void x +Now a no-op. + +=cut */ #define CPERLscope(x) x #define CPERLarg void @@ -397,7 +405,25 @@ Otherwise ends a section of code already begun by a C>. * marking unused variables (they need e.g. a #pragma) and therefore * cpp macros like PERL_UNUSED_DECL cannot work for this purpose, even * if it were PERL_UNUSED_DECL(x), which it cannot be (see above). - * + +=for apidoc_section Compiler directives +=for apidoc AmnU||PERL_UNUSED_DECL +Tells the compiler that the parameter in the function prototype just before it +is not necessarily expected to be used in the function. Not that many +compilers understand this, so this should only be used in cases where +C> can't conveniently be used. + +Example usage: + +=over + + Signal_t + Perl_perly_sighandler(int sig, Siginfo_t *sip PERL_UNUSED_DECL, + void *uap PERL_UNUSED_DECL, bool safe) + +=back + +=cut */ #ifndef PERL_UNUSED_DECL @@ -409,18 +435,18 @@ Otherwise ends a section of code already begun by a C>. * but we cannot quite get rid of, such as "ax" in PPCODE+noargs xsubs, * or variables/arguments that are used only in certain configurations. -=for apidoc Am||PERL_UNUSED_ARG|void x +=for apidoc Ams||PERL_UNUSED_ARG|void x This is used to suppress compiler warnings that a parameter to a function is not used. This situation can arise, for example, when a parameter is needed under some configuration conditions, but not others, so that C preprocessor conditional compilation causes it be used just some times. -=for apidoc Amn||PERL_UNUSED_CONTEXT +=for apidoc Amns||PERL_UNUSED_CONTEXT This is used to suppress compiler warnings that the thread context parameter to a function is not used. This situation can arise, for example, when a C preprocessor conditional compilation causes it be used just some times. -=for apidoc Am||PERL_UNUSED_VAR|void x +=for apidoc Ams||PERL_UNUSED_VAR|void x This is used to suppress compiler warnings that the variable I is not used. This situation can arise, for example, when a C preprocessor conditional compilation causes it be used just some times. @@ -1018,9 +1044,31 @@ EXTERN_C int syscall(int, ...); EXTERN_C int usleep(unsigned int); #endif -/* macros for correct constant construction. These are in C99 +/* Macros for correct constant construction. These are in C99 * (so they will not be available in strict C89 mode), but they are nice, so - * let's define them if necessary. */ + * let's define them if necessary. +=for apidoc_section Integer configuration values +=for apidoc Am|I16|INT16_C|number +=for apidoc_item |I32|INT32_C|number +=for apidoc_item |I64|INT64_C|number + +Returns a token the C compiler recognizes for the constant C of the +corresponding integer type on the machine. + +If the machine does not have a 64-bit type, C is undefined. + +=for apidoc Am|U16|UINT16_C|number +=for apidoc_item |U32|UINT32_C|number +=for apidoc_item |U64|UINT64_C|number + +Returns a token the C compiler recognizes for the constant C of the +corresponding unsigned integer type on the machine. + +If the machine does not have a 64-bit type, C is undefined. + + +=cut +*/ #ifndef UINT16_C # if INTSIZE >= 2 # define UINT16_C(x) ((U16_TYPE)x##U) @@ -3832,7 +3880,7 @@ typedef I32 (*filter_t) (pTHX_ int, SV *, int); && idx >= AvFILLp(PL_parser->rsfp_filters)) #define PERL_FILTER_EXISTS(i) \ (PL_parser && PL_parser->rsfp_filters \ - && (i) < av_count(PL_parser->rsfp_filters)) + && (Size_t) (i) < av_count(PL_parser->rsfp_filters)) #if defined(_AIX) && !defined(_AIX43) #if defined(USE_REENTRANT) || defined(_REENTRANT) || defined(_THREAD_SAFE) @@ -3946,7 +3994,8 @@ typedef struct crypt_data { /* straight from /usr/include/crypt.h */ typedef struct magic_state MGS; /* struct magic_state defined in mg.c */ -#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) +#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) \ + || defined(PERL_EXT_RE_BUILD) /* These have to be predeclared, as they are used in proto.h which is #included * before their definitions in regcomp.h. */ @@ -4093,6 +4142,21 @@ my_swap16(const U16 x) { /* This may look like unnecessary jumping through hoops, but converting out of range floating point values to integers *is* undefined behaviour, and it is starting to bite. + +=for apidoc_section Casting +=for apidoc Am|I32|I_32|NV what +Cast an NV to I32 while avoiding undefined C behavior + +=for apidoc Am|U32|U_32|NV what +Cast an NV to U32 while avoiding undefined C behavior + +=for apidoc Am|IV|I_V|NV what +Cast an NV to IV while avoiding undefined C behavior + +=for apidoc Am|UV|U_V|NV what +Cast an NV to UV while avoiding undefined C behavior + +=cut */ #ifndef CAST_INLINE #define I_32(what) (cast_i32((NV)(what))) @@ -4732,6 +4796,22 @@ EXTCONST char PL_No[] INIT(""); EXTCONST char PL_Zero[] INIT("0"); + +/* +=for apidoc_section Numeric Functions +=for apidoc AmTuU|const char *|PL_hexdigit|U8 value + +This array, indexed by an integer, converts that value into the character that +represents it. For example, if the input is 8, the return will be a string +whose first character is '8'. What is actually returned is a pointer into a +string. All you are interested in is the first character of that string. To +get uppercase letters (for the values 10..15), add 16 to the index. Hence, +C is C<'b'>, and C is C<'B'>. Adding 16 +to an index whose representation is '0'..'9' yields the same as not adding 16. +Indices outside the range 0..31 result in (bad) undedefined behavior. + +=cut +*/ EXTCONST char PL_hexdigit[] INIT("0123456789abcdef0123456789ABCDEF"); @@ -5282,6 +5362,16 @@ typedef enum { #define HINT_SORT_STABLE 0x00000100 /* sort styles */ #define HINT_SORT_UNSTABLE 0x00000200 +#define HINT_ALL_STRICT HINT_STRICT_REFS \ + | HINT_STRICT_SUBS \ + | HINT_STRICT_VARS + +#ifdef USE_STRICT_BY_DEFAULT +#define HINTS_DEFAULT HINT_ALL_STRICT +#else +#define HINTS_DEFAULT 0 +#endif + /* flags for PL_sawampersand */ #define SAWAMPERSAND_LEFT 1 /* saw $` */