Changeset 8541


Ignore:
Timestamp:
Feb 21, 2008, 9:44:13 AM (12 years ago)
Author:
gb
Message:

CERROR if conflicting :struct/:union with the same tag.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lib/foreign-types.lisp

    r8268 r8541  
    233233    (gethash (make-keyword x) (ftd-struct-definitions ftd)))
    234234  (defun (setf info-foreign-type-struct) (val x &optional (ftd *target-ftd*))
    235     (note-foreign-type-ordinal val ftd)
    236     (setf (gethash (make-keyword x) (ftd-struct-definitions ftd)) val))
     235    (let* ((name (make-keyword x)))
     236      (when (gethash name (ftd-union-definitions ftd))
     237        (cerror "Define ~s as a struct type"
     238                "~s is already defined as a union type"
     239                name)
     240        (remhash name (ftd-union-definitions ftd)))
     241      (note-foreign-type-ordinal val ftd)
     242      (setf (gethash name (ftd-struct-definitions ftd)) val)))
    237243
    238244  (defun info-foreign-type-union (x &optional (ftd *target-ftd*))
    239245    (gethash (make-keyword x) (ftd-union-definitions ftd)))
    240246  (defun (setf info-foreign-type-union) (val x  &optional (ftd *target-ftd*))
     247    (let* ((name (make-keyword x)))
     248      (when (gethash name (ftd-struct-definitions ftd))
     249        (cerror "Define ~s as a union type"
     250                "~s is already defined as a struct type"
     251                name)
     252        (remhash name (ftd-struct-definitions ftd)))
    241253    (note-foreign-type-ordinal val ftd)
    242     (setf (gethash (make-keyword x) (ftd-union-definitions ftd)) val))
     254    (setf (gethash name (ftd-union-definitions ftd)) val)))
    243255
    244256  (defun info-foreign-type-enum (x  &optional (ftd *target-ftd*))
Note: See TracChangeset for help on using the changeset viewer.