On Wed, Jun 14, 2017 at 09:39:13PM +0200, lemonboy wrote:
> Hello hackers,
> the first two patches are meant to be applied after you review them, they are
> pretty much the same I've previously sent but with some minor corrections so
> those should be fine now.

Thanks for the patches.  Attached are signed-off copies.  I was tempted
to just push them, as they're kind of trivial, but we know what happened
last time, so to stay on the safe side I'll ask for a second review.

Cheers,
Peter
From 719d72dc2ef5f2de9c1b62a5f0e9cc8412c145cb Mon Sep 17 00:00:00 2001
From: LemonBoy <thatle...@gmail.com>
Date: Wed, 14 Jun 2017 21:28:52 +0200
Subject: [PATCH 1/2] Propagate the tl? flag to the inner definitions

The define-foreign-type form defines some auxiliary functions using
define and this was bound to always fail as we'd treat those as
non-toplevel ones.

Signed-off-by: Peter Bex <pe...@more-magic.net>
---
 core.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core.scm b/core.scm
index e6f3c39..2dccf48 100644
--- a/core.scm
+++ b/core.scm
@@ -1218,7 +1218,7 @@
 					(define
 					 ,ret
 					 ,(if (pair? (cdr conv)) (second conv) '##sys#values)) )
-				     e se dest ldest h ln #f) ) ]
+				     e se dest ldest h ln tl?))]
 				 [else
 				  (register-foreign-type! name type)
 				  '(##core#undefined) ] ) ) )
-- 
2.1.4

From 351977f0c2e5fefe30fddd7ca020ab4c2d2713a1 Mon Sep 17 00:00:00 2001
From: LemonBoy <thatle...@gmail.com>
Date: Wed, 14 Jun 2017 21:30:48 +0200
Subject: [PATCH 2/2] Restrict define-foreign-type forms to the toplevel

This brings this in line with how the other define forms work.

Signed-off-by: Peter Bex <pe...@more-magic.net>
---
 core.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/core.scm b/core.scm
index 2dccf48..c24ee15 100644
--- a/core.scm
+++ b/core.scm
@@ -1204,6 +1204,11 @@
 			 (let ((name (second x))
 			       (type (strip-syntax (third x)))
 			       (conv (cdddr x)))
+			   (unless tl?
+			     (quit-compiling
+			       "~adefinition of foreign type `~s' in non-toplevel context"
+			       (if ln (sprintf "(~a) - " ln) "")
+			       name))
 			   (cond [(pair? conv)
 				  (let ([arg (gensym)]
 					[ret (gensym)] )
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to