Skip to content

Commit

Permalink
Dev (#26)
Browse files Browse the repository at this point in the history
* wipe custom cflags

* Checking in changes prior to tagging of version 0.08_04.

Changelog diff is:

diff --git a/Changes b/Changes
index f40afd1..76da3fe 100644
--- a/Changes
+++ b/Changes
@@ -2,7 +2,7 @@ Revision history for Perl extension Affix.pm
 
 {{$NEXT}}
 
-0.08_03 2022-12-19T04:55:20Z
+0.08_04 2022-12-19T14:34:06Z
 
     - Smoke diagnostics

* Get a stable dist ready...
  • Loading branch information
sanko authored Dec 19, 2022
1 parent 5f0c9d8 commit 58ec665
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 44 deletions.
4 changes: 1 addition & 3 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ Revision history for Perl extension Affix.pm

{{$NEXT}}

0.08_03 2022-12-19T04:55:20Z

- Smoke diagnostics
- Correct struct alignment for perls with quadmath and/or longdouble enabled

0.07 2022-12-17T02:41:44Z

Expand Down
2 changes: 1 addition & 1 deletion META.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"web" : "https://github.com/sanko/Affix.pm"
}
},
"version" : "0.08_03",
"version" : "0.08",
"x_authority" : "cpan:SANKO",
"x_serialization_backend" : "JSON::PP version 4.12",
"x_static_install" : 0
Expand Down
7 changes: 4 additions & 3 deletions lib/Affix.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Affix { # 'FFI' is my middle name!
package Affix 0.08 { # 'FFI' is my middle name!
use strict;
use warnings;
no warnings 'redefine';
Expand All @@ -10,9 +10,10 @@ package Affix { # 'FFI' is my middle name!
use Text::ParseWords;
use Carp qw[];
use vars qw[@EXPORT_OK @EXPORT %EXPORT_TAGS];
our $VERSION = '0.08_03';

# our $VERSION = '0.08_04';
use XSLoader;
XSLoader::load( __PACKAGE__, $VERSION );
XSLoader::load( __PACKAGE__, our $VERSION );
#
use parent 'Exporter';
@EXPORT_OK = sort map { @$_ = sort @$_; @$_ } values %EXPORT_TAGS;
Expand Down
7 changes: 0 additions & 7 deletions lib/Affix.xs
Original file line number Diff line number Diff line change
Expand Up @@ -1652,18 +1652,11 @@ free(DCpointer ptr)
PPCODE:
// clang-format on
{
warn("here at %s line %d", __FILE__, __LINE__);

if (ptr) {
warn("here at %s line %d", __FILE__, __LINE__);
safefree(ptr);
warn("here at %s line %d", __FILE__, __LINE__);
ptr = NULL;
warn("here at %s line %d", __FILE__, __LINE__);
}
warn("here at %s line %d", __FILE__, __LINE__);
sv_set_undef(ST(0));
warn("here at %s line %d", __FILE__, __LINE__);
} // Let Affix::Pointer::DESTROY take care of the rest
// clang-format off

Expand Down
42 changes: 12 additions & 30 deletions t/51_affix_sizeof_offsetof.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,6 @@ subtest 'fundamental types' => sub {
is sizeof(Double), wrap( $lib, 's_double', [], Size_t )->(), 'sizeof(Double)';
is sizeof(SSize_t), wrap( $lib, 's_ssize_t', [], SSize_t )->(), 'sizeof(SSize_t)';
is sizeof(Size_t), wrap( $lib, 's_size_t', [], Size_t )->(), 'sizeof(Size_t)';
diag sizeof(Bool);
diag sizeof(Char);
diag sizeof(Short);
diag sizeof(Int);
diag sizeof(Long);
diag sizeof(LongLong);
diag sizeof(Float);
diag sizeof(Double);
diag sizeof(Size_t);
diag Affix::ALIGNBYTES();

# 1
# 1
# 2
# 4
# 8
# 8
# 4
# 8
# 8
# 16
};

#done_testing;
Expand All @@ -68,8 +47,9 @@ typedef massive => Struct [
A => Struct [ i => Int ],
u => Union [ i => Int, structure => Struct [ ptr => Pointer [Void], l => Long ] ]
];
use Data::Dumper;
diag Dumper massive();

#use Data::Dumper;
#diag Dumper massive();
subtest 'array' => sub {
is sizeof( ArrayRef [ Char, 3 ] ), 3, 'ArrayRef [ Char, 3 ]';
is sizeof( ArrayRef [ Pointer [Void], 1 ] ), 8, 'ArrayRef [ Pointer[Void], 1 ]';
Expand All @@ -87,11 +67,10 @@ subtest 'aggregates' => sub {
my $struct7 = Struct [ i => Int, Z => Str ];
my $struct8 = Struct [ d => Double, c => ArrayRef [ Int, 4 ] ];
subtest 'structs' => sub {
use Data::Dumper;
diag Dumper $struct1;
diag 'here';

#use Data::Dumper;
#diag Dumper $struct1;
is sizeof($struct1), wrap( $lib, 's_struct1', [], Size_t )->(), 'sizeof(struct1)';
diag 'here';
is sizeof($struct2), wrap( $lib, 's_struct2', [], Size_t )->(), 'sizeof(struct2)';
is sizeof($struct3), wrap( $lib, 's_struct3', [], Size_t )->(), 'sizeof(struct3)';
is sizeof($struct4), wrap( $lib, 's_struct4', [], Size_t )->(), 'sizeof(struct4)';
Expand All @@ -102,7 +81,8 @@ subtest 'aggregates' => sub {
is sizeof($struct6), wrap( $lib, 's_struct6', [], Size_t )->(), 'sizeof(struct6)';
is sizeof( massive() ), wrap( $lib, 's_massive', [], Size_t )->(), 'sizeof(massive)';
}
diag Dumper $struct7;

#diag Dumper $struct7;
is sizeof($struct7), wrap( $lib, 's_struct7', [], Size_t )->(), 'sizeof(struct7)';
is sizeof($struct8), wrap( $lib, 's_struct8', [], Size_t )->(), 'sizeof(struct8)';
};
Expand All @@ -111,7 +91,8 @@ subtest 'aggregates' => sub {
#die sizeof( Struct [ d => Double, c => ArrayRef [ Int, 4 ] ]);
for my $length ( 1 .. 3 ) {
my $array1 = ArrayRef [ Struct [ d => Double, c => ArrayRef [ Int, 4 ] ], $length ];
diag Dumper $array1;

#diag Dumper $array1;
is sizeof($array1), wrap( $lib, 's_array1', [Int], Size_t )->($length),
'sizeof(array1) [' . $length . ']';
}
Expand Down Expand Up @@ -149,6 +130,7 @@ subtest 'offsetof' => sub {
is offsetof( massive(), 'p' ), wrap( $lib, 'o_p', [], Size_t )->(), 'offsetof(..., "p")';
is offsetof( massive(), 'Z' ), wrap( $lib, 'o_Z', [], Size_t )->(), 'offsetof(..., "Z")';
};
diag Dumper massive();

#diag Dumper massive();
#
done_testing;

0 comments on commit 58ec665

Please sign in to comment.