Skip to content

Add dummy macros for conditionally defined macros #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions list.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,12 @@ static inline void list_move_tail(struct list_head *node,
for (entry = list_entry((head)->next, typeof(*entry), member); \
&entry->member != (head); \
entry = list_entry(entry->member.next, typeof(*entry), member))
#else
/* The negative width bit-field makes a compile-time error for use of this. It
* works in the same way as BUILD_BUG_ON_ZERO macro of Linux kernel.
*/
#define list_for_each_entry(entry, head, member) \
for (entry = (void *) 1; sizeof(struct { int : -1; }); ++(entry))
#endif

/**
Expand Down Expand Up @@ -450,6 +456,10 @@ static inline void list_move_tail(struct list_head *node,
safe = list_entry(entry->member.next, typeof(*entry), member); \
&entry->member != (head); entry = safe, \
safe = list_entry(safe->member.next, typeof(*entry), member))
#else
#define list_for_each_entry_safe(entry, safe, head, member) \
for (entry = safe = (void *) 1; sizeof(struct { int : -1; }); \
++(entry), ++(safe))
#endif

#undef __LIST_HAVE_TYPEOF
Expand Down
2 changes: 1 addition & 1 deletion scripts/checksums
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
db6784ff3917888db4d1dceaa0570d99ed40e762 queue.h
a35ff719849dbe38d903576a332989c5ba7242bf list.h
27d7a57c6bab59beda9178f240db1aa7c0062361 list.h
3bb0192cee08d165fd597a9f6fbb404533e28fcf scripts/check-commitlog.sh
Loading