Branch: refs/heads/davem/xs_fields
Home: https://github.com/Perl/perl5
Commit: 364c0be196084c4e27bf5ab0d522d97d8f6bbbd2
https://github.com/Perl/perl5/commit/364c0be196084c4e27bf5ab0d522d97d8f6bbbd2
Author: David Mitchell <[email protected]>
Date: 2024-08-10 (Sat, 10 Aug 2024)
Changed paths:
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
Log Message:
-----------
ExtUtils::ParseXS: min perl 5.6.1 => 5.8.3
Increase the minimum required perl release for ExtUtils::ParseXS from
perl-5.6.1 to perl-5.8.3.
The next commit will add 'use fields', which requires at least 5.8.0.
But also, since 2013 the ExtUtils::ParseXS module has had this line:
use Exporter 'import';
which is only supported in 5.8.3 onwards. Nobody has complained about
this in the last 11 years, so it doesn't look like we need to support an
older perl than that.
Commit: cf40db63e3d6797e9666583e0c7601df39822f4a
https://github.com/Perl/perl5/commit/cf40db63e3d6797e9666583e0c7601df39822f4a
Author: David Mitchell <[email protected]>
Date: 2024-08-10 (Sat, 10 Aug 2024)
Changed paths:
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm
Log Message:
-----------
ExtUtils::ParseXS: use fields.pm and doc fields
Add 'use fields' to make the fields of a ExtUtils::ParseXS object be
fixed and enforced.
Background:
ExtUtils::ParseXS is the guts of what used to be a standalone script,
xsubpp, which used to use many package variables.
When this code was split out into ExtUtils::ParseXS, some of those
package variables became lexical variables, while others became
members of the ExtUtils::ParseXS object (i.e. keys within the object
hash).
Due to Perl's liassez-faire attitude towards what can go inside an object
hash, and the general lack of organisation within this sprawling mess
of code, the object eventually accumulated 77 field members, many
undocumented, and certainly with no central point of documentation.
This commit adds 'use fields' and 'my ExtUtils::ParseXS $self' to this
module and its children. These together make use of an underappreciated
perl feature which allows you to create hashes with a fixed set of keys
(via 'use fields') and where the use of incorrect keys can often be
detected at compile-time (via 'my Type $self; $self->{bad_literal_key}').
Adding 'use fields' then allowed me to chase down all the keys used
by the object hash. I then documented them all.
This allowed me to detect a bug (to be fixed shortly): XsubAlias is a
typo intending to be XsubAliases; and to spot things like the fact that
there are three fields called:
interface
interfaces
Interfaces
Which could probably be better named.
The next few commits will do a bunch of renaming and rationalisation of
these object fields.
Note that due to a build-time circularity, this commit actually does a
conditional 'require fields; fields->import(...)' rather than 'use
fields', as fields depends on Hash::Util which is an XS module, which
depends on us. So while perl is being freshly built, the object fields
are not initially enforced, but are later on.
In terms of user-visible changes, if code which uses this module
naughtily tries to add extra keys to the object hash, they'll now get an
error, and they'll have to properly subclass the object instead.
Commit: 3ccc3f73839baed563581d0498be4693b1fb23a3
https://github.com/Perl/perl5/commit/3ccc3f73839baed563581d0498be4693b1fb23a3
Author: David Mitchell <[email protected]>
Date: 2024-08-10 (Sat, 10 Aug 2024)
Changed paths:
M dist/ExtUtils-ParseXS/t/001-basic.t
M dist/ExtUtils-ParseXS/t/XSAlias.xs
Log Message:
-----------
ExtUtils::ParseXS: extend alias test
This test checks that the correct warnings are issued when an XSUB tries
to define multiple aliases with the same value. This commit extends the
test slightly to have multiple aliases (including an alias matching the
function name) all mapped to in index 0.
The main point of generating these extra warnings is that the warnings
accidentally list the XSUB function's name ('do') multiple times in the
warning message. The next commit will fix that.
Commit: 3c912a6a0e3baa1231ac16fde3d3a8ce5f99d84b
https://github.com/Perl/perl5/commit/3c912a6a0e3baa1231ac16fde3d3a8ce5f99d84b
Author: David Mitchell <[email protected]>
Date: 2024-08-10 (Sat, 10 Aug 2024)
Changed paths:
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
M dist/ExtUtils-ParseXS/t/001-basic.t
Log Message:
-----------
ExtUtils::ParseXS: remove XsubAlias field
This was a typo: the code should have been checking if the
XsubAlias*es* field was defined, in order to remove a duplicate copy of
the XSUB function name from an alias warning message.
Commit: 01da889203ad3d0a19471bea3bb8b386fbad4e1e
https://github.com/Perl/perl5/commit/01da889203ad3d0a19471bea3bb8b386fbad4e1e
Author: David Mitchell <[email protected]>
Date: 2024-08-10 (Sat, 10 Aug 2024)
Changed paths:
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
Log Message:
-----------
ExtUtils::ParseXS: delete newXS/file/proto fields
Remove these three fields:
$self->{newXS}
$self->{file}
$self->{proto}
from the ParseXS object. They don't really store any proper parsing
state; they're just three temporary values better served by three
restricted-scope lexical vars.
The next commit will re-indent the new scope this commit adds.
Commit: 3e781cfc9f4a34d9761d4c1b16f172ace8387945
https://github.com/Perl/perl5/commit/3e781cfc9f4a34d9761d4c1b16f172ace8387945
Author: David Mitchell <[email protected]>
Date: 2024-08-10 (Sat, 10 Aug 2024)
Changed paths:
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
Log Message:
-----------
ExtUtils::ParseXS: reindent block
Indent a block of code which was wrapped in new braces by the
previous commit. White space only.
Commit: bce450eb9521bc2c46a5e67d41882946d3e88417
https://github.com/Perl/perl5/commit/bce450eb9521bc2c46a5e67d41882946d3e88417
Author: David Mitchell <[email protected]>
Date: 2024-08-10 (Sat, 10 Aug 2024)
Changed paths:
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
Log Message:
-----------
ExtUtils::ParseXS: partially eliminate cond field
This object field was being used for two purposes: once to maintain
state about CASE conditions, and once as a short-lived temporary value.
Use a lexical var instead for the latter use. The new scope will be
re-indented in the next commit.
Commit: 531b5a3ba6295605ba1c0459ef7d96baf0b8c541
https://github.com/Perl/perl5/commit/531b5a3ba6295605ba1c0459ef7d96baf0b8c541
Author: David Mitchell <[email protected]>
Date: 2024-08-10 (Sat, 10 Aug 2024)
Changed paths:
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
Log Message:
-----------
ExtUtils::ParseXS: reindent block
Indent a block of code which was wrapped in new braces by the
previous commit. White space only.
Commit: 14d4b955cb597a52c82c75b69522c9100ad03142
https://github.com/Perl/perl5/commit/14d4b955cb597a52c82c75b69522c9100ad03142
Author: David Mitchell <[email protected]>
Date: 2024-08-10 (Sat, 10 Aug 2024)
Changed paths:
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm
M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm
M dist/ExtUtils-ParseXS/t/110-assign_func_args.t
M dist/ExtUtils-ParseXS/t/113-check_cond_preproc_statements.t
M dist/ExtUtils-ParseXS/t/114-blurt_death_Warn.t
Log Message:
-----------
ExtUtils::ParseXS: rename most object fields
This big commit renames around 60 of the 75-or-so fields within an
ExtUtils::ParseXS hash object.
This is because many of the current names are confusing and follow no
particular pattern.
I've used the following rules of thumb:
- Generally make the names longer. For example there are three fields
which indicate whether the RETVAL value has been seen within a
particular XSUB section, and it's not at all obvious that (for example)
gotRETVAL specifically indicates having seen that var in the *OUTPUT*
section.
- Prefix most things with a category, e.g. xsub_ for per-XSUB values,
config_ for config values etc. I've generally left miscellaneous
global state un-prefixed.
- Hashes (and the occasional array) are generally named as map_X_to_Y
where X and Y describe the keys and values.
- Booleans indicating that something in particular has been detected in
the XS source file are prefixed with seen_.
- Fields directly related to an XS keyword use that keyword in
upper-case, e.g. xsub_seen_ALIAS.
A few fields were left as-is because it would be too much effort to
rename them, e.g. line and line_no should really have become in_lines
and in_line_nums. A couple of fields were left as-is because they are
going to be removed soon.
This commit includes some minor changes to code comments and a bunch of
white-space changes, e.g. wrapping code lines which have become too long.
But there are no other functional changes.
It could in theory break code which access the object's fields directly.
WAS NOW
InitFileCode bootcode_early
errors error_count
Overloaded map_overloaded_package_to_C_package
Fallback map_package_to_fallback_string
Module_cname MODULE_cname
Packprefix PACKAGE_class
Packid PACKAGE_C_name
Package PACKAGE_name
Prefix PREFIX_pattern
ProtoUsed proto_behaviour_specified
WantPrototypes PROTOTYPES_value
interfaces seen_INTERFACE_or_MACRO
typemap typemaps_object
WantVersionChk VERSIONCHECK_value
XSStack XS_parse_stack
argtypes config_allow_argtypes
except config_allow_exceptions
inout config_allow_inout
author_warnings config_author_warnings
optimize config_optimize
RetainCplusplusHierarchicalTypes config_RetainCplusplusHierarchicalTypes
strip_c_func_prefix config_strip_c_func_prefix
WantLineNumbers config_WantLineNumbers
FH in_fh
filename in_filename
filepathname in_pathname
XsubAliasValueClashHinted xsub_alias_clash_hinted
Attributes xsub_attributes
cond xsub_CASE_condition
condnum xsub_CASE_condition_count
func_args xsub_C_auto_function_signature
deferred xsub_deferred_code_lines
Full_func_name xsub_func_full_C_name
pname xsub_func_full_perl_name
func_name xsub_func_name
XsubAliases xsub_map_alias_name_to_value
XsubAliasValues xsub_map_alias_value_to_name_seen_hash
proto_arg xsub_map_arg_idx_to_proto
defaults xsub_map_argname_to_default
args_match xsub_map_argname_to_idx
in_out xsub_map_argname_to_in_out
lengthof xsub_map_argname_to_islength
argtype_seen xsub_map_argname_to_seen_type
var_types xsub_map_argname_to_type
Interfaces xsub_map_interface_name_short_to_original
OverloadsThisXSUB xsub_map_overload_name_to_seen
arg_list xsub_map_varname_to_seen_in_INPUT
outargs xsub_map_varname_to_seen_in_OUTPUT
ProtoThisXSUB xsub_prototype
ret_type xsub_return_type
RETVAL_code xsub_RETVAL_typemap_code
ScopeThisXSUB xsub_SCOPE_enabled
ALIAS xsub_seen_ALIAS
interface xsub_seen_INTERFACE_or_MACRO
have_OUTPUT xsub_seen_OUTPUT
proto_in_this_xsub xsub_seen_PROTOTYPE
have_CODE_with_RETVAL xsub_seen_RETVAL_in_CODE
retvaldone xsub_seen_RETVAL_in_INPUT
gotRETVAL xsub_seen_RETVAL_in_OUTPUT
scope_in_this_xsub xsub_seen_SCOPE
thisdone xsub_seen_THIS_in_INPUT
DoSetMagic xsub_SETMAGIC_state
Compare: https://github.com/Perl/perl5/compare/364c0be19608%5E...14d4b955cb59
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications