Page MenuHomeFreeBSD

qeueue.h: Add {SLIST,STAILQ,LIST,TAILQ}_END()
ClosedPublic

Authored by arichardson on Nov 9 2020, 6:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 3:44 PM
Unknown Object (File)
Oct 19 2024, 12:29 AM
Unknown Object (File)
Oct 1 2024, 5:04 PM
Unknown Object (File)
Oct 1 2024, 3:35 PM
Unknown Object (File)
Oct 1 2024, 2:58 PM
Unknown Object (File)
Oct 1 2024, 2:12 PM
Unknown Object (File)
Sep 29 2024, 3:33 PM
Unknown Object (File)
Sep 26 2024, 4:36 PM
Subscribers
None

Details

Summary

This fixes the following warning (which should arguable be an error since
it results in a function call to an undefined function):

> usr.sbin/ntp/libntpevent (all)

.../contrib/libevent/buffer.c:495:16: warning: implicit declaration of function 'LIST_END' is invalid in C99 [-Wimplicit-function-declaration]

cbent != LIST_END(&buffer->callbacks);
         ^

.../contrib/libevent/buffer.c:495:13: warning: comparison between pointer and integer ('struct evbuffer_cb_entry *' and 'int') [-Wpointer-integer-compare]

cbent != LIST_END(&buffer->callbacks);
~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test Plan

Compiles and boots (RISCV64)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 36349
Build 33238: arc lint + arc unit

Event Timeline

arichardson created this revision.

Should queue(3) also be updated?

sys/sys/queue.h
93

Should perhaps add an _END entry into this table?

In D27151#631501, @jhb wrote:

Should queue(3) also be updated?

The manpage uses NULL directly in examples. I'm not sure it makes sense to document _END there since it only exists for compatibility with other queue.h headers.

I think I had patched libevent in ntp at one point to fix the #ifdef's so it would define the right macro locally. :)

I do find the END macros made more sense with something like CIRCLEQ, but not with the lists, so having it be obscure is fine by me. I would perhaps alter the commit log to reflect this though by saying that we are providing these for compat with other queue.h headers since some software assumes it exists, but we are not encouraging their use. You can then mention the embedded libevent as an example of the software that assumes their existence.

This revision is now accepted and ready to land.Jan 21 2021, 6:28 PM
In D27151#632456, @jhb wrote:

I think I had patched libevent in ntp at one point to fix the #ifdef's so it would define the right macro locally. :)

I do find the END macros made more sense with something like CIRCLEQ, but not with the lists, so having it be obscure is fine by me. I would perhaps alter the commit log to reflect this though by saying that we are providing these for compat with other queue.h headers since some software assumes it exists, but we are not encouraging their use. You can then mention the embedded libevent as an example of the software that assumes their existence.

Sounds good, I'll make sure to update the commit message.