Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] G_VOID, G_SCALAR, and G_ARRAY are not separate bits anymore #10801

Closed
p5pRT opened this issue Nov 6, 2010 · 4 comments
Closed

[PATCH] G_VOID, G_SCALAR, and G_ARRAY are not separate bits anymore #10801

p5pRT opened this issue Nov 6, 2010 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 6, 2010

Migrated from rt.perl.org#78862 (status was 'resolved')

Searchable as RT78862$

@p5pRT
Copy link
Author

p5pRT commented Nov 6, 2010

From @ntyni

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.


ext/XS-APItest/t/call.t | 11 ++++++++++-
pod/perlcall.pod | 7 +++----
2 files changed, 13 insertions(+), 5 deletions(-)

Inline Patch
diff --git a/ext/XS-APItest/t/call.t b/ext/XS-APItest/t/call.t
index caa86c4..fd968b8 100644
--- a/ext/XS-APItest/t/call.t
+++ b/ext/XS-APItest/t/call.t
@@ -11,7 +11,7 @@ use strict;
 
 BEGIN {
     require '../../t/test.pl';
-    plan(435);
+    plan(436);
     use_ok('XS::APItest')
 };
 
@@ -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;
diff --git a/pod/perlcall.pod b/pod/perlcall.pod
index 1694848..e32e77e 100644
--- a/pod/perlcall.pod
+++ b/pod/perlcall.pod
@@ -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
 
-- 
1.7.2.3

@p5pRT
Copy link
Author

p5pRT commented Nov 6, 2010

From @cpansprout

On Sat Nov 06 04​:40​:13 2010, ntyni@​debian.org wrote​:

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.

Thank you. Applied as 0b06a75.

@p5pRT
Copy link
Author

p5pRT commented Nov 6, 2010

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 6, 2010

@cpansprout - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant