public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/48698] New: gnu-versioned-namespace problems
@ 2011-04-20 10:31 redi at gcc dot gnu.org
  2011-04-20 10:33 ` [Bug libstdc++/48698] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2011-04-20 10:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48698

           Summary: gnu-versioned-namespace problems
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org
                CC: bkoz@gcc.gnu.org


Bootstrap fails with errors like:

/tmp/b/x86_64-unknown-linux-gnu/libstdc++-v3/include/cwchar: In function
'wchar_t* std::_6::wcschr(wchar_t*, wchar_t)':
/tmp/b/x86_64-unknown-linux-gnu/libstdc++-v3/include/cwchar:215:55: error:
invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
/tmp/b/x86_64-unknown-linux-gnu/libstdc++-v3/include/cwchar:214:3: error:  
initializing argument 1 of 'wchar_t* std::_6::wcschr(wchar_t*, wchar_t)'
[-fpermissive]

This is because the using declaration for ::wcschr is not in the versioned
namespace, so name lookup inside the versioned namespace finds the declaration
there and doesn't look in the enclosing namespace.

Fixed by:

--- include/c_global/cwchar     2011-04-20 10:09:58.580607848 +0000
+++ include/c_global/cwchar     2011-04-20 10:11:39.348231280 +0000
@@ -136,6 +136,8 @@

 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
   using ::wint_t;

   using ::btowc;
@@ -207,8 +209,6 @@
   using ::wcsstr;
   using ::wmemchr;

-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
 #ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO
   inline wchar_t*
   wcschr(wchar_t* __p, wchar_t __c)



That allows the bootstrap to finish, but the choice of "_6" as the inline
namespace means we cannot compile this valid program or it's C++0x equivalent:

#include <tr1/functional>

int f(int i);

int g()
{
    std::tr1::bind(f, std::tr1::placeholders::_6);
}

b.cc: In function 'int g()':
b.cc:7:49: error: expected primary-expression before ')' token


The problem is that "std::tr1::placeholders::_6" is a namespace not a bind
placeholder

// Inline namespace for symbol versioning.
#if _GLIBCXX_INLINE_VERSION
namespace std
{
...
  namespace tr1
  {
    ...
    namespace placeholders { inline namespace _6 { } }
    ...
  }
  ...
  namespace placeholders { inline namespace _6 { } }


This won't work, placeholders::_6 is required to be a bind placeholder so can't
be a namespace.

It might be better to use _v6 although that would fail if users say
#define _v6 bleurgh
which is allowed.
The inline namespaces should really use a name resperved for the impl, such as
__6 or __v6


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/48698] gnu-versioned-namespace problems
  2011-04-20 10:31 [Bug libstdc++/48698] New: gnu-versioned-namespace problems redi at gcc dot gnu.org
@ 2011-04-20 10:33 ` redi at gcc dot gnu.org
  2011-09-23  7:27 ` bkoz at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2011-04-20 10:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48698

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-04-20 10:33:23 UTC ---
(In reply to comment #0)
> Bootstrap fails with errors like:

Just to be clear, this is only when configuring with
--enable-symvers=gnu-versioned-namespace


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/48698] gnu-versioned-namespace problems
  2011-04-20 10:31 [Bug libstdc++/48698] New: gnu-versioned-namespace problems redi at gcc dot gnu.org
  2011-04-20 10:33 ` [Bug libstdc++/48698] " redi at gcc dot gnu.org
@ 2011-09-23  7:27 ` bkoz at gcc dot gnu.org
  2011-09-27  0:38 ` bkoz at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bkoz at gcc dot gnu.org @ 2011-09-23  7:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48698

--- Comment #2 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2011-09-23 03:47:55 UTC ---
Created attachment 25346
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25346
patch


You are correct Here's a patch that fixes it.

The real issue is that now, linking libstdc++ is required for stage 1. To solve
the issue of libstdc++ with versioned namespaces being built with this
requirement mandates versioned namespaces changing the SO version to 7.

This patch does this.

However, it is not configurable. Instead, it is hard-wired. I plan on fixing
this in a subsequent patch. This will mean configuring with
--enable-symvers=gnu-namespace triggers libstdc++.so == 7. Thoughts,
suggestions, or comments on this approach?

-benjamin


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/48698] gnu-versioned-namespace problems
  2011-04-20 10:31 [Bug libstdc++/48698] New: gnu-versioned-namespace problems redi at gcc dot gnu.org
  2011-04-20 10:33 ` [Bug libstdc++/48698] " redi at gcc dot gnu.org
  2011-09-23  7:27 ` bkoz at gcc dot gnu.org
@ 2011-09-27  0:38 ` bkoz at gcc dot gnu.org
  2011-10-05 23:10 ` bkoz at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bkoz at gcc dot gnu.org @ 2011-09-27  0:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48698

--- Comment #3 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2011-09-27 00:03:00 UTC ---
Author: bkoz
Date: Tue Sep 27 00:02:54 2011
New Revision: 179221

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179221
Log:
2011-09-26  Benjamin Kosnik  <bkoz@redhat.com
            Jonathan Wakely  <jwakely.gcc@gmail.com>

    PR libstdc++/48698
    * acinclude.m4 (GLIBCXX_ENABLE_SYMVERS): Set libtool_VERSION here.
    * configure.ac: Move AC_SUBST of libtool_VERSION past call to
    GLIBCXX_ENABLE_SYMVERS.
    * configure: Regenerate.
    * include/bits/c++config: Use __7 as versioned namespace name.
    * config/abi/pre/gnu-versioned-namespace.ver: Change mangling as
    per above.
    * include/c_global/cwchar: Adjust nested namespaces.
    * testsuite/20_util/bind/48698.cc: Add test case.
    * testsuite/ext/profile/mutex_extensions_neg.cc: Change line number.

Added:
    trunk/libstdc++-v3/testsuite/20_util/bind/48698.cc
      - copied, changed from r179220,
trunk/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/acinclude.m4
    trunk/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
    trunk/libstdc++-v3/configure
    trunk/libstdc++-v3/configure.ac
    trunk/libstdc++-v3/include/bits/c++config
    trunk/libstdc++-v3/include/c_global/cwchar
    trunk/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/48698] gnu-versioned-namespace problems
  2011-04-20 10:31 [Bug libstdc++/48698] New: gnu-versioned-namespace problems redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-09-27  0:38 ` bkoz at gcc dot gnu.org
@ 2011-10-05 23:10 ` bkoz at gcc dot gnu.org
  2011-10-05 23:12 ` bkoz at gcc dot gnu.org
  2011-10-05 23:13 ` bkoz at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: bkoz at gcc dot gnu.org @ 2011-10-05 23:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48698

--- Comment #4 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2011-10-05 23:10:01 UTC ---
Author: bkoz
Date: Wed Oct  5 23:09:51 2011
New Revision: 179580

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179580
Log:
2011-10-05  Benjamin Kosnik  <bkoz@redhat.com
            Jonathan Wakely  <jwakely.gcc@gmail.com>

        PR libstdc++/48698
        * acinclude.m4 (GLIBCXX_ENABLE_SYMVERS): Set libtool_VERSION here.
        * configure.ac: Move AC_SUBST of libtool_VERSION past call to
        GLIBCXX_ENABLE_SYMVERS.
        * configure: Regenerate.
        * include/bits/c++config: Use __7 as versioned namespace name.
        * config/abi/pre/gnu-versioned-namespace.ver: Change mangling as
        per above.
        * include/c_global/cwchar: Adjust nested namespaces.
        * testsuite/20_util/bind/48698.cc: Add test case.
        * testsuite/ext/profile/mutex_extensions_neg.cc: Change line number.


Modified:
    branches/gcc-4_6-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_6-branch/libstdc++-v3/acinclude.m4
   
branches/gcc-4_6-branch/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
    branches/gcc-4_6-branch/libstdc++-v3/configure
    branches/gcc-4_6-branch/libstdc++-v3/configure.ac
    branches/gcc-4_6-branch/libstdc++-v3/include/bits/c++config
    branches/gcc-4_6-branch/libstdc++-v3/include/bits/locale_facets.tcc
    branches/gcc-4_6-branch/libstdc++-v3/include/c_global/cwchar
   
branches/gcc-4_6-branch/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/48698] gnu-versioned-namespace problems
  2011-04-20 10:31 [Bug libstdc++/48698] New: gnu-versioned-namespace problems redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-10-05 23:10 ` bkoz at gcc dot gnu.org
@ 2011-10-05 23:12 ` bkoz at gcc dot gnu.org
  2011-10-05 23:13 ` bkoz at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: bkoz at gcc dot gnu.org @ 2011-10-05 23:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48698

Benjamin Kosnik <bkoz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot       |bkoz at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.6.2

--- Comment #5 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2011-10-05 23:12:07 UTC ---

Fixed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/48698] gnu-versioned-namespace problems
  2011-04-20 10:31 [Bug libstdc++/48698] New: gnu-versioned-namespace problems redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-10-05 23:12 ` bkoz at gcc dot gnu.org
@ 2011-10-05 23:13 ` bkoz at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: bkoz at gcc dot gnu.org @ 2011-10-05 23:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48698

Benjamin Kosnik <bkoz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2011-10-05 23:12:52 UTC ---

Fixed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-05 23:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 10:31 [Bug libstdc++/48698] New: gnu-versioned-namespace problems redi at gcc dot gnu.org
2011-04-20 10:33 ` [Bug libstdc++/48698] " redi at gcc dot gnu.org
2011-09-23  7:27 ` bkoz at gcc dot gnu.org
2011-09-27  0:38 ` bkoz at gcc dot gnu.org
2011-10-05 23:10 ` bkoz at gcc dot gnu.org
2011-10-05 23:12 ` bkoz at gcc dot gnu.org
2011-10-05 23:13 ` bkoz at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).