containers / composefs

The reliability of disk images, the flexibility of files
Other
462 stars 37 forks source link

Build failure with Clang 18 #364

Closed ziyao233 closed 2 months ago

ziyao233 commented 2 months ago

Building with clang 18, with following steps on master,

meson setup . build
meson compile -C build

results in error like

../libcomposefs/lcfs-fsverity.h:20:32: warning: redefinition of typedef 'FsVerityContext' is a C11 feature [-Wtypedef-redefinition]
   20 | typedef struct FsVerityContext FsVerityContext;
      |                                ^
../libcomposefs/lcfs-internal.h:33:10: note: '../libcomposefs/lcfs-fsverity.h' included multiple times, additional include site here
   33 | #include "lcfs-fsverity.h"
      |          ^
../libcomposefs/lcfs-writer-erofs.c:24:10: note: '../libcomposefs/lcfs-fsverity.h' included multiple times, additional include site here
   24 | #include "lcfs-fsverity.h"
      |          ^
../libcomposefs/lcfs-fsverity.h:20:32: note: unguarded header; consider using #ifdef guards or #pragma once
   20 | typedef struct FsVerityContext FsVerityContext;
      |                                ^
../libcomposefs/lcfs-writer-erofs.c:1618:2: error: call to undeclared function 'static_assert'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
 1618 |         static_assert((sizeof(struct erofs_xattr_ibody_header) == LCFS_XATTR_HEADER_SIZE),
      |         ^
1 warning and 1 error generated.

it seems that some C11 features are used, but c_std=c99 is specified in meson.build1, which should be fixed.