Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/smanonr..../lib64/perl5/CORE
File: perl.h
/* perl.h
[0] Fix | Delete
*
[1] Fix | Delete
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
[2] Fix | Delete
* 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by Larry Wall and others
[3] Fix | Delete
*
[4] Fix | Delete
* You may distribute under the terms of either the GNU General Public
[5] Fix | Delete
* License or the Artistic License, as specified in the README file.
[6] Fix | Delete
*
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
#ifndef H_PERL
[10] Fix | Delete
#define H_PERL 1
[11] Fix | Delete
[12] Fix | Delete
#ifdef PERL_FOR_X2P
[13] Fix | Delete
/*
[14] Fix | Delete
* This file is being used for x2p stuff.
[15] Fix | Delete
* Above symbol is defined via -D in 'x2p/Makefile.SH'
[16] Fix | Delete
* Decouple x2p stuff from some of perls more extreme eccentricities.
[17] Fix | Delete
*/
[18] Fix | Delete
#undef MULTIPLICITY
[19] Fix | Delete
#undef USE_STDIO
[20] Fix | Delete
#define USE_STDIO
[21] Fix | Delete
#endif /* PERL_FOR_X2P */
[22] Fix | Delete
[23] Fix | Delete
#ifdef PERL_MICRO
[24] Fix | Delete
# include "uconfig.h"
[25] Fix | Delete
#else
[26] Fix | Delete
# include "config.h"
[27] Fix | Delete
#endif
[28] Fix | Delete
[29] Fix | Delete
/* this is used for functions which take a depth trailing
[30] Fix | Delete
* argument under debugging */
[31] Fix | Delete
#ifdef DEBUGGING
[32] Fix | Delete
#define _pDEPTH ,U32 depth
[33] Fix | Delete
#define _aDEPTH ,depth
[34] Fix | Delete
#else
[35] Fix | Delete
#define _pDEPTH
[36] Fix | Delete
#define _aDEPTH
[37] Fix | Delete
#endif
[38] Fix | Delete
[39] Fix | Delete
/* NOTE 1: that with gcc -std=c89 the __STDC_VERSION__ is *not* defined
[40] Fix | Delete
* because the __STDC_VERSION__ became a thing only with C90. Therefore,
[41] Fix | Delete
* with gcc, HAS_C99 will never become true as long as we use -std=c89.
[42] Fix | Delete
[43] Fix | Delete
* NOTE 2: headers lie. Do not expect that if HAS_C99 gets to be true,
[44] Fix | Delete
* all the C99 features are there and are correct. */
[45] Fix | Delete
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
[46] Fix | Delete
defined(_STDC_C99) || defined(__c99)
[47] Fix | Delete
# define HAS_C99 1
[48] Fix | Delete
#endif
[49] Fix | Delete
[50] Fix | Delete
/* See L<perlguts/"The Perl API"> for detailed notes on
[51] Fix | Delete
* PERL_IMPLICIT_CONTEXT and PERL_IMPLICIT_SYS */
[52] Fix | Delete
[53] Fix | Delete
/* Note that from here --> to <-- the same logic is
[54] Fix | Delete
* repeated in makedef.pl, so be certain to update
[55] Fix | Delete
* both places when editing. */
[56] Fix | Delete
[57] Fix | Delete
#ifdef USE_ITHREADS
[58] Fix | Delete
# if !defined(MULTIPLICITY)
[59] Fix | Delete
# define MULTIPLICITY
[60] Fix | Delete
# endif
[61] Fix | Delete
#endif
[62] Fix | Delete
[63] Fix | Delete
#ifdef PERL_GLOBAL_STRUCT_PRIVATE
[64] Fix | Delete
# ifndef PERL_GLOBAL_STRUCT
[65] Fix | Delete
# define PERL_GLOBAL_STRUCT
[66] Fix | Delete
# endif
[67] Fix | Delete
#endif
[68] Fix | Delete
[69] Fix | Delete
#ifdef PERL_GLOBAL_STRUCT
[70] Fix | Delete
# ifndef MULTIPLICITY
[71] Fix | Delete
# define MULTIPLICITY
[72] Fix | Delete
# endif
[73] Fix | Delete
#endif
[74] Fix | Delete
[75] Fix | Delete
#ifdef MULTIPLICITY
[76] Fix | Delete
# ifndef PERL_IMPLICIT_CONTEXT
[77] Fix | Delete
# define PERL_IMPLICIT_CONTEXT
[78] Fix | Delete
# endif
[79] Fix | Delete
#endif
[80] Fix | Delete
[81] Fix | Delete
/* undef WIN32 when building on Cygwin (for libwin32) - gph */
[82] Fix | Delete
#ifdef __CYGWIN__
[83] Fix | Delete
# undef WIN32
[84] Fix | Delete
# undef _WIN32
[85] Fix | Delete
#endif
[86] Fix | Delete
[87] Fix | Delete
#if defined(__SYMBIAN32__) || (defined(__VC32__) && defined(WINS))
[88] Fix | Delete
# ifndef SYMBIAN
[89] Fix | Delete
# define SYMBIAN
[90] Fix | Delete
# endif
[91] Fix | Delete
#endif
[92] Fix | Delete
[93] Fix | Delete
#ifdef __SYMBIAN32__
[94] Fix | Delete
# include "symbian/symbian_proto.h"
[95] Fix | Delete
#endif
[96] Fix | Delete
[97] Fix | Delete
/* Any stack-challenged places. The limit varies (and often
[98] Fix | Delete
* is configurable), but using more than a kilobyte of stack
[99] Fix | Delete
* is usually dubious in these systems. */
[100] Fix | Delete
#if defined(__SYMBIAN32__)
[101] Fix | Delete
/* Symbian: need to work around the SDK features. *
[102] Fix | Delete
* On WINS: MS VC5 generates calls to _chkstk, *
[103] Fix | Delete
* if a "large" stack frame is allocated. *
[104] Fix | Delete
* gcc on MARM does not generate calls like these. */
[105] Fix | Delete
# define USE_HEAP_INSTEAD_OF_STACK
[106] Fix | Delete
#endif
[107] Fix | Delete
[108] Fix | Delete
/* Use the reentrant APIs like localtime_r and getpwent_r */
[109] Fix | Delete
/* Win32 has naturally threadsafe libraries, no need to use any _r variants. */
[110] Fix | Delete
#if defined(USE_ITHREADS) && !defined(USE_REENTRANT_API) && !defined(NETWARE) && !defined(WIN32) && !defined(PERL_DARWIN)
[111] Fix | Delete
# define USE_REENTRANT_API
[112] Fix | Delete
#endif
[113] Fix | Delete
[114] Fix | Delete
/* <--- here ends the logic shared by perl.h and makedef.pl */
[115] Fix | Delete
[116] Fix | Delete
/* Microsoft Visual C++ 6.0 needs special treatment in numerous places */
[117] Fix | Delete
#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1300
[118] Fix | Delete
# define USING_MSVC6
[119] Fix | Delete
#endif
[120] Fix | Delete
[121] Fix | Delete
#undef START_EXTERN_C
[122] Fix | Delete
#undef END_EXTERN_C
[123] Fix | Delete
#undef EXTERN_C
[124] Fix | Delete
#ifdef __cplusplus
[125] Fix | Delete
# define START_EXTERN_C extern "C" {
[126] Fix | Delete
# define END_EXTERN_C }
[127] Fix | Delete
# define EXTERN_C extern "C"
[128] Fix | Delete
#else
[129] Fix | Delete
# define START_EXTERN_C
[130] Fix | Delete
# define END_EXTERN_C
[131] Fix | Delete
# define EXTERN_C extern
[132] Fix | Delete
#endif
[133] Fix | Delete
[134] Fix | Delete
/* Fallback definitions in case we don't have definitions from config.h.
[135] Fix | Delete
This should only matter for systems that don't use Configure and
[136] Fix | Delete
haven't been modified to define PERL_STATIC_INLINE yet.
[137] Fix | Delete
*/
[138] Fix | Delete
#if !defined(PERL_STATIC_INLINE)
[139] Fix | Delete
# ifdef HAS_STATIC_INLINE
[140] Fix | Delete
# define PERL_STATIC_INLINE static inline
[141] Fix | Delete
# else
[142] Fix | Delete
# define PERL_STATIC_INLINE static
[143] Fix | Delete
# endif
[144] Fix | Delete
#endif
[145] Fix | Delete
[146] Fix | Delete
#ifdef PERL_GLOBAL_STRUCT
[147] Fix | Delete
# ifndef PERL_GET_VARS
[148] Fix | Delete
# ifdef PERL_GLOBAL_STRUCT_PRIVATE
[149] Fix | Delete
EXTERN_C struct perl_vars* Perl_GetVarsPrivate();
[150] Fix | Delete
# define PERL_GET_VARS() Perl_GetVarsPrivate() /* see miniperlmain.c */
[151] Fix | Delete
# else
[152] Fix | Delete
# define PERL_GET_VARS() PL_VarsPtr
[153] Fix | Delete
# endif
[154] Fix | Delete
# endif
[155] Fix | Delete
#endif
[156] Fix | Delete
[157] Fix | Delete
/* this used to be off by default, now its on, see perlio.h */
[158] Fix | Delete
#define PERLIO_FUNCS_CONST
[159] Fix | Delete
[160] Fix | Delete
#define pVAR struct perl_vars* my_vars PERL_UNUSED_DECL
[161] Fix | Delete
[162] Fix | Delete
#ifdef PERL_GLOBAL_STRUCT
[163] Fix | Delete
# define dVAR pVAR = (struct perl_vars*)PERL_GET_VARS()
[164] Fix | Delete
#else
[165] Fix | Delete
# define dVAR dNOOP
[166] Fix | Delete
#endif
[167] Fix | Delete
[168] Fix | Delete
#ifdef PERL_IMPLICIT_CONTEXT
[169] Fix | Delete
# ifndef MULTIPLICITY
[170] Fix | Delete
# define MULTIPLICITY
[171] Fix | Delete
# endif
[172] Fix | Delete
# define tTHX PerlInterpreter*
[173] Fix | Delete
# define pTHX tTHX my_perl PERL_UNUSED_DECL
[174] Fix | Delete
# define aTHX my_perl
[175] Fix | Delete
# define aTHXa(a) aTHX = (tTHX)a
[176] Fix | Delete
# ifdef PERL_GLOBAL_STRUCT
[177] Fix | Delete
# define dTHXa(a) dVAR; pTHX = (tTHX)a
[178] Fix | Delete
# else
[179] Fix | Delete
# define dTHXa(a) pTHX = (tTHX)a
[180] Fix | Delete
# endif
[181] Fix | Delete
# ifdef PERL_GLOBAL_STRUCT
[182] Fix | Delete
# define dTHX dVAR; pTHX = PERL_GET_THX
[183] Fix | Delete
# else
[184] Fix | Delete
# define dTHX pTHX = PERL_GET_THX
[185] Fix | Delete
# endif
[186] Fix | Delete
# define pTHX_ pTHX,
[187] Fix | Delete
# define aTHX_ aTHX,
[188] Fix | Delete
# define pTHX_1 2
[189] Fix | Delete
# define pTHX_2 3
[190] Fix | Delete
# define pTHX_3 4
[191] Fix | Delete
# define pTHX_4 5
[192] Fix | Delete
# define pTHX_5 6
[193] Fix | Delete
# define pTHX_6 7
[194] Fix | Delete
# define pTHX_7 8
[195] Fix | Delete
# define pTHX_8 9
[196] Fix | Delete
# define pTHX_9 10
[197] Fix | Delete
# define pTHX_12 13
[198] Fix | Delete
# if defined(DEBUGGING) && !defined(PERL_TRACK_MEMPOOL)
[199] Fix | Delete
# define PERL_TRACK_MEMPOOL
[200] Fix | Delete
# endif
[201] Fix | Delete
#else
[202] Fix | Delete
# undef PERL_TRACK_MEMPOOL
[203] Fix | Delete
#endif
[204] Fix | Delete
[205] Fix | Delete
#define STATIC static
[206] Fix | Delete
[207] Fix | Delete
#ifndef PERL_CORE
[208] Fix | Delete
/* Do not use these macros. They were part of PERL_OBJECT, which was an
[209] Fix | Delete
* implementation of multiplicity using C++ objects. They have been left
[210] Fix | Delete
* here solely for the sake of XS code which has incorrectly
[211] Fix | Delete
* cargo-culted them.
[212] Fix | Delete
*/
[213] Fix | Delete
#define CPERLscope(x) x
[214] Fix | Delete
#define CPERLarg void
[215] Fix | Delete
#define CPERLarg_
[216] Fix | Delete
#define _CPERLarg
[217] Fix | Delete
#define PERL_OBJECT_THIS
[218] Fix | Delete
#define _PERL_OBJECT_THIS
[219] Fix | Delete
#define PERL_OBJECT_THIS_
[220] Fix | Delete
#define CALL_FPTR(fptr) (*fptr)
[221] Fix | Delete
#define MEMBER_TO_FPTR(name) name
[222] Fix | Delete
#endif /* !PERL_CORE */
[223] Fix | Delete
[224] Fix | Delete
#define CALLRUNOPS PL_runops
[225] Fix | Delete
[226] Fix | Delete
#define CALLREGCOMP(sv, flags) Perl_pregcomp(aTHX_ (sv),(flags))
[227] Fix | Delete
[228] Fix | Delete
#define CALLREGCOMP_ENG(prog, sv, flags) (prog)->comp(aTHX_ sv, flags)
[229] Fix | Delete
#define CALLREGEXEC(prog,stringarg,strend,strbeg,minend,sv,data,flags) \
[230] Fix | Delete
RX_ENGINE(prog)->exec(aTHX_ (prog),(stringarg),(strend), \
[231] Fix | Delete
(strbeg),(minend),(sv),(data),(flags))
[232] Fix | Delete
#define CALLREG_INTUIT_START(prog,sv,strbeg,strpos,strend,flags,data) \
[233] Fix | Delete
RX_ENGINE(prog)->intuit(aTHX_ (prog), (sv), (strbeg), (strpos), \
[234] Fix | Delete
(strend),(flags),(data))
[235] Fix | Delete
#define CALLREG_INTUIT_STRING(prog) \
[236] Fix | Delete
RX_ENGINE(prog)->checkstr(aTHX_ (prog))
[237] Fix | Delete
[238] Fix | Delete
#define CALLREGFREE(prog) \
[239] Fix | Delete
Perl_pregfree(aTHX_ (prog))
[240] Fix | Delete
[241] Fix | Delete
#define CALLREGFREE_PVT(prog) \
[242] Fix | Delete
if(prog) RX_ENGINE(prog)->rxfree(aTHX_ (prog))
[243] Fix | Delete
[244] Fix | Delete
#define CALLREG_NUMBUF_FETCH(rx,paren,usesv) \
[245] Fix | Delete
RX_ENGINE(rx)->numbered_buff_FETCH(aTHX_ (rx),(paren),(usesv))
[246] Fix | Delete
[247] Fix | Delete
#define CALLREG_NUMBUF_STORE(rx,paren,value) \
[248] Fix | Delete
RX_ENGINE(rx)->numbered_buff_STORE(aTHX_ (rx),(paren),(value))
[249] Fix | Delete
[250] Fix | Delete
#define CALLREG_NUMBUF_LENGTH(rx,sv,paren) \
[251] Fix | Delete
RX_ENGINE(rx)->numbered_buff_LENGTH(aTHX_ (rx),(sv),(paren))
[252] Fix | Delete
[253] Fix | Delete
#define CALLREG_NAMED_BUFF_FETCH(rx, key, flags) \
[254] Fix | Delete
RX_ENGINE(rx)->named_buff(aTHX_ (rx), (key), NULL, ((flags) | RXapif_FETCH))
[255] Fix | Delete
[256] Fix | Delete
#define CALLREG_NAMED_BUFF_STORE(rx, key, value, flags) \
[257] Fix | Delete
RX_ENGINE(rx)->named_buff(aTHX_ (rx), (key), (value), ((flags) | RXapif_STORE))
[258] Fix | Delete
[259] Fix | Delete
#define CALLREG_NAMED_BUFF_DELETE(rx, key, flags) \
[260] Fix | Delete
RX_ENGINE(rx)->named_buff(aTHX_ (rx),(key), NULL, ((flags) | RXapif_DELETE))
[261] Fix | Delete
[262] Fix | Delete
#define CALLREG_NAMED_BUFF_CLEAR(rx, flags) \
[263] Fix | Delete
RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, ((flags) | RXapif_CLEAR))
[264] Fix | Delete
[265] Fix | Delete
#define CALLREG_NAMED_BUFF_EXISTS(rx, key, flags) \
[266] Fix | Delete
RX_ENGINE(rx)->named_buff(aTHX_ (rx), (key), NULL, ((flags) | RXapif_EXISTS))
[267] Fix | Delete
[268] Fix | Delete
#define CALLREG_NAMED_BUFF_FIRSTKEY(rx, flags) \
[269] Fix | Delete
RX_ENGINE(rx)->named_buff_iter(aTHX_ (rx), NULL, ((flags) | RXapif_FIRSTKEY))
[270] Fix | Delete
[271] Fix | Delete
#define CALLREG_NAMED_BUFF_NEXTKEY(rx, lastkey, flags) \
[272] Fix | Delete
RX_ENGINE(rx)->named_buff_iter(aTHX_ (rx), (lastkey), ((flags) | RXapif_NEXTKEY))
[273] Fix | Delete
[274] Fix | Delete
#define CALLREG_NAMED_BUFF_SCALAR(rx, flags) \
[275] Fix | Delete
RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, ((flags) | RXapif_SCALAR))
[276] Fix | Delete
[277] Fix | Delete
#define CALLREG_NAMED_BUFF_COUNT(rx) \
[278] Fix | Delete
RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, RXapif_REGNAMES_COUNT)
[279] Fix | Delete
[280] Fix | Delete
#define CALLREG_NAMED_BUFF_ALL(rx, flags) \
[281] Fix | Delete
RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, flags)
[282] Fix | Delete
[283] Fix | Delete
#define CALLREG_PACKAGE(rx) \
[284] Fix | Delete
RX_ENGINE(rx)->qr_package(aTHX_ (rx))
[285] Fix | Delete
[286] Fix | Delete
#if defined(USE_ITHREADS)
[287] Fix | Delete
#define CALLREGDUPE(prog,param) \
[288] Fix | Delete
Perl_re_dup(aTHX_ (prog),(param))
[289] Fix | Delete
[290] Fix | Delete
#define CALLREGDUPE_PVT(prog,param) \
[291] Fix | Delete
(prog ? RX_ENGINE(prog)->dupe(aTHX_ (prog),(param)) \
[292] Fix | Delete
: (REGEXP *)NULL)
[293] Fix | Delete
#endif
[294] Fix | Delete
[295] Fix | Delete
[296] Fix | Delete
[297] Fix | Delete
[298] Fix | Delete
[299] Fix | Delete
/*
[300] Fix | Delete
* Because of backward compatibility reasons the PERL_UNUSED_DECL
[301] Fix | Delete
* cannot be changed from postfix to PERL_UNUSED_DECL(x). Sigh.
[302] Fix | Delete
*
[303] Fix | Delete
* Note that there are C compilers such as MetroWerks CodeWarrior
[304] Fix | Delete
* which do not have an "inlined" way (like the gcc __attribute__) of
[305] Fix | Delete
* marking unused variables (they need e.g. a #pragma) and therefore
[306] Fix | Delete
* cpp macros like PERL_UNUSED_DECL cannot work for this purpose, even
[307] Fix | Delete
* if it were PERL_UNUSED_DECL(x), which it cannot be (see above).
[308] Fix | Delete
*
[309] Fix | Delete
*/
[310] Fix | Delete
[311] Fix | Delete
#if defined(__SYMBIAN32__) && defined(__GNUC__)
[312] Fix | Delete
# ifdef __cplusplus
[313] Fix | Delete
# define PERL_UNUSED_DECL
[314] Fix | Delete
# else
[315] Fix | Delete
# define PERL_UNUSED_DECL __attribute__((unused))
[316] Fix | Delete
# endif
[317] Fix | Delete
#endif
[318] Fix | Delete
[319] Fix | Delete
#ifndef PERL_UNUSED_DECL
[320] Fix | Delete
# if defined(HASATTRIBUTE_UNUSED) && (!defined(__cplusplus) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
[321] Fix | Delete
# define PERL_UNUSED_DECL __attribute__unused__
[322] Fix | Delete
# else
[323] Fix | Delete
# define PERL_UNUSED_DECL
[324] Fix | Delete
# endif
[325] Fix | Delete
#endif
[326] Fix | Delete
[327] Fix | Delete
/* gcc -Wall:
[328] Fix | Delete
* for silencing unused variables that are actually used most of the time,
[329] Fix | Delete
* but we cannot quite get rid of, such as "ax" in PPCODE+noargs xsubs,
[330] Fix | Delete
* or variables/arguments that are used only in certain configurations.
[331] Fix | Delete
*/
[332] Fix | Delete
#ifndef PERL_UNUSED_ARG
[333] Fix | Delete
# define PERL_UNUSED_ARG(x) ((void)sizeof(x))
[334] Fix | Delete
#endif
[335] Fix | Delete
#ifndef PERL_UNUSED_VAR
[336] Fix | Delete
# define PERL_UNUSED_VAR(x) ((void)sizeof(x))
[337] Fix | Delete
#endif
[338] Fix | Delete
[339] Fix | Delete
#if defined(USE_ITHREADS) || defined(PERL_GLOBAL_STRUCT)
[340] Fix | Delete
# define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl)
[341] Fix | Delete
#else
[342] Fix | Delete
# define PERL_UNUSED_CONTEXT
[343] Fix | Delete
#endif
[344] Fix | Delete
[345] Fix | Delete
/* gcc (-ansi) -pedantic doesn't allow gcc statement expressions,
[346] Fix | Delete
* g++ allows them but seems to have problems with them
[347] Fix | Delete
* (insane errors ensue).
[348] Fix | Delete
* g++ does not give insane errors now (RMB 2008-01-30, gcc 4.2.2).
[349] Fix | Delete
*/
[350] Fix | Delete
#if defined(PERL_GCC_PEDANTIC) || \
[351] Fix | Delete
(defined(__GNUC__) && defined(__cplusplus) && \
[352] Fix | Delete
((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2))))
[353] Fix | Delete
# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
[354] Fix | Delete
# define PERL_GCC_BRACE_GROUPS_FORBIDDEN
[355] Fix | Delete
# endif
[356] Fix | Delete
#endif
[357] Fix | Delete
[358] Fix | Delete
/* Use PERL_UNUSED_RESULT() to suppress the warnings about unused results
[359] Fix | Delete
* of function calls, e.g. PERL_UNUSED_RESULT(foo(a, b)).
[360] Fix | Delete
*
[361] Fix | Delete
* The main reason for this is that the combination of gcc -Wunused-result
[362] Fix | Delete
* (part of -Wall) and the __attribute__((warn_unused_result)) cannot
[363] Fix | Delete
* be silenced with casting to void. This causes trouble when the system
[364] Fix | Delete
* header files use the attribute.
[365] Fix | Delete
*
[366] Fix | Delete
* Use PERL_UNUSED_RESULT sparingly, though, since usually the warning
[367] Fix | Delete
* is there for a good reason: you might lose success/failure information,
[368] Fix | Delete
* or leak resources, or changes in resources.
[369] Fix | Delete
*
[370] Fix | Delete
* But sometimes you just want to ignore the return value, e.g. on
[371] Fix | Delete
* codepaths soon ending up in abort, or in "best effort" attempts,
[372] Fix | Delete
* or in situations where there is no good way to handle failures.
[373] Fix | Delete
*
[374] Fix | Delete
* Sometimes PERL_UNUSED_RESULT might not be the most natural way:
[375] Fix | Delete
* another possibility is that you can capture the return value
[376] Fix | Delete
* and use PERL_UNUSED_VAR on that.
[377] Fix | Delete
*
[378] Fix | Delete
* The __typeof__() is used instead of typeof() since typeof() is not
[379] Fix | Delete
* available under strict C89, and because of compilers masquerading
[380] Fix | Delete
* as gcc (clang and icc), we want exactly the gcc extension
[381] Fix | Delete
* __typeof__ and nothing else.
[382] Fix | Delete
*/
[383] Fix | Delete
#ifndef PERL_UNUSED_RESULT
[384] Fix | Delete
# if defined(__GNUC__) && defined(HASATTRIBUTE_WARN_UNUSED_RESULT)
[385] Fix | Delete
# define PERL_UNUSED_RESULT(v) STMT_START { __typeof__(v) z = (v); (void)sizeof(z); } STMT_END
[386] Fix | Delete
# else
[387] Fix | Delete
# define PERL_UNUSED_RESULT(v) ((void)(v))
[388] Fix | Delete
# endif
[389] Fix | Delete
#endif
[390] Fix | Delete
[391] Fix | Delete
/* on gcc (and clang), specify that a warning should be temporarily
[392] Fix | Delete
* ignored; e.g.
[393] Fix | Delete
*
[394] Fix | Delete
* GCC_DIAG_IGNORE(-Wmultichar);
[395] Fix | Delete
* char b = 'ab';
[396] Fix | Delete
* GCC_DIAG_RESTORE;
[397] Fix | Delete
*
[398] Fix | Delete
* based on http://dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
[399] Fix | Delete
*
[400] Fix | Delete
* Note that "pragma GCC diagnostic push/pop" was added in GCC 4.6, Mar 2011;
[401] Fix | Delete
* clang only pretends to be GCC 4.2, but still supports push/pop.
[402] Fix | Delete
*
[403] Fix | Delete
* Note on usage: on non-gcc (or lookalike, like clang) compilers
[404] Fix | Delete
* one cannot use these at file (global) level without warnings
[405] Fix | Delete
* since they are defined as empty, which leads into the terminating
[406] Fix | Delete
* semicolon being left alone on a line:
[407] Fix | Delete
* ;
[408] Fix | Delete
* which makes compilers mildly cranky. Therefore at file level one
[409] Fix | Delete
* should use the GCC_DIAG_IGNORE and GCC_DIAG_RESTORE_FILE *without*
[410] Fix | Delete
* the semicolons.
[411] Fix | Delete
*
[412] Fix | Delete
* (A dead-on-arrival solution would be to try to define the macros as
[413] Fix | Delete
* NOOP or dNOOP, those don't work both inside functions and outside.)
[414] Fix | Delete
*/
[415] Fix | Delete
[416] Fix | Delete
#if defined(__clang__) || defined(__clang) || \
[417] Fix | Delete
(defined( __GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
[418] Fix | Delete
# define GCC_DIAG_PRAGMA(x) _Pragma (#x)
[419] Fix | Delete
/* clang has "clang diagnostic" pragmas, but also understands gcc. */
[420] Fix | Delete
# define GCC_DIAG_IGNORE(x) _Pragma("GCC diagnostic push") \
[421] Fix | Delete
GCC_DIAG_PRAGMA(GCC diagnostic ignored #x)
[422] Fix | Delete
# define GCC_DIAG_RESTORE _Pragma("GCC diagnostic pop")
[423] Fix | Delete
#else
[424] Fix | Delete
# define GCC_DIAG_IGNORE(w)
[425] Fix | Delete
# define GCC_DIAG_RESTORE
[426] Fix | Delete
#endif
[427] Fix | Delete
/* for clang specific pragmas */
[428] Fix | Delete
#if defined(__clang__) || defined(__clang)
[429] Fix | Delete
# define CLANG_DIAG_PRAGMA(x) _Pragma (#x)
[430] Fix | Delete
# define CLANG_DIAG_IGNORE(x) _Pragma("clang diagnostic push") \
[431] Fix | Delete
CLANG_DIAG_PRAGMA(clang diagnostic ignored #x)
[432] Fix | Delete
# define CLANG_DIAG_RESTORE _Pragma("clang diagnostic pop")
[433] Fix | Delete
#else
[434] Fix | Delete
# define CLANG_DIAG_IGNORE(w)
[435] Fix | Delete
# define CLANG_DIAG_RESTORE
[436] Fix | Delete
#endif
[437] Fix | Delete
[438] Fix | Delete
#define NOOP /*EMPTY*/(void)0
[439] Fix | Delete
/* cea2e8a9dd23747f accidentally lost the comment originally from the first
[440] Fix | Delete
check in of thread.h, explaining why we need dNOOP at all: */
[441] Fix | Delete
/* Rats: if dTHR is just blank then the subsequent ";" throws an error */
[442] Fix | Delete
/* Declaring a *function*, instead of a variable, ensures that we don't rely
[443] Fix | Delete
on being able to suppress "unused" warnings. */
[444] Fix | Delete
#ifdef __cplusplus
[445] Fix | Delete
#define dNOOP (void)0
[446] Fix | Delete
#else
[447] Fix | Delete
#define dNOOP extern int Perl___notused(void)
[448] Fix | Delete
#endif
[449] Fix | Delete
[450] Fix | Delete
#ifndef pTHX
[451] Fix | Delete
/* Don't bother defining tTHX ; using it outside
[452] Fix | Delete
* code guarded by PERL_IMPLICIT_CONTEXT is an error.
[453] Fix | Delete
*/
[454] Fix | Delete
# define pTHX void
[455] Fix | Delete
# define pTHX_
[456] Fix | Delete
# define aTHX
[457] Fix | Delete
# define aTHX_
[458] Fix | Delete
# define aTHXa(a) NOOP
[459] Fix | Delete
# define dTHXa(a) dNOOP
[460] Fix | Delete
# define dTHX dNOOP
[461] Fix | Delete
# define pTHX_1 1
[462] Fix | Delete
# define pTHX_2 2
[463] Fix | Delete
# define pTHX_3 3
[464] Fix | Delete
# define pTHX_4 4
[465] Fix | Delete
# define pTHX_5 5
[466] Fix | Delete
# define pTHX_6 6
[467] Fix | Delete
# define pTHX_7 7
[468] Fix | Delete
# define pTHX_8 8
[469] Fix | Delete
# define pTHX_9 9
[470] Fix | Delete
# define pTHX_12 12
[471] Fix | Delete
#endif
[472] Fix | Delete
[473] Fix | Delete
#ifndef dVAR
[474] Fix | Delete
# define dVAR dNOOP
[475] Fix | Delete
#endif
[476] Fix | Delete
[477] Fix | Delete
/* these are only defined for compatibility; should not be used internally */
[478] Fix | Delete
#if !defined(pTHXo) && !defined(PERL_CORE)
[479] Fix | Delete
# define pTHXo pTHX
[480] Fix | Delete
# define pTHXo_ pTHX_
[481] Fix | Delete
# define aTHXo aTHX
[482] Fix | Delete
# define aTHXo_ aTHX_
[483] Fix | Delete
# define dTHXo dTHX
[484] Fix | Delete
# define dTHXoa(x) dTHXa(x)
[485] Fix | Delete
#endif
[486] Fix | Delete
[487] Fix | Delete
#ifndef pTHXx
[488] Fix | Delete
# define pTHXx PerlInterpreter *my_perl
[489] Fix | Delete
# define pTHXx_ pTHXx,
[490] Fix | Delete
# define aTHXx my_perl
[491] Fix | Delete
# define aTHXx_ aTHXx,
[492] Fix | Delete
# define dTHXx dTHX
[493] Fix | Delete
#endif
[494] Fix | Delete
[495] Fix | Delete
/* Under PERL_IMPLICIT_SYS (used in Windows for fork emulation)
[496] Fix | Delete
* PerlIO_foo() expands to PL_StdIO->pFOO(PL_StdIO, ...).
[497] Fix | Delete
* dTHXs is therefore needed for all functions using PerlIO_foo(). */
[498] Fix | Delete
#ifdef PERL_IMPLICIT_SYS
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function