Bug 200442 - new version of sys/queue.h has missing trailing semi colons in macros
Summary: new version of sys/queue.h has missing trailing semi colons in macros
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-27 18:06 UTC by Paul Wouters
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2006-07-30 18:20:42 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Paul Wouters 2006-07-27 18:06:08 UTC
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 18:20:42 UTC
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.