Skip to content

Commit

Permalink
G_VOID, G_SCALAR, and G_ARRAY are not separate bits anymore
Browse files Browse the repository at this point in the history
Commit 2f8edad made G_ARRAY
equal to G_SCALAR | G_VOID, contrary to perlcall.pod.

Bring the documentation up to date and add a test to prevent a similar
(although unlikely) accident in the future.
  • Loading branch information
ntyni authored and Father Chrysostomos committed Nov 6, 2010
1 parent 54f3160 commit 0b06a75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 10 additions & 1 deletion ext/XS-APItest/t/call.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use strict;

BEGIN {
require '../../t/test.pl';
plan(435);
plan(436);
use_ok('XS::APItest')
};

Expand Down Expand Up @@ -149,6 +149,15 @@ for my $test (

};

{
# these are the ones documented in perlcall.pod
my @flags = (G_DISCARD, G_NOARGS, G_EVAL, G_KEEPERR);
my $mask = 0;
$mask |= $_ for (@flags);
is(unpack('%32b*', pack('l', $mask)), @flags,
"G_DISCARD and the rest are separate bits");
}

foreach my $inx ("", "aabbcc\n", [qw(aa bb cc)]) {
foreach my $outx ("", "xxyyzz\n", [qw(xx yy zz)]) {
my $warn;
Expand Down
7 changes: 3 additions & 4 deletions pod/perlcall.pod
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,9 @@ been warned.

=head1 FLAG VALUES

The C<flags> parameter in all the I<call_*> functions is a bit mask
which can consist of any combination of the symbols defined below,
OR'ed together.

The C<flags> parameter in all the I<call_*> functions is one of G_VOID,
G_SCALAR, or G_ARRAY, which indicate the call context, OR'ed together
with a bit mask of any combination of the other G_* symbols defined below.

=head2 G_VOID

Expand Down

0 comments on commit 0b06a75

Please sign in to comment.