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)
Mon, Dec 9, 11:09 AM
Unknown Object (File)
Sat, Dec 7, 11:09 AM
Unknown Object (File)
Thu, Nov 28, 11:25 AM
Unknown Object (File)
Thu, Nov 28, 11:24 AM
Unknown Object (File)
Thu, Nov 28, 11:24 AM
Unknown Object (File)
Thu, Nov 28, 11:24 AM
Unknown Object (File)
Thu, Nov 28, 11:06 AM
Unknown Object (File)
Mon, Nov 25, 1:58 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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 34710
Build 31768: 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.