Skip to content

framwork: fix dlist_remove/slist_next util functions declaration

Darryl Green requested to merge github/fork/etienne-lms/list-fixes into master

Created by: etienne-lms

When building with GCC 12.2, I faced the below warning messages:

    framework/src/fwk_dlist.c: In function ‘__fwk_dlist_remove’:
    framework/src/fwk_dlist.c:76:12: warning: ‘list’ may be used uninitialized [-Wmaybe-uninitialized]
       76 |     assert(__fwk_slist_contains(
          |            ^~~~~~~~~~~~~~~~~~~~
    framework/src/fwk_dlist.c:67:23: note: accessing argument 1 of a function declared with attribute ‘access (none, 1)’
       67 |     struct fwk_dlist *list,
          |     ~~~~~~~~~~~~~~~~~~^~~~
    (...)
    framework/src/fwk_slist.c: In function ‘__fwk_slist_next’:
    framework/src/fwk_slist.c:111:16: warning: ‘list’ may be used uninitialized [-Wmaybe-uninitialized]
      111 |     fwk_assert(__fwk_slist_contains(list, node));
          |                ^~~~~~~~~~~~~~~~~~~~
    framework/src/fwk_slist.c:105:29: note: accessing argument 1 of a function declared with attribute ‘access (none, 1)’
      105 |     const struct fwk_slist *list,
          |     ~~~~~~~~~~~~~~~~~~~~~~~~^~~~

I think this comes from a wrong declaration for __fwk_slist_next() and __fwk_dlist_remove() as their first argument list is accessed by asserted __fwk_slist_contains() call when building in debug mode.

Merge request reports