Bug 9868 - use of do; while(0) in pthread.h makes gcc barf
Summary: use of do; while(0) in pthread.h makes gcc barf
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: nptl (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-19 12:06 UTC by Pierre Habouzit
Modified: 2014-07-01 20:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Habouzit 2009-02-19 12:06:05 UTC
When using strict compiling flags, (-Wempty-body that is) the use of
pthread_cleanup_pop generates warnings like:

mcms/mcms-if-file.c:534: error: suggest braces around empty body in 'do'
statement [-Wempty-body]

This is because of the use of `do; while(0)`.
Please use `(void)0;` or `do { } while(0)` instead which won't trigger the same
warning and still allow to place a label before pthread_cleanup_pop which is
what the `do; while(0)` tries to achieve.
Comment 1 Pierre Habouzit 2009-02-19 13:08:15 UTC
Okay, this is actually fixed in the cvs

commit a3e5efd845589c11f93935c0a0b13262b1e912b3