Bug 200442 - new version of sys/queue.h has missing trailing semi colons in macros
new version of sys/queue.h has missing trailing semi colons in macros
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2006-07-27 14:06 EDT by Paul Wouters
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-07-30 14:20:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Paul Wouters 2006-07-27 14:06:08 EDT
Description of problem:

between glibc-2.4-4 and 2.4-8 a new version of sys/queue.h (version 8.5)
was introduced. It adds a while loop around various macros, such as:

#define LIST_INSERT_HEAD(head, elm, field) do {                         \
        if (((elm)->field.le_next = (head)->lh_first) != NULL)          \
                (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
        (head)->lh_first = (elm);                                       \
        (elm)->field.le_prev = &(head)->lh_first;                       \
} while (/*CONSTCOND*/0)

These macros used to expand including a trailing ";" from the if statement,
but now expand with the while loop without a trailing ";", causing macro calls
to these functions that are not closed with a ";" to fail.
Openswan had one such call to LIST_INSERT_HEAD. 

As a workaround we added a trailing ";" in our code, but I think this should
really be fixed in queue.h
Comment 1 Ulrich Drepper 2006-07-30 14:20:42 EDT
But this is how the "upstream" version behaves.  Any code omitting the semicolon
won't be compatible with other versions of sys/queue.h.  So, it's a one-time
effort to fix up the code.  Beside, the missing semicolon would also prevent all
auto-indenting tools (e.g., emacs) from working correctly.

Note You need to log in before you can comment on or make changes to this bug.