0.8.10.58:
authorChristophe Rhodes <csr21@cam.ac.uk>
Fri, 28 May 2004 08:01:56 +0000 (08:01 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Fri, 28 May 2004 08:01:56 +0000 (08:01 +0000)
More refactoring around COMPILER-WARN
... new src/code/cross-condition file to house cross-compiler
definitions of conditions
... new condition types for format warnings
... (note that this separation between xc and target definitions
allows us to make warnings of different severity
during cross-compilation easily)

TODO
build-order.lisp-expr
package-data-list.lisp-expr
src/code/condition.lisp
src/code/error.lisp
src/compiler/srctran.lisp
version.lisp-expr

diff --git a/TODO b/TODO
index 30ee13d..f26e4be 100644 (file)
--- a/TODO
+++ b/TODO
@@ -63,6 +63,12 @@ for early 0.8.x:
 * Some work on conditions emitted by the system
        ** eliminated COMPILER-WARN and COMPILER-STYLE-WARN, which
                were simply limited versions of WARN and STYLE-WARN.
+       ** made STYLE-WARN parallel WARN more closely (by accepting
+               a condition type, which should be a subtype of
+               STYLE-WARNING, and initargs, as well as a format
+               string and format arguments for SIMPLE-STYLE-WARNING.
+               (WARN can also be used to signal STYLE-WARNINGs, but
+               STYLE-WARN helps to document the code)
        ** eliminated use of INHIBIT-WARNINGS by code emitted by the
                system from user code.
        ** caused use of INHIBIT-WARNINGS to signal a STYLE-WARNING.
index 0274a1d..1c85be4 100644 (file)
@@ -81,6 +81,7 @@
  ("src/code/cross-sap"   :not-target)
  ("src/code/cross-thread" :not-target)
  ("src/code/cross-make-load-form" :not-target)
+ ("src/code/cross-condition" :not-target)
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;; stuff needed early both in cross-compilation host and in target Lisp
index 9702f6d..d842cc5 100644 (file)
@@ -805,7 +805,9 @@ retained, possibly temporariliy, because it might be used internally."
             "DUPLICATE-DEFINITION" "DUPLICATE-DEFINITION-NAME"
             "PACKAGE-AT-VARIANCE" "ARRAY-INITIAL-ELEMENT-MISMATCH"
             "TYPE-WARNING" "LOCAL-ARGUMENT-MISMATCH"
-            
+            "FORMAT-ARGS-MISMATCH" "FORMAT-TOO-FEW-ARGS-WARNING"
+            "FORMAT-TOO-MANY-ARGS-WARNING"
+
              ;; ..and DEFTYPEs..
              "INDEX" "LOAD/STORE-INDEX"
             "SIGNED-BYTE-WITH-A-BITE-OUT"
index 3765b9b..0534bc0 100644 (file)
 ;;;; setup of CONDITION machinery, only because that makes it easier to
 ;;;; get cold init to work.
 
+(define-condition simple-style-warning (simple-condition style-warning) ())
+
 (define-condition values-type-error (type-error)
   ()
   (:report
 (define-condition local-argument-mismatch (reference-condition simple-warning)
   ()
   (:default-initargs :references (list '(:ansi-cl :section (3 2 2 3)))))
+
+(define-condition format-args-mismatch (reference-condition)
+  ()
+  (:default-initargs :references (list '(:ansi-cl :section (22 3 10 2)))))
+
+(define-condition format-too-few-args-warning 
+    (format-args-mismatch simple-warning)
+  ())
+(define-condition format-too-many-args-warning
+    (format-args-mismatch simple-style-warning)
+  ())
 \f
 ;;;; restart definitions
 
index 163c0e3..f871e90 100644 (file)
@@ -13,8 +13,6 @@
 
 (in-package "SB!KERNEL")
 
-(define-condition simple-style-warning (simple-condition style-warning) ())
-
 ;;; not sure this is the right place, but where else?
 (defun style-warn (format-control &rest format-arguments)
   (/show0 "entering STYLE-WARN")
index 46cbfa8..869f684 100644 (file)
 
 ;;; for compile-time argument count checking.
 ;;;
-;;; FIXME I: this is currently called from DEFTRANSFORMs, the vast
-;;; majority of which are not going to transform the code, but instead
-;;; are going to GIVE-UP-IR1-TRANSFORM unconditionally.  It would be
-;;; nice to make this explicit, maybe by implementing a new
-;;; "optimizer" (say, DEFOPTIMIZER CONSISTENCY-CHECK).
-;;;
 ;;; FIXME II: In some cases, type information could be correlated; for
 ;;; instance, ~{ ... ~} requires a list argument, so if the lvar-type
 ;;; of a corresponding argument is known and does not intersect the
       (let ((nargs (length args)))
        (cond
          ((< nargs min)
-          (compiler-warn "Too few arguments (~D) to ~S ~S: ~
-                           requires at least ~D."
-                         nargs fun string min))
+          (warn 'format-too-few-args-warning
+                :format-control
+                "Too few arguments (~D) to ~S ~S: requires at least ~D."
+                :format-arguments (list nargs fun string min)))
          ((> nargs max)
-          (;; to get warned about probably bogus code at
-           ;; cross-compile time.
-           #+sb-xc-host compiler-warn
-           ;; ANSI saith that too many arguments doesn't cause a
-           ;; run-time error.
-           #-sb-xc-host compiler-style-warn
-           "Too many arguments (~D) to ~S ~S: uses at most ~D."
-           nargs fun string max)))))))
+          (warn 'format-too-many-args-warning
+                :format-control
+                "Too many arguments (~D) to ~S ~S: uses at most ~D."
+                :format-arguments (list nargs fun string max))))))))
 
 (defoptimizer (format optimizer) ((dest control &rest args))
   (when (constant-lvar-p control)
                (let ((nargs (length args)))
                  (cond
                    ((< nargs (min min1 min2))
-                    (compiler-warn "Too few arguments (~D) to ~S ~S ~S: ~
-                                     requires at least ~D."
-                                   nargs 'cerror y x (min min1 min2)))
+                    (warn 'format-too-few-args-warning
+                          :format-control
+                          "Too few arguments (~D) to ~S ~S ~S: ~
+                            requires at least ~D."
+                          :format-arguments
+                          (list nargs 'cerror y x (min min1 min2))))
                    ((> nargs (max max1 max2))
-                    (;; to get warned about probably bogus code at
-                     ;; cross-compile time.
-                     #+sb-xc-host compiler-warn
-                     ;; ANSI saith that too many arguments doesn't cause a
-                     ;; run-time error.
-                     #-sb-xc-host compiler-style-warn
-                     "Too many arguments (~D) to ~S ~S ~S: uses at most ~D."
-                     nargs 'cerror y x (max max1 max2)))))))))))))
+                    (warn 'format-too-many-args-warning
+                          :format-control
+                          "Too many arguments (~D) to ~S ~S ~S: ~
+                            uses at most ~D."
+                          :format-arguments
+                          (list nargs 'cerror y x (max max1 max2))))))))))))))
 
 (defoptimizer (coerce derive-type) ((value type))
   (cond
index faa36d3..cfbb109 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.10.57"
+"0.8.10.58"