I'm seeing some warnings from CMUCL that I don't understand. Here is the warning the simplest code I've written at the moment that produces the warning:
(defun flurp (line) (let (delta) (register-groups-bind (delta-str) ('(:sequence (:register (:greedy-repetition 1 nil :digit-class))) line) (setq delta (parse-integer delta-str)))))
and the warning:
; In: DEFUN FLURP
; (REGISTER-GROUPS-BIND (DELTA-STR) ('# LINE) (SETQ DELTA #)) ; --> LET MULTIPLE-VALUE-BIND MULTIPLE-VALUE-CALL FUNCTION WHEN COND IF PROGN ; --> LET* LET ; ==> ; (IF #:START-INDEX5 ; (FUNCALL #:SUBSTR-FN6 #:TARGET-STRING0 #:START-INDEX5 #) ; NIL) ; Warning: This is not a (VALUES &OPTIONAL BASE-STRING &REST T): ; NIL ; ; [Last message occurs 2 times]
What follows are a few more examples, with SSMT-OUTPUT-SUMMARY being the original snippet.
(in-package #:pg-user)
(defun ssmt-output-summary (pname) (with-open-file (in pname :direction :input) (loop with line = nil and delta = 0 and added = 0 and changed = 0 and deleted = 0 while (setq line (read-line in nil)) when (register-groups-bind (delta-str added-str changed-str deleted-str) ('(:sequence "__UNDEF__" (:greedy-repetition 1 nil :whitespace-char-class) ;; Delta SLOC (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Skip over delta AELOC (:greedy-repetition 1 nil :digit-class) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code added (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code changed (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code deleted (:register (:greedy-repetition 1 nil :digit-class))) line) ;; Somebody doesn't like our attempting to return ;; multiple values past the REGISTER-GROUPS-BIND (setq delta (parse-integer delta-str) added (parse-integer added-str) changed (parse-integer changed-str) deleted (parse-integer deleted-str))) do (return (values delta added changed deleted)) finally (warn "Could not find summary for ~A" pname))))
(defun foo (line) (let (delta added changed deleted) (register-groups-bind (delta-str added-str changed-str deleted-str) ('(:sequence "__UNDEF__" (:greedy-repetition 1 nil :whitespace-char-class) ;; Delta SLOC (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Skip over delta AELOC (:greedy-repetition 1 nil :digit-class) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code added (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code changed (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code deleted (:register (:greedy-repetition 1 nil :digit-class))) line) (setq delta (parse-integer delta-str) added (parse-integer added-str) changed (parse-integer changed-str) deleted (parse-integer deleted-str)))))
(defun bar (line) (register-groups-bind (delta-str added-str changed-str deleted-str) ('(:sequence "__UNDEF__" (:greedy-repetition 1 nil :whitespace-char-class) ;; Delta SLOC (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Skip over delta AELOC (:greedy-repetition 1 nil :digit-class) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code added (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code changed (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code deleted (:register (:greedy-repetition 1 nil :digit-class))) line) (declare (ignore delta-str added-str changed-str deleted-str))))
(defun baz (line) (register-groups-bind (delta-str added-str changed-str deleted-str) ('(:sequence "__UNDEF__" (:greedy-repetition 1 nil :whitespace-char-class) ;; Delta SLOC (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Skip over delta AELOC (:greedy-repetition 1 nil :digit-class) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code added (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code changed (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code deleted (:register (:greedy-repetition 1 nil :digit-class))) line) (declare (ignore added-str changed-str deleted-str)) delta-str))
(defun blatz (line) (register-groups-bind (delta-str added-str changed-str deleted-str) ('(:sequence "__UNDEF__" (:greedy-repetition 1 nil :whitespace-char-class) ;; Delta SLOC (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Skip over delta AELOC (:greedy-repetition 1 nil :digit-class) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code added (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code changed (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code deleted (:register (:greedy-repetition 1 nil :digit-class))) line) (values delta-str added-str changed-str deleted-str)))
(defun blurp (line) (register-groups-bind (delta-str added-str changed-str deleted-str) ('(:sequence "__UNDEF__" (:greedy-repetition 1 nil :whitespace-char-class) ;; Delta SLOC (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Skip over delta AELOC (:greedy-repetition 1 nil :digit-class) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code added (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code changed (:register (:greedy-repetition 1 nil :digit-class)) (:greedy-repetition 1 nil :whitespace-char-class) ;; Code deleted (:register (:greedy-repetition 1 nil :digit-class))) line) (declare (ignore delta-str added-str changed-str deleted-str)) 69))
(defun flurp (line) (let (delta) (register-groups-bind (delta-str) ('(:sequence (:register (:greedy-repetition 1 nil :digit-class))) line) (setq delta (parse-integer delta-str)))))
And the complaints during compilation.
* (lisp-implementation-version) "19a" * (lisp-implementation-type) "CMU Common Lisp" * (software-version) "5.8" * (software-type) "SunOS" * (compile-file "/home/kick/tmp/scratch.lisp") ; Python version 1.1, VM version UltraSparc/Solaris 7 on 19 NOV 04 01:59:21 pm. ; Compiling: /home/kick/tmp/scratch.lisp 19 NOV 04 01:58:23 pm
; Compiling Load Time Value of (CREATE-SCANNER '(:SEQUENCE "__UNDEF__" # ...)): ; Converted SSMT-OUTPUT-SUMMARY. ; Compiling DEFUN SSMT-OUTPUT-SUMMARY:
; ; ; File: /home/kick/tmp/scratch.lisp
; In: DEFUN SSMT-OUTPUT-SUMMARY
; (REGISTER-GROUPS-BIND (DELTA-STR ADDED-STR CHANGED-STR DELETED-STR) ; ('# LINE) ; (SETQ DELTA # ADDED # ...)) ; --> LET MULTIPLE-VALUE-BIND MULTIPLE-VALUE-CALL FUNCTION WHEN COND IF PROGN ; --> LET* LET ; ==> ; (IF #:START-INDEX15 ; (FUNCALL #:SUBSTR-FN16 #:TARGET-STRING10 #:START-INDEX15 #) ; NIL) ; Warning: This is not a (VALUES &OPTIONAL BASE-STRING &REST T): ; NIL ; ; [Last message occurs 8 times]
; Compiling Load Time Value of (CREATE-SCANNER '(:SEQUENCE "__UNDEF__" # ...)): ; Converted FOO. ; Compiling DEFUN FOO:
; ; ; File: /home/kick/tmp/scratch.lisp
; In: DEFUN FOO
; (REGISTER-GROUPS-BIND (DELTA-STR ADDED-STR CHANGED-STR DELETED-STR) ; ('# LINE) ; (SETQ DELTA # ADDED # ...)) ; --> LET MULTIPLE-VALUE-BIND MULTIPLE-VALUE-CALL FUNCTION WHEN COND IF PROGN ; --> LET* LET ; ==> ; (IF #:START-INDEX5 ; (FUNCALL #:SUBSTR-FN6 #:TARGET-STRING0 #:START-INDEX5 #) ; NIL) ; Warning: This is not a (VALUES &OPTIONAL BASE-STRING &REST T): ; NIL ; ; [Last message occurs 8 times]
; Compiling Load Time Value of (CREATE-SCANNER '(:SEQUENCE "__UNDEF__" # ...)): ; Converted BAR. ; Compiling DEFUN BAR: ; Compiling Load Time Value of (CREATE-SCANNER '(:SEQUENCE "__UNDEF__" # ...)): ; Converted BAZ. ; Compiling DEFUN BAZ: ; Compiling Load Time Value of (CREATE-SCANNER '(:SEQUENCE "__UNDEF__" # ...)): ; Converted BLATZ. ; Compiling DEFUN BLATZ: ; Compiling Load Time Value of (CREATE-SCANNER '(:SEQUENCE "__UNDEF__" # ...)): ; Converted BLURP. ; Compiling DEFUN BLURP: ; Compiling Load Time Value of (CREATE-SCANNER '(:SEQUENCE #)): ; Converted FLURP. ; Compiling DEFUN FLURP:
; ; ; File: /home/kick/tmp/scratch.lisp
; In: DEFUN FLURP
; (REGISTER-GROUPS-BIND (DELTA-STR) ('# LINE) (SETQ DELTA #)) ; --> LET MULTIPLE-VALUE-BIND MULTIPLE-VALUE-CALL FUNCTION WHEN COND IF PROGN ; --> LET* LET ; ==> ; (IF #:START-INDEX5 ; (FUNCALL #:SUBSTR-FN6 #:TARGET-STRING0 #:START-INDEX5 #) ; NIL) ; Warning: This is not a (VALUES &OPTIONAL BASE-STRING &REST T): ; NIL ; ; [Last message occurs 2 times]
; Byte Compiling Top-Level Form:
; Compilation unit finished. ; 18 warnings
; /home/kick/tmp/scratch.sparcf written. ; Compilation finished in 0:00:02.
#p"/home/kick/tmp/scratch.sparcf" T T *
I don't understand why only SSMT-OUTPUT-SUMMARY, FOO, and FLURP are the only ones with warnings.
-- Damien Kick
On Fri, 19 Nov 2004 14:05:11 -0600, Kick Damien-DKICK1 DKICK1@motorola.com wrote:
I'm seeing some warnings from CMUCL that I don't understand. Here is the warning the simplest code I've written at the moment that produces the warning:
(defun flurp (line) (let (delta) (register-groups-bind (delta-str) ('(:sequence (:register (:greedy-repetition 1 nil :digit-class))) line) (setq delta (parse-integer delta-str)))))
and the warning:
; In: DEFUN FLURP
; (REGISTER-GROUPS-BIND (DELTA-STR) ('# LINE) (SETQ DELTA #)) ; --> LET MULTIPLE-VALUE-BIND MULTIPLE-VALUE-CALL FUNCTION WHEN COND IF PROGN ; --> LET* LET ; ==> ; (IF #:START-INDEX5 ; (FUNCALL #:SUBSTR-FN6 #:TARGET-STRING0 #:START-INDEX5 #) ; NIL) ; Warning: This is not a (VALUES &OPTIONAL BASE-STRING &REST T): ; NIL ; ; [Last message occurs 2 times]
CMUCL is clever, it knows that the first argument to PARSE-INTEGER must be a string but in your function FLURP it is possible that DELTA-STR is NIL (if there's no match). Thus the warning.
The form you're seeing in the warning is part of the macro expansion of REGISTER-GROUPS-BINDS, it's the part where DELTA-STR is finally computed.
Does that help?
Cheers, Edi.
cl-ppcre-devel@common-lisp.net