Changeset 12531


Ignore:
Timestamp:
Aug 5, 2009, 7:28:07 PM (10 years ago)
Author:
gz
Message:

Warn about unknown names in fdecl's

Location:
branches/working-0711/ccl/compiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/compiler/nx-basic.lisp

    r12515 r12531  
    629629    (:invalid-type . report-invalid-type-compiler-warning)
    630630    (:unknown-declaration-variable . "~s declaration for unknown variable ~s")
     631    (:unknown-declaration-function . "~s declaration for unknown function ~s")
    631632    (:macro-used-before-definition . "Macro function ~S was used before it was defined.")
    632633    (:unsettable . "Shouldn't assign to variable ~S")
  • branches/working-0711/ccl/compiler/nx0.lisp

    r12529 r12531  
    720720        (nx1-whine :unknown-declaration-variable (cadr decl) sym)))))
    721721
     722(defun nx-check-fdecl-var-ref (decl env &aux (sym (car decl)))
     723  (unless (eq (cadr decl) 'ftype)
     724    ;; Complain about forward references, since need a def to use the declaration.
     725    ;; Perhaps should complain if regular macro, but don't for now.  Compiler macros
     726    ;; specifically allowed by spec for inline decls
     727    (unless (or (nx-lexical-finfo sym env)
     728                (fboundp sym)
     729                (retrieve-environment-function-info sym env)
     730                (gethash sym *nx1-alphatizers*)
     731                (assq sym *nx-compile-time-compiler-macros*)
     732                (gethash sym *compiler-macros*)
     733                (eq sym *nx-global-function-name*))
     734      (nx1-whine :unknown-declaration-function (cadr decl) sym))))
     735
    722736
    723737(defun nx-effect-other-decls (pending env)
     
    739753                    (rplacd (cdr decl) merged-type))))
    740754              (push decl env-vdecls)))))
    741       (when fdecls (setf (lexenv.fdecls env) (merge-decls fdecls (lexenv.fdecls env))))
     755      (when fdecls
     756        (let ((env-fdecls (lexenv.fdecls env)))
     757          (dolist (decl fdecls (setf (lexenv.fdecls env) env-fdecls))
     758            (unless (memq decl env-fdecls)
     759              (nx-check-fdecl-var-ref decl env)
     760              (push decl env-fdecls)))))
    742761      (when mdecls (setf (lexenv.mdecls env) (merge-decls mdecls (lexenv.mdecls env))))
    743762      (setq *nx-inlined-self* (and (nx-self-calls-inlineable env)
Note: See TracChangeset for help on using the changeset viewer.