Skip to content
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

[DRAFT] libguile-udev: Replace undocumented SCM_NEWSMOB with scm_new_smob. #7

Conversation

Apteryks
Copy link
Contributor

  • libguile-udev/udev-device-type.c (udev_device_to_scm): Replace SCM_NEWSMOB with scm_new_smob.
  • libguile-udev/udev-hwdb-type.c (udev_hwdb_to_scm): Likewise.
  • libguile-udev/udev-monitor-type.c (gudev_monitor_to_scm): Likewise.
  • libguile-udev/udev-type.c (udev_to_scm, make-udev): Likewise.

This currently causes the following compilation warnings:

udev-device-type.c: In function 'udev_device_to_scm':
udev-device-type.c:71:42: warning: passing argument 2 of 'scm_new_smob' makes integer from pointer without a cast [-Wint-conversion]
   71 |     return scm_new_smob(udev_device_tag, udd);
      |                                          ^~~
      |                                          |
      |                                          gudev_device_t * {aka struct gudev_device *}
In file included from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/threads.h:29,
                 from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/async.h:25,
                 from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile.h:35,
                 from udev-device-type.c:21:
/gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/smob.h:135:41: note: expected 'scm_t_bits' {aka 'long unsigned int'} but argument is of type 'gudev_device_t *' {aka 'struct gudev_device *'}
  135 | scm_new_smob (scm_t_bits tc, scm_t_bits data)
      |                              ~~~~~~~~~~~^~~~
  CC       libguile_udev_la-udev-monitor-main.lo
  CC       libguile_udev_la-udev-monitor-type.lo
  CC       libguile_udev_la-udev-type.lo
  CC       libguile_udev_la-udev-hwdb-type.lo
  CC       libguile_udev_la-udev-hwdb-func.lo
udev-type.c: In function 'udev_to_scm':
udev-type.c:72:35: warning: passing argument 2 of 'scm_new_smob' makes integer from pointer without a cast [-Wint-conversion]
   72 |     return scm_new_smob(udev_tag, ud);
      |                                   ^~
      |                                   |
      |                                   gudev_t * {aka struct gudev *}
In file included from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/threads.h:29,
                 from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/async.h:25,
                 from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile.h:35,
                 from udev-type.c:21:
/gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/smob.h:135:41: note: expected 'scm_t_bits' {aka 'long unsigned int'} but argument is of type 'gudev_t *' {aka 'struct gudev *'}
  135 | scm_new_smob (scm_t_bits tc, scm_t_bits data)
      |                              ~~~~~~~~~~~^~~~
udev-type.c: In function 'udev_make_udev':
udev-type.c:92:35: warning: passing argument 2 of 'scm_new_smob' makes integer from pointer without a cast [-Wint-conversion]
   92 |     return scm_new_smob(udev_tag, ud);
      |                                   ^~
      |                                   |
      |                                   gudev_t * {aka struct gudev *}
In file included from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/threads.h:29,
                 from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/async.h:25,
                 from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile.h:35,
                 from udev-type.c:21:
/gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/smob.h:135:41: note: expected 'scm_t_bits' {aka 'long unsigned int'} but argument is of type 'gudev_t *' {aka 'struct gudev *'}
  135 | scm_new_smob (scm_t_bits tc, scm_t_bits data)
      |                              ~~~~~~~~~~~^~~~
udev-monitor-type.c: In function 'gudev_monitor_to_scm':
udev-monitor-type.c:89:43: warning: passing argument 2 of 'scm_new_smob' makes integer from pointer without a cast [-Wint-conversion]
   89 |     return scm_new_smob(udev_monitor_tag, umd);
      |                                           ^~~
      |                                           |
      |                                           gudev_monitor_t * {aka struct gudev_monitor *}
In file included from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/threads.h:29,
                 from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/async.h:25,
                 from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile.h:35,
                 from udev-monitor-type.c:21:
/gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/smob.h:135:41: note: expected 'scm_t_bits' {aka 'long unsigned int'} but argument is of type 'gudev_monitor_t *' {aka 'struct gudev_monitor *'}
  135 | scm_new_smob (scm_t_bits tc, scm_t_bits data)
      |                              ~~~~~~~~~~~^~~~
  CC       libguile_udev_la-udev-hwdb-main.lo
udev-hwdb-type.c: In function 'udev_hwdb_to_scm':
udev-hwdb-type.c:78:41: warning: passing argument 2 of 'scm_new_smob' makes integer from pointer without a cast [-Wint-conversion]
   78 |      return scm_new_smob(udev_hwdb_tag, uhd);
      |                                         ^~~
      |                                         |
      |                                         gudev_hwdb_t * {aka struct gudev_hwdb *}
In file included from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/threads.h:29,
                 from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/async.h:25,
                 from /gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile.h:35,
                 from common.h:24,
                 from udev-hwdb-type.c:21:
/gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/include/guile/3.0/libguile/smob.h:135:41: note: expected 'scm_t_bits' {aka 'long unsigned int'} but argument is of type 'gudev_hwdb_t *' {aka 'struct gudev_hwdb *'}
  135 | scm_new_smob (scm_t_bits tc, scm_t_bits data)
      |                              ~~~~~~~~~~~^~~~
  CCLD     libguile-udev.la

But otherwise appear to work fine. I don't know which cast to apply to resolve these, hence marking as DRAFT.

* libguile-udev/udev-device-type.c (udev_device_to_scm): Replace SCM_NEWSMOB
with scm_new_smob.
* libguile-udev/udev-hwdb-type.c (udev_hwdb_to_scm): Likewise.
* libguile-udev/udev-monitor-type.c (gudev_monitor_to_scm): Likewise.
* libguile-udev/udev-type.c (udev_to_scm, make-udev): Likewise.
@Apteryks
Copy link
Contributor Author

Hm, looking at how SCM_NEWSMOB is implemented:

#define SCM_NEWSMOB(z, tc, data)                \
  z = scm_new_smob ((tc), (scm_t_bits)(data))

it seems useful to keep using the macro. I guess that NEWS entry was misleading and this won't be deprecated any time soon.

@Apteryks Apteryks closed this Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant