From e3f42a5c49c049dfe49fb3f4bbe087bb05eb7d7a Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Tue, 4 Aug 2009 11:22:45 +0200 Subject: [PATCH] Make ECL less verbose in its messages, eliminating certain notes and the note context when this is too imprecise. --- src/cmp/cmpdefs.lsp | 2 +- src/cmp/cmplet.lsp | 8 ++++---- src/cmp/cmputil.lsp | 24 +++++++++++++++++------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/cmp/cmpdefs.lsp b/src/cmp/cmpdefs.lsp index 1e683c286..a64f694b8 100644 --- a/src/cmp/cmpdefs.lsp +++ b/src/cmp/cmpdefs.lsp @@ -285,7 +285,7 @@ each form it processes. The default value is NIL.") "This variable controls whether the compiler should display messages about its progress. The default value is T.") -(defvar *suppress-compiler-messages* nil +(defvar *suppress-compiler-messages* 'compiler-debug-note "A type denoting which compiler messages and conditions are _not_ displayed.") (defvar *suppress-compiler-notes* nil) ; Deprecated diff --git a/src/cmp/cmplet.lsp b/src/cmp/cmplet.lsp index 1ea975eb4..a8c5cbbeb 100644 --- a/src/cmp/cmplet.lsp +++ b/src/cmp/cmplet.lsp @@ -106,7 +106,7 @@ (notany #'(lambda (v) (var-referenced-in-form v form)) all-vars) (catch var (replaceable var body))) - (cmpnote "Replacing variable ~A by its value ~A" (var-name var) form) + (cmpdebug "Replacing variable ~A by its value ~A" (var-name var) form) (nsubst-var var form) (go continue)) ) @@ -350,7 +350,7 @@ (not (args-cause-side-effect fs))) (catch var (replaceable var body))) - (cmpnote "Replacing variable ~A by its value ~a" (var-name var) form) + (cmpdebug "Replacing variable ~A by its value ~a" (var-name var) form) (nsubst-var var form) (go continue)) ) @@ -400,7 +400,7 @@ (case (c1form-name form) (LOCATION (when (can-be-replaced* var body (cdr fl)) - (cmpnote "Replacing variable ~a by its value" (var-name var)) + (cmpdebug "Replacing variable ~a by its value" (var-name var)) (setf (var-kind var) 'REPLACED (var-loc var) (c1form-arg 0 form)))) (VAR @@ -413,7 +413,7 @@ (can-be-replaced* var body (cdr fl)) (not (var-changed-in-form-list var1 (rest fl))) (not (var-changed-in-form var1 body))) - (cmpnote "Replacing variable ~a by its value" (var-name var)) + (cmpdebug "Replacing variable ~a by its value" (var-name var)) (setf (var-kind var) 'REPLACED (var-loc var) var1))))) (unless env-grows diff --git a/src/cmp/cmputil.lsp b/src/cmp/cmputil.lsp index d5ae816ce..186ec7325 100644 --- a/src/cmp/cmputil.lsp +++ b/src/cmp/cmputil.lsp @@ -23,20 +23,27 @@ (form :initarg :form :initform *current-form* :accessor compiler-message-form)) (:REPORT (lambda (c stream) - (let ((position (compiler-message-file-position c))) - (if position - (let ((*print-length* 3) - (*print-level* 2)) + (let ((position (compiler-message-file-position c)) + (prefix (compiler-message-prefix c)) + (file (compiler-message-file c)) + (form (compiler-message-form c))) + (if (and position + (not (minusp position)) + (not (equalp form '|compiler preprocess|))) + (let* ((*print-length* 3) + (*print-level* 2)) + (unless (format stream "~A: in file ~A, position ~D, and form ~% ~A~%" - (compiler-message-prefix c) - (compiler-message-file c) position (compiler-message-form c))) - (format stream "~A: " (compiler-message-prefix c))) + prefix file position form))) + (format stream "~A: " prefix)) (format stream "~?" (simple-condition-format-control c) (simple-condition-format-arguments c)))))) (define-condition compiler-note (compiler-message) ()) +(define-condition compiler-debug-note (compiler-note) ()) + (define-condition compiler-warning (compiler-message simple-condition style-warning) ((prefix :initform "Warning"))) @@ -195,6 +202,9 @@ (defun cmpnote (string &rest args) (do-cmpwarn 'compiler-note :format-control string :format-arguments args)) +(defun cmpdebug (string &rest args) + (do-cmpwarn 'compiler-debug-note :format-control string :format-arguments args)) + (defun print-current-form () (when *compile-print* (let ((*print-length* 2)