* libc/sys/rtems/sys/queue.h: Delete file.
* libc/include/sys/cdefs.h (__containerof): New define. (__DEQUALIFY): Likewise. * libc/include/sys/queue.h (TRACEBUF_INITIALIZER): Likewise. (TRACEBUF): Likewise. (LIST_FOREACH_SAFE): Likewise. (LIST_PREV): Likewise. (LIST_SWAP): Likewise. (QMD_LIST_CHECK_HEAD): Likewise. (QMD_LIST_CHECK_NEXT): Likewise. (QMD_LIST_CHECK_PREV): Likewise. (QMD_SAVELINK): Likewise. (QMD_TAILQ_CHECK_HEAD): Likewise. (QMD_TAILQ_CHECK_NEXT): Likewise. (QMD_TAILQ_CHECK_PREV): Likewise. (QMD_TAILQ_CHECK_TAIL): Likewise. (QMD_TRACE_ELEM): Likewise. (QMD_TRACE_HEAD): Likewise. (SLIST_FOREACH_PREVPTR): Likewise. (SLIST_FOREACH_SAFE): Likewise. (SLIST_REMOVE_AFTER): Likewise. (SLIST_SWAP): Likewise. (STAILQ_FOREACH_SAFE): Likewise. (STAILQ_REMOVE_AFTER): Likewise. (STAILQ_SWAP): Likewise. (TAILQ_FOREACH_REVERSE_SAFE): Likewise. (TAILQ_FOREACH_SAFE): Likewise. (TAILQ_SWAP): Likewise. (TRASHIT): Likewise. (SLIST_REMOVE): Use SLIST_REMOVE_AFTER(). (STAILQ_LAST): Use __containerof(). (STAILQ_REMOVE): Use STAILQ_REMOVE_AFTER().
This commit is contained in:
@ -44,6 +44,10 @@
|
||||
#ifndef _SYS_CDEFS_H
|
||||
#define _SYS_CDEFS_H
|
||||
|
||||
#include <sys/features.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define __FBSDID(x) /* nothing */
|
||||
/*
|
||||
* Note: the goal here is not compatibility to K&R C. Since we know that we
|
||||
@ -101,6 +105,26 @@
|
||||
# define __ptrvalue /* nothing */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Given the pointer x to the member m of the struct s, return
|
||||
* a pointer to the containing structure. When using GCC, we first
|
||||
* assign pointer x to a local variable, to check that its type is
|
||||
* compatible with member m.
|
||||
*/
|
||||
#if __GNUC_PREREQ(3, 1)
|
||||
#define __containerof(x, s, m) ({ \
|
||||
const volatile __typeof__(((s *)0)->m) *__x = (x); \
|
||||
__DEQUALIFY(s *, (const volatile char *)__x - offsetof(s, m));\
|
||||
})
|
||||
#else
|
||||
#define __containerof(x, s, m) \
|
||||
__DEQUALIFY(s *, (const volatile char *)(x) - offsetof(s, m))
|
||||
#endif
|
||||
|
||||
#ifndef __DEQUALIFY
|
||||
#define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var))
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define __strong_reference(sym,aliassym) \
|
||||
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
|
||||
|
Reference in New Issue
Block a user