Bug 713800

Summary: gcc -C broken by libstdc++-devel header file
Product: [Fedora] Fedora Reporter: Neal Becker <ndbecker2>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: jakub, krtkr
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gcc-4.6.1-8.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-09 17:10:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Neal Becker 2011-06-16 14:53:58 UTC
Description of problem:

-C flag cannot be used with gcc because of header file
gthr-default.h

It contains:

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.  */

But __gthrw_ is a macro, so with -C flag, token pasting fails

---- hello.cc
#include <iostream>
-----

 /usr/bin/gcc  -C     -o stuff hello.cc 
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/x86_64-redhat-linux/bits/gthr.h:162:0,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/ext/atomicity.h:34,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/bits/ios_base.h:41,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/ios:43,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/ostream:40,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/iostream:40,
                 from hello.cc:1:
/usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/x86_64-redhat-linux/bits/gthr-default.h:251: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

Version-Release number of selected component (if applicable):

libstdc++-devel-4.6.0-9.fc15.x86_64

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Kirill 2011-07-01 12:34:30 UTC
Hi Neal!

(In reply to comment #0)
> /usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/x86_64-redhat-linux/bits/gthr-default.h:251: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
> 


I had similar problem compiling marss using scons. The quick fix was to move the comment '/* Android .... */' in 'gthr-default.h:244' outside of '__gthrw_(..)' arguments like this:

static inline int
__gthread_active_p (void)
{
/* Android's C library does not provide pthread_cancel, check for `pthread_create' instead.  */
  static void *const __gthread_active_ptr
    = __extension__ (void *) &__gthrw_(
#ifndef __BIONIC__
                                       pthread_cancel
#else
                                       pthread_create
#endif
                                       );
  return __gthread_active_ptr != 0;
}

This fixed the problem. If you need, I can make a patch.

Comment 2 Neal Becker 2011-07-01 12:42:14 UTC
Thanks.  I know how to fix it myself - I want it fixed upstream.

Comment 3 Fedora Update System 2011-08-24 11:12:15 UTC
gcc-4.6.1-8.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/gcc-4.6.1-8.fc16

Comment 4 Fedora Update System 2011-08-24 22:48:02 UTC
Package gcc-4.6.1-8.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing gcc-4.6.1-8.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/gcc-4.6.1-8.fc16
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2011-09-09 17:10:25 UTC
gcc-4.6.1-8.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.