Skip to content

Clang warnings during complilation of 2.3.0-rc2 with 6.11.3 #16660

Closed
@kentdobias

Description

@kentdobias

System information

Type Version/Name
Distribution Name Arch Linux
Distribution Version
Kernel Version 6.11.3
Architecture x86_64
OpenZFS Version 2.3.0-rc2

Describe the problem you're observing

When building the linux kernel using clang and with zfs bult-in, there are many warnings relating to type redefinitions and casts. These don't cause build errors, everything functions fine, but kernel builds are best when they are quiet.

Include any warning/errors/backtraces from the system logs

These patterns of type redefinition involving kstat_t and abd_t appear in many files, one example:

In file included from fs/zfs/zfs/dmu_object.c:27:
In file included from ./include/zfs/sys/dbuf.h:31:
In file included from ./include/zfs/sys/dmu.h:46:
In file included from ./include/zfs/sys/zfs_context.h:64:
./include/zfs/os/linux/spl/sys/kstat.h:82:24: warning: redefinition of typedef 'kstat_t' is a C11 feature [-Wtypedef-redefinition]
   82 | typedef struct kstat_s kstat_t;
      |                        ^
./include/zfs/os/linux/spl/sys/taskq.h:42:24: note: previous definition is here
   42 | typedef struct kstat_s kstat_t;
      |                        ^
In file included from fs/zfs/zfs/dmu_object.c:27:
In file included from ./include/zfs/sys/dbuf.h:31:
In file included from ./include/zfs/sys/dmu.h:50:
In file included from ./include/zfs/sys/zio_compress.h:34:
./include/zfs/sys/abd.h:68:3: warning: redefinition of typedef 'abd_t' is a C11 feature [-Wtypedef-redefinition]
   68 | } abd_t;
      |   ^
./include/zfs/os/linux/zfs/sys/abd_os.h:44:20: note: previous definition is here
   44 | typedef struct abd abd_t;
      |                    ^

This pattern of casting appears in many files, one example:

fs/zfs/zfs/spa.c:9200:27: warning: cast from 'void (*)(void *) __attribute__((noreturn))' to 'thread_func_t' (aka 'void (*)(void *)') converts to incompatible function type [-Wcast-function-type-strict]
 9200 |                 spa->spa_async_thread = thread_create(NULL, 0,
      |                                         ^~~~~~~~~~~~~~~~~~~~~~
 9201 |                     spa_async_thread, spa, 0, &p0, TS_RUN, maxclsyspri);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/zfs/os/linux/spl/sys/thread.h:53:32: note: expanded from macro 'thread_create'
   53 |         __thread_create(stk, stksize, (thread_func_t)func, #func,       \
      |                                       ^~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DefectIncorrect behavior (e.g. crash, hang)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions