The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

The program is responsible for maintaining the correct value for depth.

Example usage:

 EXTERN_C int flock(int fd, int op);

Example usage:

     Signal_t
     Perl_perly_sighandler(int sig, Siginfo_t *sip PERL_UNUSED_DECL,
                           void *uap PERL_UNUSED_DECL, bool safe)

This macro indicates to discard the return value of the function call inside it, e.g.,

 PERL_UNUSED_RESULT(foo(a, b))

The main reason for this is that the combination of gcc -Wunused-result (part of -Wall) and the __attribute__((warn_unused_result)) cannot be silenced with casting to void. This causes trouble when the system header files use the attribute.

Use PERL_UNUSED_RESULT sparingly, though, since usually the warning is there for a good reason: you might lose success/failure information, or leak resources, or changes in resources.

But sometimes you just want to ignore the return value, e.g., on codepaths soon ending up in abort, or in "best effort" attempts, or in situations where there is no good way to handle failures.

Sometimes PERL_UNUSED_RESULT might not be the most natural way: another possibility is that you can capture the return value and use "PERL_UNUSED_VAR" on that.

This allows a series of statements in a macro to be used as a single statement, as in

 if (x) STMT_START { ... } STMT_END else ...

Note that you can't return a value out of them, which limits their utility. But see "PERL_USE_GCC_BRACE_GROUPS".

This C pre-processor value, if defined, indicates that it is permissible to use the GCC brace groups extension. This extension, of the form

 ({ statement ... })

turns the block consisting of statements ... into an expression with a value, unlike plain C language blocks. This can present optimization possibilities, BUT you generally need to specify an alternative in case this ability doesn't exist or has otherwise been forbidden.

Example usage:

     #ifdef PERL_USE_GCC_BRACE_GROUPS
       ...
     #else
       ...
     #endif

If we aren't in taint checking mode, do nothing; otherwise indicate to "TAINT_set" and "TAINT_PROPER" that some unspecified element is tainted.

Remove any taintedness previously set by, e.g., TAINT.

If c evaluates to true, call "TAINT" to indicate that something is tainted; otherwise do nothing.

Looks at several components of %ENV for taintedness, and calls "taint_proper" if any are tainted. The components it searches are things like $PATH.

If no element is tainted, do nothing; otherwise output a message (containing s) that indicates there is a tainting violation. If such violations are fatal, it croaks.

If s is true, "TAINT_get" returns true; If s is false, "TAINT_get" returns false;

Returns a boolean as to whether some element is tainted or not.

Returns a boolean as to whether taint checking is enabled or not.

Turn taint checking mode off/on

Returns false if tainting violations are fatal; Returns true if they're just warnings

s being true indicates "TAINT_WARN_get" should return that tainting violations are just warnings

s being false indicates "TAINT_WARN_get" should return that tainting violations are fatal.

Returns a token the C compiler recognizes for the constant number of the corresponding integer type on the machine.

If the machine does not have a 64-bit type, INT64_C is undefined. Use "INTMAX_C" to get the largest type available on the platform.

Returns a token the C compiler recognizes for the constant number of the corresponding unsigned integer type on the machine.

If the machine does not have a 64-bit type, UINT64_C is undefined. Use "UINTMAX_C" to get the largest type available on the platform.

 -1LL

See also, for example, "INT32_C".

Use "IV" to declare variables of the maximum usable size on this platform.

 1UL

See also, for example, "UINT32_C".

Use "UV" to declare variables of the maximum usable size on this platform.

Set errno, and on VMS set vaxc$errno.

Declare variables needed to save errno and any operating system specific error number.

Declare variables needed to save errno and any operating system specific error number, and save them for optional later restoration by RESTORE_ERRNO.

Save errno and any operating system specific error number for optional later restoration by RESTORE_ERRNO. Requires dSAVEDERRNO or dSAVE_ERRNO in scope.

Restore errno and any operating system specific error number that was saved by dSAVE_ERRNO or RESTORE_ERRNO.

Returns the SV for $@, creating it if needed.

Clear the contents of $@, setting it to the empty string.

This replaces any read-only SV with a fresh SV and removes any magic.

Clean up ERRSV so we can safely set it.

This replaces any read-only SV with a fresh writable copy and removes any magic.

Do NOT use this due to the possibility of overflowing buffer. Instead use my_snprintf()

These perform the corresponding mathematical operation on the operand(s), using the libc function designed for the task that has just enough precision for an NV on this platform. If no such function with sufficient precision exists, the highest precision one available is used.

These give the largest and smallest number representable in the current platform in variables of the corresponding types.

For signed types, the smallest representable number is the most negative number, the one furthest away from zero.

For C99 and later compilers, these correspond to things like INT_MAX, which are available to the C code. But these constants, furnished by Perl, allow code compiled on earlier compilers to portably have access to the same constants.

These provide system-specific tune up of the C runtime environment necessary to run Perl interpreters. Only one should be used, and it should be called only once, before creating any Perl interpreters.

They differ in that PERL_SYS_INIT3 also initializes env.

This defines a way to flush all output buffers. This may be a performance issue, so we allow people to disable it. Also, if we are using stdio, there are broken implementations of fflush(NULL) out there, Solaris being the most prominent.

Obsolete form of UVuf, which you should convert to instead use

Returns the input unchanged, but at the same time it gives a branch prediction hint to the compiler that this condition is likely to be true.

Returns the input unchanged, but at the same time it gives a branch prediction hint to the compiler that this condition is likely to be false.

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, PL_hexdigit[11] is 'b', and PL_hexdigit[11+16] is '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.

Returns the given phase's name as a NUL-terminated string.

For example, to print a stack trace that includes the current interpreter phase you might do:

    const char* phase_name = phase_name(PL_phase);
    mess("This is weird. (Perl phase: %s)", phase_name);

Evaluates to TRUE if the plain locale pragma without a parameter (use locale) is in effect.

Evaluates to TRUE if, when compiling a perl program (including an eval) if the plain locale pragma without a parameter (use locale) is in effect.

Evaluates to TRUE if, when executing a perl program (including an eval) if the plain locale pragma without a parameter (use locale) is in effect.

This macro should be used as a statement. It declares a private variable (whose name begins with an underscore) that is needed by the other macros in this section. Failing to include this correctly should lead to a syntax error. For compatibility with C89 C compilers it should be placed in a block before any executable statements.

This is used by XS code that is LC_NUMERIC locale-aware to force the locale for category LC_NUMERIC to be what perl thinks is the current underlying locale. (The perl interpreter could be wrong about what the underlying locale actually is if some C or XS code has called the C library function setlocale(3) behind its back; calling "sync_locale" before calling this macro will update perl's records.)

A call to "DECLARATION_FOR_LC_NUMERIC_MANIPULATION" must have been made to declare at compile time a private variable used by this macro. This macro should be called as a single statement, not an expression, but with an empty argument list, like this:

 {
    DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
     ...
    STORE_LC_NUMERIC_FORCE_TO_UNDERLYING();
     ...
    RESTORE_LC_NUMERIC();
     ...
 }

The private variable is used to save the current locale state, so that the requisite matching call to "RESTORE_LC_NUMERIC" can restore it.

On threaded perls not operating with thread-safe functionality, this macro uses a mutex to force a critical section. Therefore the matching RESTORE should be close by, and guaranteed to be called.

This is used to help wrap XS or C code that is LC_NUMERIC locale-aware. This locale category is generally kept set to a locale where the decimal radix character is a dot, and the separator between groups of digits is empty. This is because most XS code that reads floating point numbers is expecting them to have this syntax.

This macro makes sure the current LC_NUMERIC state is set properly, to be aware of locale if the call to the XS or C code from the Perl program is from within the scope of a use locale; or to ignore locale if the call is instead from outside such scope.

This macro is the start of wrapping the C or XS code; the wrap ending is done by calling the "RESTORE_LC_NUMERIC" macro after the operation. Otherwise the state can be changed that will adversely affect other XS code.

A call to "DECLARATION_FOR_LC_NUMERIC_MANIPULATION" must have been made to declare at compile time a private variable used by this macro. This macro should be called as a single statement, not an expression, but with an empty argument list, like this:

 {
    DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
     ...
    STORE_LC_NUMERIC_SET_TO_NEEDED();
     ...
    RESTORE_LC_NUMERIC();
     ...
 }

On threaded perls not operating with thread-safe functionality, this macro uses a mutex to force a critical section. Therefore the matching RESTORE should be close by, and guaranteed to be called; see "WITH_LC_NUMERIC_SET_TO_NEEDED" for a more contained way to ensure that.

Same as "STORE_LC_NUMERIC_SET_TO_NEEDED" with in_lc_numeric provided as the precalculated value of IN_LC(LC_NUMERIC). It is the caller's responsibility to ensure that the status of PL_compiling and PL_hints cannot have changed since the precalculation.

This is used in conjunction with one of the macros "STORE_LC_NUMERIC_SET_TO_NEEDED" and "STORE_LC_NUMERIC_FORCE_TO_UNDERLYING" to properly restore the LC_NUMERIC state.

A call to "DECLARATION_FOR_LC_NUMERIC_MANIPULATION" must have been made to declare at compile time a private variable used by this macro and the two STORE ones. This macro should be called as a single statement, not an expression, but with an empty argument list, like this:

 {
    DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
     ...
    RESTORE_LC_NUMERIC();
     ...
 }

This macro invokes the supplied statement or block within the context of a "STORE_LC_NUMERIC_SET_TO_NEEDED" .. "RESTORE_LC_NUMERIC" pair if required, so eg:

  WITH_LC_NUMERIC_SET_TO_NEEDED(
    SNPRINTF_G(fv, ebuf, sizeof(ebuf), precis)
  );

is equivalent to:

  {
#ifdef USE_LOCALE_NUMERIC
    DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
    STORE_LC_NUMERIC_SET_TO_NEEDED();
#endif
    SNPRINTF_G(fv, ebuf, sizeof(ebuf), precis);
#ifdef USE_LOCALE_NUMERIC
    RESTORE_LC_NUMERIC();
#endif
  }

Same as "WITH_LC_NUMERIC_SET_TO_NEEDED" with in_lc_numeric provided as the precalculated value of IN_LC(LC_NUMERIC). It is the caller's responsibility to ensure that the status of PL_compiling and PL_hints cannot have changed since the precalculation.

This is a synonym for "my_strtod".

Platform and configuration independent strtol. This expands to the appropriate strotol-like function based on the platform and Configure options>. For example it could expand to strtoll or strtoq instead of strtol.

Platform and configuration independent strtoul. This expands to the appropriate strotoul-like function based on the platform and Configure options>. For example it could expand to strtoull or strtouq instead of strtoul.

A synonym for "grok_numeric_radix"

Typeless abs or fabs, etc. (The usage below indicates it is for integers, but it works for any type.) Use instead of these, since the C library ones force their argument to be what it is expecting, potentially leading to disaster. But also beware that this evaluates its argument twice, so no x++.

Same as "is_safe_syscall".