Ignore:
Timestamp:
Apr 10, 2012, 12:57:45 PM (8 years ago)
Author:
gb
Message:

Warn (via full warning) on duplicate bindings in SYMBOL-MACROLET,
MACROLET, FLET, LABELS (fixes ticket:927.)

If a DECLARE expression is encountered when a form is expected,
make the error message more verbose (and mention macroexpansion
as a possible cause of the problem.) Fixes ticket:926.

Warn (via a full warning) if a local function shadows a global
CL function name. Fixes ticket:923.

If STYLE-WARNINGs are incidentally signaled during (e.g.)
macroexpansion and are handled and postprocessed by the compiler,
ensure that the warning actually generated will be a STYLE-WARNING.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/nx0.lisp

    r15307 r15314  
    11101110               (neq (nx-var-root-nsetqs target) (cadr pair)))
    11111111             (push (cons var target) *nx-punted-vars*)))))
     1112
     1113;;; Someone might be able to come up with a case where (perhaps through
     1114;;; use of (DECLAIM (IGNORE ...))) it might make some sense to bind
     1115;;; the same variable more than once in a parallel binding construct.
     1116;;; Even if that's done intentionally, there's probably some value
     1117;;; in warning about it (and it's hard to guess whether it's done
     1118;;; intentionally.
     1119;;; Something like (LET* ((X 1) (X (1+ X))) ...) is well-defined (even
     1120;;; if it's a bit unaesthetic.
     1121;;; We error if there are duplicate required args in a lambda list,
     1122;;; but let things like (LAMBDA (A &OPTIONAL A) ...) slide.  (Those
     1123;;; cases generally generate an unused-variable warning, so we don't
     1124
     1125(defun nx1-check-duplicate-bindings (syms context)
     1126  (do* ()
     1127       ((null syms))
     1128    (let* ((sym (pop syms)))
     1129      (when (member sym syms :test #'eq)
     1130        (nx1-whine :duplicate-binding (maybe-setf-name sym) context)))))
     1131             
    11121132
    11131133(defun nx1-punt-var (var initform)
     
    19331953
    19341954(defun nx1-whine (about &rest forms)
    1935   (push (make-condition (or (cdr (assq about *compiler-whining-conditions*)) 'compiler-warning)
    1936                         :function-name (list *nx-cur-func-name*)
    1937                         :source-note *nx-current-note*
    1938                         :warning-type about
    1939                         :args (or forms (list nil)))
    1940         *nx-warnings*))
     1955  ;; Don't turn STYLE-WARNINGs generated during compilation into
     1956  ;; vanilla COMPILER-WARNINGs.
     1957  (let* ((c (if (and (eq about :program-error)
     1958                     (typep (car forms) 'style-warning))
     1959              (let* ((c (car forms)))
     1960                (with-slots (source-note function-name) c
     1961                  (setq source-note *nx-current-note*
     1962                        function-name (list *nx-cur-func-name*))
     1963                  c))
     1964              (make-condition (or (cdr (assq about *compiler-whining-conditions*))
     1965                                  'compiler-warning)
     1966                              :function-name (list *nx-cur-func-name*)
     1967                              :source-note *nx-current-note*
     1968                              :warning-type about
     1969                              :args (or forms (list nil))))))
     1970
     1971    (push c *nx-warnings*)))
    19411972
    19421973(defun p2-whine (afunc about &rest forms)
Note: See TracChangeset for help on using the changeset viewer.