On Sat, May 27, 2017 at 11:04:05PM +0200, lemonboy wrote:
> Hello hackers,
> this patch does what it says on the tin and can be safely applied to
> the 4 branch,
> I didn't supply a separate patch in the hope the patch(1) deity
> manages me to spare
> this effort :)

Good catch, however the syntax check for define-foreign-type is too
strict: it should accept anything that evaluates to a procedure,
not just a symbol that refers to one.  The attached patch fixes
that.

Cheers,
Peter
From 935f5362b20db8a3fb22c662e78eaea8cb276d11 Mon Sep 17 00:00:00 2001
From: LemonBoy <[email protected]>
Date: Sat, 27 May 2017 22:58:31 +0200
Subject: [PATCH] Check the syntax correctness for some constructs

Forgetting to do so leads to segfaults in the compiler and suboptimal
error messages for the end user.

Signed-off-by: Peter Bex <[email protected]>
---
 chicken-ffi-syntax.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/chicken-ffi-syntax.scm b/chicken-ffi-syntax.scm
index ea87ced..c997071 100644
--- a/chicken-ffi-syntax.scm
+++ b/chicken-ffi-syntax.scm
@@ -195,6 +195,7 @@
  '()
  (##sys#er-transformer
   (lambda (form r c)
+    (##sys#check-syntax 'define-foreign-type form '(_ symbol symbol . #(_ 0 2)))
     `(##core#define-foreign-type ,@(cdr form)))))
 
 (##sys#extend-macro-environment
@@ -202,6 +203,7 @@
  '()
  (##sys#er-transformer
   (lambda (form r c)
+    (##sys#check-syntax 'define-foreign-variable form '(_ symbol symbol . #(string 0 1)))
     `(##core#define-foreign-variable ,@(cdr form)))))
 
 (##sys#extend-macro-environment
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to