Navigation Menu

Skip to content

Commit

Permalink
Move all warning logic back to WARN-IF-KW-OR-BELONGS-TO-CL
Browse files Browse the repository at this point in the history
  • Loading branch information
sionescu committed Feb 23, 2013
1 parent 294164f commit d1d2eb4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/early-types.lisp
Expand Up @@ -69,9 +69,7 @@
(defmacro define-parse-method (name lambda-list &body body)
"Define a type parser on NAME and lists whose CAR is NAME."
(discard-docstring body)
(unless (member (package-name *package*) '(#:cffi #:cffi-sys #:cffi-tests)
:key #'string)
(warn-if-kw-or-belongs-to-cl name))
(warn-if-kw-or-belongs-to-cl name)
`(eval-when (:compile-toplevel :load-toplevel :execute)
(setf (find-type-parser ',name)
(lambda ,lambda-list ,@body))
Expand Down
6 changes: 3 additions & 3 deletions src/utils.lisp
Expand Up @@ -48,9 +48,9 @@ set twos-complement bit."
;;; packages. CFFI itself gets to use keywords without a warning.
(defun warn-if-kw-or-belongs-to-cl (name)
(let ((package (symbol-package name)))
(when (or (eq package (find-package '#:cl))
(and (not (eq *package* (find-package '#:cffi)))
(eq package (find-package '#:keyword))))
(when (and (not (eq *package* (find-package '#:cffi)))
(member package '(#:common-lisp #:keyword)
:key #'find-package))
(warn "Defining a foreign type named ~S. This symbol belongs to the ~A ~
package and that may interfere with other code using CFFI."
name (package-name package)))))
Expand Down

0 comments on commit d1d2eb4

Please sign in to comment.