Bug 200442

Summary: new version of sys/queue.h has missing trailing semi colons in macros
Product: [Fedora] Fedora Reporter: Paul Wouters <paul>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: paul
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-07-30 18:20:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.