Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
848c3b7
Bump ExtUtils::ParseXS to 3.61
iabyn Oct 8, 2025
c45207c
ParseXS: refactor: add stub top-level node
iabyn Oct 8, 2025
38eb7ac
ParseXS: refactor: add Node::preamble
iabyn Oct 10, 2025
e05aac7
ParseXS: refactor: add Node::C_part
iabyn Oct 10, 2025
1c98325
ParseXS: refactor: add Node::postamble
iabyn Oct 10, 2025
201fc0c
ParseXS: refactor: add Node::global_cpp_line
iabyn Oct 10, 2025
51357f9
ParseXS: refactor: simplify double-negative regex
iabyn Oct 10, 2025
c153926
ParseXS: refactor: add Node::BOOT
iabyn Oct 12, 2025
30c7d5a
ParseXS: refactor: regularise BOOT processing
iabyn Oct 13, 2025
863754e
ParseXS: refactor: add Node::FALLBACK
iabyn Oct 13, 2025
8f8270f
ParseXS: refactor: add Node::REQUIRE
iabyn Oct 13, 2025
583011c
ParseXS: refactor: store current pkg in Node::xsub
iabyn Oct 20, 2025
3bb9e34
ParseXS: refactor: add Node::include etc
iabyn Oct 13, 2025
e65af0e
ParseXS: refactor: remove residual FOO_handler
iabyn Oct 13, 2025
9724016
ParseXS: refactor: remove check_keyword() method
iabyn Oct 14, 2025
b449039
ParseXS: add Node::as_concise method
iabyn Oct 18, 2025
552401e
ParseXS: refactor: add Node::cpp_scope
iabyn Oct 14, 2025
a78e434
ParseXS: refactor: use Node::cpp_scope for INCLUDE
iabyn Oct 15, 2025
7add86a
ParseXS: refactor: rm push_parse_stack, PopFile
iabyn Oct 15, 2025
9753f41
ParseXS: refactor: INCLUDE: save state locally
iabyn Oct 17, 2025
eb87763
ParseXS: refactor: global_cpp_line: parse CPP line
iabyn Oct 18, 2025
df8d3d7
ParseXS: fix #elif processing
iabyn Oct 18, 2025
21967f3
ParseXS: add more #if/#endif tests
iabyn Oct 21, 2025
a085cc8
ParseXS: refactor: reimplement #if processing
iabyn Oct 18, 2025
0881551
ParseXS: refactor: remove parser stack
iabyn Oct 20, 2025
7164235
ParseXS: refactor: move main parsing into XS_file
iabyn Oct 23, 2025
7436cf5
ParseXS: refactor: add Node::pre_boot
iabyn Oct 23, 2025
4aa0301
ParseXS: refactor: add Node::boot_xsub
iabyn Oct 23, 2025
6b82848
ParseXS: refactor: tidy Node::boot_xsub::parse()
iabyn Oct 23, 2025
39cf145
ParseXS: refactor: move some code
iabyn Oct 23, 2025
be71c4d
ParseXS: emit package overload registrations later
iabyn Oct 24, 2025
bcc6c05
ParseXS: refactor: add as_boot_code() methods
iabyn Oct 24, 2025
ae7ba09
ParseXS: refactor: inline and rm standard_XS_defs
iabyn Oct 24, 2025
7ab37e8
ParseXS: refactor: don't use $_ for C part of file
iabyn Oct 24, 2025
3194b77
ParseXS: refactor: remove $ExtUtils::ParseXS::END
iabyn Oct 24, 2025
88aa069
ParseXS: refactor: remove stray $_
iabyn Oct 24, 2025
75ea6d6
ParseXS: spot MODULE line syntax errors
iabyn Oct 25, 2025
7eb5946
ParseXS: refactor: add Node::MODULE
iabyn Oct 25, 2025
4eb804f
ParseXS: spot TYPEMAP: line syntax errors
iabyn Oct 25, 2025
85b283f
ParseXS: refactor: add Node::TYPEMAP
iabyn Oct 25, 2025
970d027
ParseXS: refactor: inline _maybe_skip_pod()
iabyn Oct 25, 2025
51348ed
ParseXS: refactor: move a chomp()
iabyn Oct 26, 2025
ce0f3aa
ParseXS: refactor: chomp TYPEMAP lines
iabyn Oct 26, 2025
52e57a2
ParseXS: fix POD on last line
iabyn Oct 26, 2025
35e3dda
ParseXS: refactor: fetch_para(): remove POD loop
iabyn Oct 26, 2025
990b981
ParseXS: refactor: fetch_para(): invert if
iabyn Oct 26, 2025
b84438e
ParseXS: refactor: fetch_para(): reindent
iabyn Oct 26, 2025
40f3830
ParseXS: process line continuations after POD
iabyn Oct 26, 2025
cb2593c
ParseXS: process line continuations after TYPEMAP
iabyn Oct 26, 2025
9d970e5
ParseXS: refactor: fetch_para(): add more comments
iabyn Oct 27, 2025
db33547
ParseXS: refactor: fetch_para(): simplify logic
iabyn Oct 27, 2025
7d4b810
ParseXS: refactor: fetch_para: update description
iabyn Oct 27, 2025
20d2937
ParseXS: refactor: fix comments re die if indented
iabyn Oct 28, 2025
64d7e86
ParseXS: refactor: simplify main loop
iabyn Oct 27, 2025
e93d277
ParseXS: refactor: rationalise parse-fail action
iabyn Oct 28, 2025
1324bc4
ParseXS: refactor: update POD and comments
iabyn Oct 29, 2025
d88ca93
ParseXS: refactor: add Node::Q method
iabyn Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -4201,7 +4201,6 @@ dist/ExtUtils-ParseXS/t/104-map_type.t ExtUtils::ParseXS tests
dist/ExtUtils-ParseXS/t/105-valid_proto_string.t ExtUtils::ParseXS tests
dist/ExtUtils-ParseXS/t/106-process_typemaps.t ExtUtils::ParseXS tests
dist/ExtUtils-ParseXS/t/108-map_type.t ExtUtils::ParseXS tests
dist/ExtUtils-ParseXS/t/109-standard_XS_defs.t ExtUtils::ParseXS tests
dist/ExtUtils-ParseXS/t/112-set_cond.t ExtUtils::ParseXS tests
dist/ExtUtils-ParseXS/t/113-check_cond_preproc_statements.t ExtUtils::ParseXS tests
dist/ExtUtils-ParseXS/t/114-blurt_death_Warn.t ExtUtils::ParseXS tests
Expand Down
155 changes: 154 additions & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,160 @@ sub as_code {
# Emit boilerplate postamble following any code passed through from
# the 'C' part of the XS file

ExtUtils::ParseXS::Utilities::standard_XS_defs();
print ExtUtils::ParseXS::Q(<<'EOF');
|#ifndef PERL_UNUSED_VAR
|# define PERL_UNUSED_VAR(var) if (0) var = var
|#endif
|
|#ifndef dVAR
|# define dVAR dNOOP
|#endif
|
|
|/* This stuff is not part of the API! You have been warned. */
|#ifndef PERL_VERSION_DECIMAL
|# define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
|#endif
|#ifndef PERL_DECIMAL_VERSION
|# define PERL_DECIMAL_VERSION \
| PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
|#endif
|#ifndef PERL_VERSION_GE
|# define PERL_VERSION_GE(r,v,s) \
| (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
|#endif
|#ifndef PERL_VERSION_LE
|# define PERL_VERSION_LE(r,v,s) \
| (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
|#endif
|
|/* XS_INTERNAL is the explicit static-linkage variant of the default
| * XS macro.
| *
| * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
| * "STATIC", ie. it exports XSUB symbols. You probably don't want that
| * for anything but the BOOT XSUB.
| *
| * See XSUB.h in core!
| */
|
|
|/* TODO: This might be compatible further back than 5.10.0. */
|#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
|# undef XS_EXTERNAL
|# undef XS_INTERNAL
|# if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
|# define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
|# define XS_INTERNAL(name) STATIC XSPROTO(name)
|# endif
|# if defined(__SYMBIAN32__)
|# define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
|# define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
|# endif
|# ifndef XS_EXTERNAL
|# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
|# define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
|# define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
|# else
|# ifdef __cplusplus
|# define XS_EXTERNAL(name) extern "C" XSPROTO(name)
|# define XS_INTERNAL(name) static XSPROTO(name)
|# else
|# define XS_EXTERNAL(name) XSPROTO(name)
|# define XS_INTERNAL(name) STATIC XSPROTO(name)
|# endif
|# endif
|# endif
|#endif
|
|/* perl >= 5.10.0 && perl <= 5.15.1 */
|
|
|/* The XS_EXTERNAL macro is used for functions that must not be static
| * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
| * macro defined, the best we can do is assume XS is the same.
| * Dito for XS_INTERNAL.
| */
|#ifndef XS_EXTERNAL
|# define XS_EXTERNAL(name) XS(name)
|#endif
|#ifndef XS_INTERNAL
|# define XS_INTERNAL(name) XS(name)
|#endif
|
|/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
| * internal macro that we're free to redefine for varying linkage due
| * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
| * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
| */
|
|#undef XS_EUPXS
|#if defined(PERL_EUPXS_ALWAYS_EXPORT)
|# define XS_EUPXS(name) XS_EXTERNAL(name)
|#else
| /* default to internal */
|# define XS_EUPXS(name) XS_INTERNAL(name)
|#endif
|
|#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
|#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
|
|/* prototype to pass -Wmissing-prototypes */
|STATIC void
|S_croak_xs_usage(const CV *const cv, const char *const params);
|
|STATIC void
|S_croak_xs_usage(const CV *const cv, const char *const params)
|{
| const GV *const gv = CvGV(cv);
|
| PERL_ARGS_ASSERT_CROAK_XS_USAGE;
|
| if (gv) {
| const char *const gvname = GvNAME(gv);
| const HV *const stash = GvSTASH(gv);
| const char *const hvname = stash ? HvNAME(stash) : NULL;
|
| if (hvname)
| Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
| else
| Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
| } else {
| /* Pants. I don't think that it should be possible to get here. */
| Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
| }
|}
|#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
|
|#define croak_xs_usage S_croak_xs_usage
|
|#endif
|
|/* NOTE: the prototype of newXSproto() is different in versions of perls,
| * so we define a portable version of newXSproto()
| */
|#ifdef newXS_flags
|#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
|#else
|#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
|#endif /* !defined(newXS_flags) */
|
|#if PERL_VERSION_LE(5, 21, 5)
|# define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
|#else
|# define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
|#endif
|
|/* simple backcompat versions of the TARGx() macros with no optimisation */
|#ifndef TARGi
|# define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv)
|# define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv)
|# define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv)
|#endif
|
EOF

# Fix up line number reckoning

print 'ExtUtils::ParseXS::CountLines'->end_marker, "\n"
if $pxs->{config_WantLineNumbers};
Expand Down
182 changes: 0 additions & 182 deletions dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ our (@ISA, @EXPORT_OK);
valid_proto_string
process_typemaps
map_type
standard_XS_defs
set_cond
Warn
WarnHint
Expand All @@ -41,7 +40,6 @@ ExtUtils::ParseXS::Utilities - Subroutines used with ExtUtils::ParseXS
valid_proto_string
process_typemaps
map_type
standard_XS_defs
set_cond
Warn
blurt
Expand Down Expand Up @@ -301,186 +299,6 @@ sub map_type {
}


=head2 C<standard_XS_defs()>

=over 4

=item * Purpose

Writes to the C<.c> output file certain preprocessor directives and function
headers needed in all such files.

=item * Arguments

None.

=item * Return Value

Returns true.

=back

=cut

sub standard_XS_defs {
print <<"EOF";
#ifndef PERL_UNUSED_VAR
# define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#ifndef dVAR
# define dVAR dNOOP
#endif


/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
# define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
# define PERL_DECIMAL_VERSION \\
PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
# define PERL_VERSION_GE(r,v,s) \\
(PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
# define PERL_VERSION_LE(r,v,s) \\
(PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif

/* XS_INTERNAL is the explicit static-linkage variant of the default
* XS macro.
*
* XS_EXTERNAL is the same as XS_INTERNAL except it does not include
* "STATIC", ie. it exports XSUB symbols. You probably don't want that
* for anything but the BOOT XSUB.
*
* See XSUB.h in core!
*/


/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
# undef XS_EXTERNAL
# undef XS_INTERNAL
# if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
# define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
# define XS_INTERNAL(name) STATIC XSPROTO(name)
# endif
# if defined(__SYMBIAN32__)
# define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
# define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
# endif
# ifndef XS_EXTERNAL
# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
# define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
# define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
# else
# ifdef __cplusplus
# define XS_EXTERNAL(name) extern "C" XSPROTO(name)
# define XS_INTERNAL(name) static XSPROTO(name)
# else
# define XS_EXTERNAL(name) XSPROTO(name)
# define XS_INTERNAL(name) STATIC XSPROTO(name)
# endif
# endif
# endif
#endif

/* perl >= 5.10.0 && perl <= 5.15.1 */


/* The XS_EXTERNAL macro is used for functions that must not be static
* like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
* macro defined, the best we can do is assume XS is the same.
* Dito for XS_INTERNAL.
*/
#ifndef XS_EXTERNAL
# define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
# define XS_INTERNAL(name) XS(name)
#endif

/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
* internal macro that we're free to redefine for varying linkage due
* to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
* XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
*/

#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
# define XS_EUPXS(name) XS_EXTERNAL(name)
#else
/* default to internal */
# define XS_EUPXS(name) XS_INTERNAL(name)
#endif

EOF

print <<"EOF";
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)

/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
const GV *const gv = CvGV(cv);

PERL_ARGS_ASSERT_CROAK_XS_USAGE;

if (gv) {
const char *const gvname = GvNAME(gv);
const HV *const stash = GvSTASH(gv);
const char *const hvname = stash ? HvNAME(stash) : NULL;

if (hvname)
Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
else
Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
} else {
/* Pants. I don't think that it should be possible to get here. */
Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
}
}
#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE

#define croak_xs_usage S_croak_xs_usage

#endif

/* NOTE: the prototype of newXSproto() is different in versions of perls,
* so we define a portable version of newXSproto()
*/
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */

#if PERL_VERSION_LE(5, 21, 5)
# define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
# define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif

/* simple backcompat versions of the TARGx() macros with no optimisation */
#ifndef TARGi
# define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv)
# define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv)
# define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv)
#endif

EOF
return 1;
}

=head2 C<set_cond()>

=over 4
Expand Down
Loading