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)
Thu, Apr 18, 3:25 PM
Unknown Object (File)
Tue, Apr 16, 12:11 PM
Unknown Object (File)
Mar 15 2024, 8:18 AM
Unknown Object (File)
Feb 20 2024, 5:31 PM
Unknown Object (File)
Dec 20 2023, 1:18 AM
Unknown Object (File)
Dec 14 2023, 10:43 PM
Unknown Object (File)
Nov 14 2023, 4:03 PM
Unknown Object (File)
Nov 14 2023, 11:57 AM
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.