Permalink
Browse files

Fix BARE-STRUCT-TYPE-P & STRUCTURE-BY-VALUE-P

  • Loading branch information...
1 parent 14e4a58 commit aa0c8a77346707e4a12ff3ad8c2f1af4708d6b92 @crlf0710 crlf0710 committed with luismbo Jan 21, 2013
Showing with 12 additions and 3 deletions.
  1. +8 −0 src/early-types.lisp
  2. +4 −3 src/functions.lisp
View
@@ -215,6 +215,14 @@ Signals an error if FOREIGN-TYPE is undefined."))
;;;# Structure Type
+(defgeneric bare-struct-type-p (foreign-type)
+ (:documentation
+ "Return true if FOREIGN-TYPE is a bare struct type or an alias of a bare struct type. "))
+
+(defmethod bare-struct-type-p ((type foreign-type))
+ "Return true if FOREIGN-TYPE is a bare struct type or an alias of a bare struct type. "
+ nil)
+
(defclass foreign-struct-type (named-foreign-type)
((slots
;; Hash table of slots in this structure, keyed by name.
View
@@ -90,9 +90,10 @@
(defun structure-by-value-p (ctype)
"A structure or union is to be called or returned by value."
- (typep (follow-typedefs (parse-type ctype))
- '(or foreign-struct-type foreign-union-type
- #+cffi::no-long-long emulated-llong-type)))
+ (let ((actual-type (follow-typedefs (parse-type ctype))))
+ (or (and (typep actual-type 'foreign-struct-type)
+ (not (bare-struct-type-p actual-type)))
+ #+cffi::no-long-long (typep actual-type 'emulated-llong-type))))
(defun fn-call-by-value-p (argument-types return-type)
"One or more structures in the arguments or return from the function are called by value."

0 comments on commit aa0c8a7

Please sign in to comment.