Hi!

echo '#include <iostream>' | ./g++ -E -C -xc++ - -o /tmp/i.ii
In file included from 
/usr/src/gcc/obj771i/usr/local/bin/../lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/i686-pc-linux-gnu/bits/gthr.h:160:0,
                 from 
/usr/src/gcc/obj771i/usr/local/bin/../lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ext/atomicity.h:34,
                 from 
/usr/src/gcc/obj771i/usr/local/bin/../lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/ios_base.h:41,
                 from 
/usr/src/gcc/obj771i/usr/local/bin/../lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ios:43,
                 from 
/usr/src/gcc/obj771i/usr/local/bin/../lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ostream:40,
                 from 
/usr/src/gcc/obj771i/usr/local/bin/../lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/iostream:40,
                 from <stdin>:1:
/usr/src/gcc/obj771i/usr/local/bin/../lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/i686-pc-linux-gnu/bits/gthr-default.h:256:1:
error: pasting "__gthrw_" and "/* Android's C library does not provide
/ pthread_cancel, check for
   `pthread_create' instead.  */" does not give a valid preprocessing token

The following patch fixes it by avoiding the preprocessor conditionals
and comments inside of __gthrw_ macro arguments which then wants to
do token pasting with it.
Ok for trunk?

2011-08-04  Jakub Jelinek  <ja...@redhat.com>

        * gthr-posix.h (__gthread_active_p): Do not use preprocessor
        conditionals and comments inside macro arguments.

--- gcc/gthr-posix.h.jj 2011-07-18 13:17:56.000000000 +0200
+++ gcc/gthr-posix.h    2011-08-04 11:22:40.000000000 +0200
@@ -244,16 +244,15 @@ __gthread_active_p (void)
 static inline int
 __gthread_active_p (void)
 {
-  static void *const __gthread_active_ptr
-    = __extension__ (void *) &__gthrw_(
 /* Android's C library does not provide pthread_cancel, check for
    `pthread_create' instead.  */
 #ifndef __BIONIC__
-                                      pthread_cancel
+  static void *const __gthread_active_ptr
+    = __extension__ (void *) &__gthrw_(pthread_cancel);
 #else
-                                      pthread_create
+  static void *const __gthread_active_ptr
+    = __extension__ (void *) &__gthrw_(pthread_create);
 #endif
-                                      );
   return __gthread_active_ptr != 0;
 }
 


        Jakub

Reply via email to