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 $>
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?
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.
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>