From 167b3b484c419810dee2e39dfc113e27e60a4858 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 3 May 2017 21:13:07 +0200 Subject: [PATCH 3/3] Show the location in some more error messages. --- core.scm | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/core.scm b/core.scm index bba0dd44..83fdd681 100644 --- a/core.scm +++ b/core.scm @@ -1071,7 +1071,8 @@ (val (caddr x))) (when (memq var unlikely-variables) (warning - (sprintf "assignment to variable `~s' possibly unintended" + (sprintf "~aassignment to variable `~s' possibly unintended" + (if ln (sprintf "(~a) - " ln) "") var))) (cond ((assq var foreign-variables) => (lambda (fv) @@ -1108,15 +1109,21 @@ ,var)))) (cond ((##sys#macro? var) (warning - (sprintf "assigned global variable `~S' is syntax ~A" - var - (if ln (sprintf "(~a)" ln) ""))) + (sprintf "~aassigned global variable `~S' is syntax" + (if ln (sprintf "(~a) - " ln) "") + var)) (when undefine-shadowed-macros (##sys#undefine-macro! var))) ((and ##sys#notices-enabled (assq var (##sys#current-environment))) - (##sys#notice "assignment to imported value binding" var))) + (##sys#notice + (sprintf "~aassignment to imported value binding `~S'" + (if ln (sprintf "(~a) - " ln) "") + var)))) (when (keyword? var) - (warning (sprintf "assignment to keyword `~S'" var))) + (warning + (sprintf "~aassignment to keyword `~S'" + (if ln (sprintf "(~a) - " ln) "") + var))) `(set! ,var ,(walk val e se var0 (memq var e) h ln #f)))))) ((##core#debug-event) @@ -1307,8 +1314,9 @@ (mark-variable var '##compiler#always-bound) (walk `(define ,var (##core#quote ,val)) e se #f #f h ln tl?))) (else - (quit-compiling "invalid compile-time value for named constant `~S'" - name))))) + (quit-compiling "~ainvalid compile-time value for named constant `~S'" + (if ln (sprintf "(~a) - " ln) "") + name))))) ((##core#declare) (walk @@ -1332,8 +1340,10 @@ (if (valid-c-identifier? raw-c-name) (set! callback-names (cons (cons raw-c-name name) callback-names)) - (quit-compiling "name `~S' of external definition is not a valid C identifier" - raw-c-name) ) + (let ((ln (get-line x))) + (quit-compiling "~aname `~S' of external definition is not a valid C identifier" + (if ln (sprintf "(~a) - " ln) "") + raw-c-name))) (when (or (not (list? vars)) (not (list? atypes)) (not (= (length vars) (length atypes))) ) -- 2.12.2