Skip to content

libdill/fd.c uses dill_ctx_fd without guarding it with DILL_SOCKETS #235

@sleeptightAnsiC

Description

@sleeptightAnsiC

Hi,

I attempted to compile libdill without build system
(just cc every source file and link it by hand)
and found out that compilation of libdill/fd.c fails due to:

$ cc fd.c -o fd.o -c ; cc --version ; uname -srm
fd.c: In function ‘dill_fd_allocbuf’:
fd.c:59:43: error: ‘struct dill_ctx’ has no member named ‘fd’
   59 |     struct dill_ctx_fd *ctx = &dill_getctx->fd;
      |                                           ^~
fd.c: In function ‘dill_fd_freebuf’:
fd.c:71:43: error: ‘struct dill_ctx’ has no member named ‘fd’
   71 |     struct dill_ctx_fd *ctx = &dill_getctx->fd;
      |                                           ^~
cc (GCC) 14.2.1 20240910
Linux 6.12.8-arch1-1 x86_64

It's because struct dill_ctx_fd is defined conditionally here:

libdill/ctx.h

Lines 40 to 42 in 32d0e8b

#if defined DILL_SOCKETS
struct dill_ctx_fd fd;
#endif

but its usage in libdill/fd.c is NOT guarder by DILL_SOCKETS

This is of course easy to workaround with $ cc fd.c -c -DDILL_SOCKETS
but I fought it would be nice to report since it's the only issue (with #234 )
preventing libdill from being compiled without it's build system.

For comparison, there is a similar macro DILL_THREADS
which does not need to be defined in order to compile libdill.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions