From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020513 Description of problem: pthread.h as shipped with glibc-devel-2.2.5-40 has an obvious bug: #define pthread_cleanup_push(routine,arg) \ { struct _pthread_cleanup_buffer _buffer; \ _pthread_cleanup_push (&_buffer, (routine), (arg)); does not contain a closing brace, which causes compilation of any program attempting to use pthread_cleanup_push() to fail. Version-Release number of selected component (if applicable): glibc-devel-2.2.5-40 How reproducible: Always Steps to Reproduce: /* foo.c */ #include <stdio.h> #include <pthread.h> void my_cleanup(void *arg) { printf("cleaning up %p\n",arg); } void register_cleaner(void *arg) { pthread_cleanup_push(my_cleanup,arg); } Actual Results: $ gcc -c foo.c foo.c: In function `register_cleaner': foo.c:13: parse error at end of input Additional info: I have not checked whether this exists in the latest glibc-2.3.1.
That's on purpose, see comment above it: pthread_cleanup_push and pthread_cleanup_pop are macros and must always be used in matching pairs at the same nesting level of braces or info libc: Matching pairs of `pthread_cleanup_push' and `pthread_cleanup_pop' must occur in the same function, at the same level of block nesting. Actually, `pthread_cleanup_push' and `pthread_cleanup_pop' are macros, and the expansion of `pthread_cleanup_push' introduces an open brace `{' with the matching closing brace `}' being introduced by the expansion of the matching `pthread_cleanup_pop'.
Indeed. My mistake. Had to RTFM. Sorry.