mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 12:20:26 +02:00
Add -Wshadowed-toplevel.
* module/language/tree-il/analyze.scm (shadowed-toplevel-analysis): New variable. * module/language/tree-il/compile-cps.scm (%warning-passes): Add it. * module/system/base/message.scm (%warning-types): Add it. * test-suite/tests/tree-il.test ("warnings")["shadowed-toplevel"]: New test prefix. * module/ice-9/boot-9.scm (%auto-compilation-options): Add it. * doc/ref/api-evaluation.texi (Compilation): Add 'shadowed-toplevel' and 'macro-use-before-definition'.
This commit is contained in:
parent
741c45458d
commit
bdcd0ba8a7
6 changed files with 131 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
;;; User interface messages
|
||||
|
||||
;; Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009, 2010, 2011, 2012, 2018 Free Software Foundation, Inc.
|
||||
|
||||
;;; This library is free software; you can redistribute it and/or
|
||||
;;; modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -109,6 +109,13 @@
|
|||
(emit port "~A: warning: possibly unused local top-level variable `~A'~%"
|
||||
loc name)))
|
||||
|
||||
(shadowed-toplevel
|
||||
"report shadowed top-level variables"
|
||||
,(lambda (port loc name previous-loc)
|
||||
(emit port "~A: warning: shadows previous definition of `~A' at ~A~%"
|
||||
loc name
|
||||
(location-string previous-loc))))
|
||||
|
||||
(unbound-variable
|
||||
"report possibly unbound variables"
|
||||
,(lambda (port loc name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue