Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 273689 - sys-devel/gcc: does not compile pthread_cleanup_* macros with -Wempty-body -Werror
Summary: sys-devel/gcc: does not compile pthread_cleanup_* macros with -Wempty-body -W...
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-11 09:13 UTC by Clex.
Modified: 2009-07-05 19:29 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Clex. 2009-06-11 09:13:50 UTC
pthread_cleanup_push() and pthread_cleanup_pop() macros do not compile with -Wempty-body GCC flag.

GCC does not like `do; while (0);`.


Reproducible: Always

Steps to Reproduce:
$> cat test.c
#include <pthread.h>

int main(void)
{
    pthread_cleanup_push(NULL, NULL);
    pthread_cleanup_pop(0);
    return 0;
}
$> gcc -Wempty-body test.c -lpthread
test.c: In function 'main':
test.c:6: warning: suggest braces around empty body in 'do' statement
$>
Comment 1 Sebastian Luther (few) 2009-06-11 09:41:09 UTC
What do you mean with "does not compile"? This flag enables a warning and shouldn't change the resulting binary (and it doesn't with gcc-4.3.2) (or prevent it from being created, unless -Werror is used). And isn't this "do; while (0);" construct useless anyways?
Comment 2 Clex. 2009-06-11 09:45:30 UTC
It does not compile with -Werror :)

Sure that `do; while (0);` is useless, but I didn't code it. I just would like use pthread_cleanup_* macros with -Wempty-body without that warning.
Comment 3 SpanKY gentoo-dev 2009-07-05 19:29:47 UTC
you didnt post `emerge --info` like the bug documentation states and glibc-2.10 works just fine for me

$ cat test.c
#include <pthread.h>

int main(void)
{
    pthread_cleanup_push(NULL, NULL);
    pthread_cleanup_pop(0);
    return 0;
}

$ gcc-4.3.2 -c test.c -Wall -Wempty-body -Werror
<no output at all>