-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CFFI is warning of deprecated useage of bare references to struct types #6
Comments
I analysed the problem and found it to be twofold: CFFI-UFFI-COMPAT does not provision for passing struct and struct pointer parameters correctly, and CL-GD does not try to either. I attempted to fix the problem in CFFI (https://github.com/edicl/cffi) and also (https://github.com/edicl/cl-gd/tree/cffi-uffi-warning) but I was not able to completely get it right. I may get back to this at some point, but for now, I'm leaving it to be fixed when it really causes issues other than the warning. |
Thanks for putting some work into this on CFFI-UFFI-COMPAT. I have been running clsql with this package and am suddenly getting tons of style-warnings (after a quicklisp upgrade). This is how I resolved the issue: cffi/cffi#35 |
On 02/08/2014 11:34 PM, Hans Hübner wrote:
Is there any chance your changes have broken hunchentoot? I just did a 215,969 bytes in 0.17 seconds (1205.18KB/sec) ; (SETF (CL+SSL::SLOT 'CL+SSL::NAME) (CFFI:FOREIGN-STRING-ALLOC "lisp")) ; (SETF (CL+SSL::SLOT 'CL+SSL::BWRITE) (CFFI:CALLBACK ; (SETF (CL+SSL::SLOT 'CL+SSL::BREAD) (CFFI:CALLBACK CL+SSL::LISP-READ)) ; (SETF (CL+SSL::SLOT 'CL+SSL::BPUTS) (CFFI:CALLBACK CL+SSL::LISP-PUTS)) ; (SETF (CL+SSL::SLOT 'CL+SSL::BGETS) (CFFI-SYS:NULL-POINTER)) ; (SETF (CL+SSL::SLOT 'CL+SSL::CTRL) (CFFI:CALLBACK CL+SSL::LISP-CTRL)) ; (SETF (CL+SSL::SLOT 'CL+SSL::CREATE) (CFFI:CALLBACK ; (SETF (CL+SSL::SLOT 'CL+SSL::DESTROY) (CFFI:CALLBACK ; (SETF (CL+SSL::SLOT 'CL+SSL::CALLBACK-CTRL) (CFFI-SYS:NULL-POINTER)) ; (CFFI:FOREIGN-ALLOC '(:STRUCT CL+SSL::BIO-METHOD)) ; in: DEFUN CLEAR-RETRY-FLAGS Regards, |
I'm getting 100s/1000s of these warnings as well using gtk. It would be nice if I could fix it, work around, or suppress the warnings as they potentially hide other important output. STYLE-WARNING: STYLE-WARNING: |
I've created a pull-request for CFFI which simply suppresses the style warning. |
These warnings were produced at runtime in potentially very large quantities. An example warning: WARNING: bare references to struct types are deprecated. Please use (:POINTER (:STRUCT XCB:XCB-CHARINFO-T)) or (:STRUCT XCB:XCB-CHARINFO-T) instead. Not all call sites of map-result-list were changed; for the ones left intact, I believe the calls are made with a non-struct type. Some references to the same issue elsewhere on GitHub: - edicl/cl-gd#6 - cffi/cffi#61
This error message showing up in several projects I maintain which employ cl-gd:
;; STYLE-WARNING:
;; bare references to struct types are deprecated. Please use (:POINTER (:STRUCT CL-GD::GD-IMAGE))
;; or (:STRUCT CL-GD::GD-IMAGE) instead.
I've put together a simple case which exhibits the behavior. It seems to be the WITH-THICKNESS macro causing the warning in this case:
(ql:quickload "cl-gd")
(use-package :cl-gd)
(let* ((x1 -86)
(x2 529)
(y1 -0.13)
(y2 1.16)
(xv '(0.0 1.0 2.0 3.0 4.0))
(yv '(0.99 0.12 0.66 0.24 0.075)))
(with-image* (500 250)
(allocate-color 255 255 255)
(let ((c (allocate-color 0 0 255)))
(with-transformation (:x1 x1 :x2 x2 :y1 y1 :y2 y2)
(with-thickness (1)
(mapl #'(lambda (x y)
(when (and (cdr x) (cdr y))
(draw-line (car x) (car y) (cadr x) (cadr y) :color c))) xv yv))
(write-image-to-file "test.png" :if-exists :supersede)))))
If you take out the with-thickness macro call the message disappears.
I posted this to both the cl-gd-devel and cffi-devel lists. Liam Healy from the latter sent this response:
"It's harmless, it's just telling you that the syntax that cl-gd uses for structure arguments will eventually (in a future version of CFFI) not work. The messages describes the problem. The structure is specified as cl-gd::gd-image in a function argument or return value. In the old versions of CFFI, that was interpreted as a pointer to that structure, because there was no other possibility. Now structures can also be passed/returned by value using cffi-libffi, so you have to say explicitly as the error message indicates. They might also need to change the use of #'mem-aref (which before returned a pointer to the structure but now returns the structure itself) into a #'mem-aptr."
Much obliged.
--Jeff Cunningham
The text was updated successfully, but these errors were encountered: