Declarations for non-existent variable and function bindings are silently ignored (except for IGNORE and IGNORABLE)

Bug #721951 reported by Jean-Philippe Paradis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Triaged
Wishlist
Unassigned

Bug Description

What I do:
(locally (declare (ftype function non-existent-function)))
(locally (declare (inline non-existent-function)))
(locally (declare (notinline non-existent-function)))
(locally (declare (special non-existent-variable)))
(locally (declare (type integer non-existent-variable)))

What happens:
In all these cases, no warning of any kind is signaled.

What I expected to happen:
I think a STYLE-WARNING might be appropriate in some or all of these cases.

I'm not really a "declarations expert" and there might be good reasons why no warning is signaled in these cases. In particular, I wouldn't be surprised if tons of code produce such "dead" but otherwise benign declarations. Producing such code may or may not reflect sloppy handling of declarations (and so may or may not merit a STYLE-WARNING), I'm not experienced enough to tell. Maybe eliminating such declarations is seen as too cumbersome for not enough benefit?...

SBCL version: 1.0.42
uname -a: Linux dynamorph 2.6.32-27-generic #49-Ubuntu SMP Wed Dec 1 23:52:12 UTC 2010 i686 GNU/Linux

*features*:
(:SWANK :QUICKLISP :SB-BSD-SOCKETS-ADDRINFO :ASDF2 :ASDF :ANSI-CL :COMMON-LISP
 :SBCL :SB-DOC :SB-TEST :SB-LDB :SB-PACKAGE-LOCKS :SB-UNICODE :SB-EVAL
 :SB-SOURCE-LOCATIONS :IEEE-FLOATING-POINT :X86 :UNIX :ELF :LINUX :SB-THREAD
 :LARGEFILE :GENCGC :STACK-GROWS-DOWNWARD-NOT-UPWARD :C-STACK-IS-CONTROL-STACK
 :COMPARE-AND-SWAP-VOPS :UNWIND-TO-FRAME-AND-CALL-VOP :RAW-INSTANCE-INIT-VOPS
 :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-VECTORS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-FIXED-OBJECTS :ALIEN-CALLBACKS
 :CYCLE-COUNTER :INLINE-CONSTANTS :MEMORY-BARRIER-VOPS :LINKAGE-TABLE
 :OS-PROVIDES-DLOPEN :OS-PROVIDES-PUTWC :OS-PROVIDES-SUSECONDS-T)

Revision history for this message
Jean-Philippe Paradis (hexstream) wrote :

I forgot to mention that (locally (declare (ignore non-existent-variable))) (and ignorable) exhibit exactly the behavior I'd expect:

"STYLE-WARNING: declaring unknown variable NON-EXISTENT-VARIABLE to be ignored"

Changed in sbcl:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Douglas Katzman (dougk) wrote :

The 'special' declaration is making a free declarations and should not warn.
The others seem to be producing warnings now.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.