Re: [PATCH, libstdc++] Fix missing gthr-default.h issue on libstdc++ configure
I'd like to know if my direction is ok. I can look into other issues releated to this and fix them, but it doesn't make much sense if separate build is not supported and can be easily broken in the future. I like your direction here. This patch is enough for 4.7 to have build working (at least in Android environment). Confirmed. Is it ok for release it into trunk and 4.7? Yes, please do so. I'll take care of remaining trunk issues with other patches if necessary. Great. I just tested your patch on trunk, and despite what I said yesterday, it seems to work. -benjamin
[v3] libstdc++/54314
adds in exports for more vtable bits, as per bugzilla -benjamin tested x86/linux tested x86/linux --enable-symvers=gnu-versioned-namespace012-09-26 Benjamin Kosnik b...@redhat.com PR libstdc++/54314 * config/abi/pre/gnu.ver: Add vtable exports. * config/abi/pre/gnu-versioned-namespace.ver: Same. diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver index e7e9162..5f25374 100644 --- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver +++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver @@ -27,20 +27,11 @@ GLIBCXX_7.0 { # Names inside the 'extern' block are demangled names. extern C++ { + std::*; std::__7::*; - std::* + std::random_device::* }; -# locale -_ZNSt3__79has_facetINS_*; - -# hash -_ZNSt8__detail3__712__prime_listE; -_ZNSt3tr18__detail3__712__prime_listE; - -# thread/mutex/condition_variable/future -__once_proxy; - # operator new(size_t) _Znw[jmy]; # operator new(size_t, std::nothrow_t const) @@ -64,13 +55,33 @@ GLIBCXX_7.0 { # function-scope static objects requires a guard variable. _ZGVNSt*; -_ZTT*; -_ZTV*; +# construction vtable +_ZTCNSt*; -_ZTI*; -_ZTS*; +# VTT structure +_ZTTNSt*; -_ZTv0_n*; +# vtable +_ZTVNSt*; + +# thunk +_ZTv0_n24_NS*; + +# typeinfo structure +_ZTINSt*; + +# typeinfo name +_ZTSNSt*; + +# locale +_ZNSt3__79has_facetINS_*; + +# hash +_ZNSt8__detail3__712__prime_listE; +_ZNSt3tr18__detail3__712__prime_listE; + +# thread/mutex/condition_variable/future +__once_proxy; # std::__detail::_List_node_base _ZNSt8__detail3__715_List_node_base7_M_hook*; diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 5265b21..396feec 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -1322,6 +1322,7 @@ GLIBCXX_3.4.17 { } GLIBCXX_3.4.16; GLIBCXX_3.4.18 { + global: # Names inside the 'extern' block are demangled names. @@ -1330,6 +1331,9 @@ GLIBCXX_3.4.18 { std::random_device::*; }; +# construction vtable +_ZTCSt*; + } GLIBCXX_3.4.17; # Symbols in the support library (libsupc++) have their own tag.
Re: [v3] libstdc++/54102
... finally got around to fixing up the generated HTML, so that charset is set to UTF-8. I regenerated doc/html and checked it in. Attached are the diffs. ... here using xhtml that will validate with W3c checkers. -benjamindiff --git a/libstdc++-v3/doc/Makefile.am b/libstdc++-v3/doc/Makefile.am index b787200..5d807dc 100644 --- a/libstdc++-v3/doc/Makefile.am +++ b/libstdc++-v3/doc/Makefile.am @@ -465,7 +465,7 @@ XSLT_PARAM = --param toc.section.depth 4 #XSL_STYLE_DIR = /usr/share/xml/docbook/stylesheet/docbook-xsl-ns #XSL_STYLE_DIR = /usr/share/sgml/docbook/xsl-ns-stylesheets XSL_FO_STYLE = $(XSL_STYLE_DIR)/fo/docbook.xsl -XSL_HTML_STYLE = $(XSL_STYLE_DIR)/html/chunk.xsl +XSL_HTML_STYLE = $(XSL_STYLE_DIR)/xhtml/chunk.xsl XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/html/docbook.xsl XSL_EPUB_STYLE = $(XSL_STYLE_DIR)/epub3/chunk.xsl XSL_LOCAL_STYLE = ${glibcxx_builddir}/doc/xsl/customization.xsl diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in index 40272ef..78bc778 100644 --- a/libstdc++-v3/doc/Makefile.in +++ b/libstdc++-v3/doc/Makefile.in @@ -517,7 +517,7 @@ XSLT_PARAM = --param toc.section.depth 4 #XSL_STYLE_DIR = /usr/share/xml/docbook/stylesheet/docbook-xsl-ns #XSL_STYLE_DIR = /usr/share/sgml/docbook/xsl-ns-stylesheets XSL_FO_STYLE = $(XSL_STYLE_DIR)/fo/docbook.xsl -XSL_HTML_STYLE = $(XSL_STYLE_DIR)/html/chunk.xsl +XSL_HTML_STYLE = $(XSL_STYLE_DIR)/xhtml/chunk.xsl XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/html/docbook.xsl XSL_EPUB_STYLE = $(XSL_STYLE_DIR)/epub3/chunk.xsl XSL_LOCAL_STYLE = ${glibcxx_builddir}/doc/xsl/customization.xsl
Re: [wwwdocs] Update coding conventions for C++
With that concern stated, I will write into the conventions whatever concensus arises. Of course, I have no objection to an occasional inline cleanup. That is, build with -Werror and adjusting inlines that have, through the course of time, become larger than is useful. This seems to be what reliably happens in libstdc++-land. -benjamin
Re: [wwwdocs] Update coding conventions for C++
Hey Lawrence, thanks for this work and for keeping the public up-to-date with this gcc-patches posting. This looks pretty good to me. The only remaining issue for me is the fuzzyness/handwaving around inlining. I think the only way to really enforce what can be inlined is not to have people use their best judgement, or what they think is a small function, or what they intend for the compiler to inline, but to have -Winline mandatory. And thus flag things that are written as inlined, but cannot then be inlined by the compiler. This area seems historically fraught, in terms of expectations. I'm not trying to poke at the hornets nest here. -benjamin
Re: [v3] libstdc++/52689 testcase
On Wed, 25 Apr 2012 18:53:36 +0100 Jonathan Wakely jwakely@gmail.com wrote: On 25 April 2012 08:33, Igor Zamyatin wrote: This testcase is reported as failed on x86 Yep. http://gcc.gnu.org/ml/gcc-testresults/2012-04/msg02547.html Benjamin? Ouch. Sorry about this guys, of course it wasn't this simple. I see now that although this was not failing on my setup, it was coming in as unsupported to to my mis-use of the dg-require-target hook. Which was clearly not my intent... tested x86/linux -benjamin2012-04-25 Benjamin Kosnik b...@redhat.com PR libstdc++/52689 * testsuite/17_intro/static.cc: Fix. * testsuite/lib/dg-options.exp (dg-require-static-libstdcxx): New. * testsuite/lib/libstdc++.exp (check_v3_target_static_libstdcxx): New. diff --git a/libstdc++-v3/testsuite/17_intro/static.cc b/libstdc++-v3/testsuite/17_intro/static.cc index 99362f5..6b1d2c4 100644 --- a/libstdc++-v3/testsuite/17_intro/static.cc +++ b/libstdc++-v3/testsuite/17_intro/static.cc @@ -1,6 +1,6 @@ // { dg-do link } -// { dg-require-effective-target static } -// { dg-options -static -std=gnu++11 } +// { dg-require-static-libstdcxx } +// { dg-options -static-libstdc++ -std=gnu++11 } // Copyright (C) 2012 Free Software Foundation, Inc. // @@ -25,7 +25,7 @@ int main() { - std::locale c = std::locale::global(); + std::locale c __attribute__((unused)) = std::locale::classic(); std::cout i am old-skool\n; return 0; } diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp index d5eb5e8..9d5624a 100644 --- a/libstdc++-v3/testsuite/lib/dg-options.exp +++ b/libstdc++-v3/testsuite/lib/dg-options.exp @@ -197,6 +197,15 @@ proc dg-require-nprocs { args } { return } +proc dg-require-static-libstdcxx { args } { +if { ![ check_v3_target_static_libstdcxx ] } { +upvar dg-do-what dg-do-what +set dg-do-what [list [lindex ${dg-do-what} 0] N P] +return +} +return +} + proc add_options_for_no_pch { flags } { # This forces any generated and possibly included PCH to be invalid. return -D__GLIBCXX__= diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index c1ccfa5..9a9e0cb 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -1693,5 +1693,49 @@ proc check_v3_target_nprocs { } { return $et_nprocs } +proc check_v3_target_static_libstdcxx { } { +global cxxflags +global DEFAULT_CXXFLAGS +global et_static_libstdcxx + +global tool + +if [info exists et_static_libstdcxx] { + verbose check_v3_target_static_libstdcxx: using cached result 2 +} else { + set et_static_libstdcxx 0 + + # Set up and link a C++0x test program that depends + # on static linking + set src static-maybe[pid].cc + + set f [open $src w] +puts $f #include iostream + puts $f int main() { + puts $f int i(415); + puts $f std::cout i std::endl; + puts $f return 0; } + puts $f + close $f + + set cxxflags_saved $cxxflags + set cxxflags $cxxflags $DEFAULT_CXXFLAGS -static-libstdc++ + + set lines [v3_target_compile $src /dev/null executable ] + set cxxflags $cxxflags_saved + file delete $src + + if [string match $lines] { + # No error message, link succeeded. + set et_static_libstdcxx 1 + } else { + verbose check_v3_target_static_libstdcxx: compilation failed 2 + } +} +verbose check_v3_target_static_libstdcxx: $et_static_libstdcxx 2 +return $et_static_libstdcxx +} + + set additional_prunes
Re: [PATCH 12/13] Adjust relevant test cases wrt -ftrack-macro-expansion=[0|2]
Hey hey! Looking good Dodji. Can't wait to use this stuff. There are so many libstdc++ tests that were failing because of that benign issue that I preferred to just run them with -ftrack-macro-expansion diabled, after inspecting each of them to be sure there was nothing more serious underneath. I believe we can latter turn on -ftrack-macro-expansion there on a case by case basis. Seems perfectly reasonable. I volunteer to look at the libstdc++testsuite changes once your patches are in checked in to trunk. -benjamin
Re: [v3] std::uninitialized_copy test
Definitely, thanks! The name of the new testcase seems a bit weird (for the FSF branches): shall we maybe refer to the original (Fedora or RHEL Bugzilla, I suppose) PR in a comment and then use either an explicative name (our current practice) or just a small number for the name of the testcase itself? Yes, agreed. I couldn't think of anything descriptive for this test, but if you can please feel free to assign it something meaningful. -benjamin
Re: [v3] Update Solaris baselines for GCC 4.7, take 2
After PRs libstdc++/52188 and libstdc++/52189 have been resolved, I'd finally like to update the Solaris baselines for the 4.7 release. This time, everything looks good: only additions to GLIBCXX_3.4.1[67], CXXABI_1.3.6, and CXXABI_TM_1, as expected. Bootstrapped without regressions on i386-pc-solaris2.{8, 9, 10, 11} and sparc-sun-solaris2.{8, 9, 10, 11} with as/ld, gas/ld, and gas/gld. Also verified that there are no additions in $target/libstdc++/testsuite/libstdc++.log.sep. This looks way better, thanks for you work on cleaning this up. What a relief! I was surprised to see GLIBCXX_3.4.15 symbols added, but then realized you added the complete set so this seems fine. There are only two FAILs: on Solaris 10 and 11/x86 with as, _GLOBAL_OFFSET_TABLE_ is missing from the base version. The jury is still out whether this is an assembler or linker bug. I think about filtering out those symbols bound to the base version (which are prescribed by the Solaris ABI, but have nothing to do with the libstdc++.so interface) in a subsequent (4.8) patch, but for now this is good enough. OK, and thanks. best, Benjamin
Re: Unreviewed libstdc++/libgomp patch
On Tue, 28 Feb 2012 00:12:33 +0100 Jakub Jelinek ja...@redhat.com wrote: and $(EGREP) -v '#(#| |$$)' just throws away the whole };# Appended to version file. line. I wonder if sed -e 's/#[# $].*$//' wouldn't be better, or alternative add ^ before the first # in the egrep regex. Of course we can add a newline to gnu.ver, but the next time somebody forgots to add a newline at the end of the file we'll have the same problem again. Benjamin, what do you prefer? I would prefer not having gnu.ver have to end in a newline. Slight preference for ^ before first # but I don't really care. -benjamin
Re: v3 PATCH to include/bits/locale_facets.h to revert reordering of virtual functions
Thanks Jason. -benjamin
[v3] libstdc++/47058
Adds support for disabling -Werror with --disable-werror configure flag. tested x86/linux --enable-maintainer-mode tested x86/linux --enable-maintainer-mode --disable-werror -benjamin2012-02-17 Benjamin Kosnik b...@redhat.com PR libstdc++/47058 * acinclude.m4 (GLIBCXX_ENABLE_WERROR): New. (GLIBCXX_EXPORT_FLAGS): Add -Wabi to WARN_FLAGS * configure.ac: Use it. * fragment.am: Set WERROR_FLAG conditionally on --disable-werror. * configure: Regenerate. * python/Makefile.in: Same. * Makefile.in: Same. * doc/Makefile.in: Same. * include/Makefile.in: Same. * po/Makefile.in: Same. * python/Makefile.in: Same. * src/Makefile.in: Same. * src/c++11/Makefile.in: Same. * src/c++98/Makefile.in: Same. * testsuite/Makefile.in: Same. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index e7ffacc..46a5532 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -729,7 +729,7 @@ AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [ # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc AC_SUBST(OPTIMIZE_CXXFLAGS) - WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual' + WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi' AC_SUBST(WARN_FLAGS) ]) @@ -3591,6 +3591,17 @@ AC_SUBST(python_mod_dir) GLIBCXX_CONDITIONAL(ENABLE_PYTHONDIR, test $python_mod_dir != no) ]) +dnl +dnl Check to see if -Werror is disabled. +dnl +dnl --enable-werror/--disable-werror +AC_DEFUN([GLIBCXX_ENABLE_WERROR], [ + AC_MSG_CHECKING([for -Werror]) + GLIBCXX_ENABLE(werror,$1,,[turns on -Werror]) + AC_MSG_RESULT($enable_werror) + GLIBCXX_CONDITIONAL(ENABLE_WERROR, test $enable_werror = yes) +]) + # Macros from the top-level gcc directory. m4_include([../config/gc++filt.m4]) diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 81b523f..49de141 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -131,6 +131,7 @@ GLIBCXX_ENABLE_CXX_FLAGS GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no]) GLIBCXX_ENABLE_EXTERN_TEMPLATE([yes]) GLIBCXX_ENABLE_PYTHON +GLIBCXX_ENABLE_WERROR([yes]) # Checks for operating systems support that doesn't require linking. GLIBCXX_CHECK_MATH_PROTO diff --git a/libstdc++-v3/fragment.am b/libstdc++-v3/fragment.am index 2bcbc1a..304d396 100644 --- a/libstdc++-v3/fragment.am +++ b/libstdc++-v3/fragment.am @@ -13,12 +13,18 @@ STAMP = echo timestamp toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) +if ENABLE_WERROR +WERROR_FLAG=$(WERROR) +else +WERROR_FLAG= +endif + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. CONFIG_CXXFLAGS = \ $(SECTION_FLAGS) $(EXTRA_CXX_FLAGS) -frandom-seed=$@ WARN_CXXFLAGS = \ - $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once -Wabi + $(WARN_FLAGS) $(WERROR_FLAG) -fdiagnostics-show-location=once # -I/-D flags to pass when compiling. AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
Re: [v3] libstdc++/51798
Noticed that the config for the new atomic builtins was not correct for targets that did not do link tests. (ie x86-x-cris-elf). Fixed as follows. tested x86/linux tested x86/linux x cris-elf -benjamin2012-02-17 Benjamin Kosnik b...@redhat.com PR libstdc++/51798 continued. * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Grep for __atomic_, not __sync. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 46a5532..b832527 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -2824,7 +2824,7 @@ EOF AC_MSG_CHECKING([for atomic builtins for bool]) if AC_TRY_EVAL(ac_compile); then - if grep __sync_ conftest.s /dev/null 21 ; then + if grep __atomic_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_bool=no else glibcxx_cv_atomic_bool=yes @@ -2853,7 +2853,7 @@ EOF AC_MSG_CHECKING([for atomic builtins for short]) if AC_TRY_EVAL(ac_compile); then - if grep __sync_ conftest.s /dev/null 21 ; then + if grep __atomic_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_short=no else glibcxx_cv_atomic_short=yes @@ -2883,7 +2883,7 @@ EOF AC_MSG_CHECKING([for atomic builtins for int]) if AC_TRY_EVAL(ac_compile); then - if grep __sync_ conftest.s /dev/null 21 ; then + if grep __atomic_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_int=no else glibcxx_cv_atomic_int=yes @@ -2912,7 +2912,7 @@ EOF AC_MSG_CHECKING([for atomic builtins for long long]) if AC_TRY_EVAL(ac_compile); then - if grep __sync_ conftest.s /dev/null 21 ; then + if grep __atomic_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_long_long=no else glibcxx_cv_atomic_long_long=yes
Re: obvious(?) typo in libstdc++-v3/src/c++98/locale.cc
The typo is obvious, but whether or not the wrapped code still works isn't (to me). * src/c++98/locale.cc (locale::facet::_S_get_c_locale): Fix typo. Please check this in. -benjamin
Re: [v3] libstdc++/51798
The patch uses the weak version of compare_exchange universally, which is incorrect in a number of cases. You wouldn't see this on x86_64; you'd have to use a ll/sc target such as powerpc. In addition to changing several uses to strong compare_exchange, I also optimize the idiom do { var = *m; newval = ...; } while (!atomic_compare_exchange(m, var, newval, ...)); With the new builtins, VAR is updated with the current value of the memory (regardless of the weak setting), so the initial read from *M can be hoisted outside the loop. nice! Ok? cool, thanks for reviewing this. I fixed up the line numbers for the header file edits. -benjamin 2012-02-13 Benjamin Kosnik b...@redhat.com * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers. * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same. diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc index 0d51663..39f9ce3 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc @@ -32,9 +32,9 @@ void test01() { X* px = 0; std::shared_ptrX p1(px); // { dg-error here } - // { dg-error incomplete { target *-*-* } 773 } + // { dg-error incomplete { target *-*-* } 771 } std::shared_ptrX p9(ap()); // { dg-error here } - // { dg-error incomplete { target *-*-* } 867 } + // { dg-error incomplete { target *-*-* } 865 } } diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc index ae902dc..0309f8f 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } -// Copyright (C) 2010 Free Software Foundation +// Copyright (C) 2010, 2012 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -30,9 +30,9 @@ void test01() { X* px = 0; std::tr1::shared_ptrX p1(px); // { dg-error here } - // { dg-error incomplete { target *-*-* } 565 } + // { dg-error incomplete { target *-*-* } 563 } std::tr1::shared_ptrX p9(ap()); // { dg-error here } - // { dg-error incomplete { target *-*-* } 604 } + // { dg-error incomplete { target *-*-* } 602 } }
Re: [v3] Update C++11 status table.
* doc/xml/manual/documentation_hacking.xml: Fix invalid attribute. Also committed to trunk. Tested with 'make doc-xml-validate-docbook doc-html' Doh! Thanks for cleaning up after my late-night hacking. If you can, I'd appreciate you trying to generate the PDF doxygen manual with the memory-increasing change to TeX. I understand the doc toolchain for doing this is non-trivial. I really want the hyperlinks without it this huge reference doc is largely useless. -benjamin
[v3] libstdc++/51798
This is the rest of 51798, completing the conversion to C++11 atomics in libstdc++. This is now a complete transition, modulo documentation which I plan to finish as a separate patch once I am back from the ISO C++ meeting. tested x86_64/linux -benjamin 2012-02-09 Benjamin Kosnik b...@redhat.com Jonathan Wakely jwakely@gmail.com PR libstdc++/51798 continued. * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Use __atomic_* builtins instead of __sync_* builtins for atomic functionality. * include/bits/shared_ptr_base.h: Same. * include/parallel/compatibility.h: Same. * include/profile/impl/profiler_state.h: Same. * include/tr1/shared_ptr.h: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/eh_throw.cc: Same. * libsupc++/eh_tm.cc: Same. * libsupc++/guard.cc: Same. * configure: Regenerated. * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers. * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 529532e..e089b20 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -2685,7 +2685,7 @@ AC_DEFUN([GLIBCXX_ENABLE_PCH], [ dnl dnl Check for atomic builtins. dnl See: -dnl http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins +dnl http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html dnl dnl This checks to see if the host supports the compiler-generated dnl builtins for atomic operations for various integral sizes. Note, this @@ -2726,12 +2726,13 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [typedef bool atomic_type; atomic_type c1; atomic_type c2; - const atomic_type c3(0); - __sync_fetch_and_add(c1, c2); - __sync_val_compare_and_swap(c1, c3, c2); - __sync_lock_test_and_set(c1, c3); - __sync_lock_release(c1); - __sync_synchronize();], + atomic_type c3(0); + __atomic_fetch_add(c1, c2, __ATOMIC_RELAXED); + __atomic_compare_exchange_n(c1, c2, c3, true, __ATOMIC_ACQ_REL, + __ATOMIC_RELAXED); + __atomic_test_and_set(c1, __ATOMIC_RELAXED); + __atomic_load_n(c1, __ATOMIC_RELAXED); + ], [glibcxx_cv_atomic_bool=yes], [glibcxx_cv_atomic_bool=no]) ]) @@ -2744,12 +2745,13 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [typedef short atomic_type; atomic_type c1; atomic_type c2; - const atomic_type c3(0); - __sync_fetch_and_add(c1, c2); - __sync_val_compare_and_swap(c1, c3, c2); - __sync_lock_test_and_set(c1, c3); - __sync_lock_release(c1); - __sync_synchronize();], + atomic_type c3(0); + __atomic_fetch_add(c1, c2, __ATOMIC_RELAXED); + __atomic_compare_exchange_n(c1, c2, c3, true, __ATOMIC_ACQ_REL, + __ATOMIC_RELAXED); + __atomic_test_and_set(c1, __ATOMIC_RELAXED); + __atomic_load_n(c1, __ATOMIC_RELAXED); + ], [glibcxx_cv_atomic_short=yes], [glibcxx_cv_atomic_short=no]) ]) @@ -2762,12 +2764,13 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [typedef int atomic_type; atomic_type c1; atomic_type c2; - const atomic_type c3(0); - __sync_fetch_and_add(c1, c2); - __sync_val_compare_and_swap(c1, c3, c2); - __sync_lock_test_and_set(c1, c3); - __sync_lock_release(c1); - __sync_synchronize();], + atomic_type c3(0); + __atomic_fetch_add(c1, c2, __ATOMIC_RELAXED); + __atomic_compare_exchange_n(c1, c2, c3, true, __ATOMIC_ACQ_REL, + __ATOMIC_RELAXED); + __atomic_test_and_set(c1, __ATOMIC_RELAXED); + __atomic_load_n(c1, __ATOMIC_RELAXED); + ], [glibcxx_cv_atomic_int=yes], [glibcxx_cv_atomic_int=no]) ]) @@ -2780,12 +2783,13 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [typedef long long atomic_type; atomic_type c1; atomic_type c2; - const atomic_type c3(0); - __sync_fetch_and_add(c1, c2); - __sync_val_compare_and_swap(c1, c3, c2); - __sync_lock_test_and_set(c1, c3); - __sync_lock_release(c1); - __sync_synchronize();], + atomic_type c3(0); + __atomic_fetch_add(c1, c2, __ATOMIC_RELAXED); + __atomic_compare_exchange_n(c1, c2, c3, true, __ATOMIC_ACQ_REL, + __ATOMIC_RELAXED); + __atomic_test_and_set(c1, __ATOMIC_RELAXED); + __atomic_load_n(c1, __ATOMIC_RELAXED); + ], [glibcxx_cv_atomic_long_long=yes], [glibcxx_cv_atomic_long_long=no]) ]) @@ -2807,12 +2811,13 @@ int main() typedef bool atomic_type; atomic_type c1; atomic_type c2; - const atomic_type c3(0); - __sync_fetch_and_add(c1, c2); - __sync_val_compare_and_swap(c1, c3, c2); - __sync_lock_test_and_set(c1, c3); - __sync_lock_release(c1); - __sync_synchronize(); + atomic_type c3(0); + __atomic_fetch_add(c1, c2
[v3] libstdc++/51811
Fix-ups for atomic_tp* operators. Found some open issues with atomicvoid* that merit further study. tested x86/linux -benjamin2012-02-02 Benjamin Kosnik b...@redhat.com PR libstdc++/52068 * src/c++11/Makefile.am (toolexeclib_LTLIBRARIES, libc__11_la_SOURCES): Remove. * src/c++11/Makefile.in: Regenerate. * src/c++98/Makefile.am (toolexeclib_LTLIBRARIES, libc__98_la_SOURCES): Remove. * src/c++98/Makefile.in: Regenerate. diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/Makefile.am index cc454bb..395af5c 100644 --- a/libstdc++-v3/src/c++11/Makefile.am +++ b/libstdc++-v3/src/c++11/Makefile.am @@ -25,7 +25,6 @@ include $(top_srcdir)/fragment.am # Convenience library for C++11 runtime. -toolexeclib_LTLIBRARIES = libc++11.la noinst_LTLIBRARIES = libc++11convenience.la headers = @@ -63,7 +62,6 @@ endif vpath % $(top_srcdir)/src/c++11 vpath % $(top_srcdir) -libc__11_la_SOURCES = $(sources) $(inst_sources) libc__11convenience_la_SOURCES = $(sources) $(inst_sources) # AM_CXXFLAGS needs to be in each subdirectory so that it can be diff --git a/libstdc++-v3/src/c++98/Makefile.am b/libstdc++-v3/src/c++98/Makefile.am index d5d39d1..e960d94 100644 --- a/libstdc++-v3/src/c++98/Makefile.am +++ b/libstdc++-v3/src/c++98/Makefile.am @@ -25,7 +25,6 @@ include $(top_srcdir)/fragment.am # Convenience library for C++98 runtime. -toolexeclib_LTLIBRARIES = libc++98.la noinst_LTLIBRARIES = libc++98convenience.la headers = @@ -156,7 +155,6 @@ sources = \ vpath % $(top_srcdir)/src/c++98 vpath % $(top_srcdir) -libc__98_la_SOURCES = $(sources) libc__98convenience_la_SOURCES = $(sources) # Use special rules for the deprecated source files so that they find
Re: [v3] libstdc++/51811
Different patch attached? Indeed, sorry. Here's the right one. -benjamin2012-02-03 Benjamin Kosnik b...@redhat.com PR libstdc++/51811 * include/bits/atomic_base.h (atomic_Tp*): Fix offsets. * testsuite/29_atomics/atomic/operators/51811.cc: New. * testsuite/29_atomics/atomic/operators/pointer_partial_void.cc: New. diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h index aa43bcc..9d5f4eb 100644 --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -1,6 +1,6 @@ // -*- C++ -*- header. -// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -621,6 +621,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __pointer_type _M_p; + // Factored out to facilitate explicit specialization. + constexpr ptrdiff_t + _M_type_size(ptrdiff_t __d) { return __d * sizeof(_PTp); } + + constexpr ptrdiff_t + _M_type_size(ptrdiff_t __d) volatile { return __d * sizeof(_PTp); } + public: __atomic_base() noexcept = default; ~__atomic_base() noexcept = default; @@ -669,43 +676,51 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __pointer_type operator++() noexcept - { return __atomic_add_fetch(_M_p, 1, memory_order_seq_cst); } + { return __atomic_add_fetch(_M_p, _M_type_size(1), + memory_order_seq_cst); } __pointer_type operator++() volatile noexcept - { return __atomic_add_fetch(_M_p, 1, memory_order_seq_cst); } + { return __atomic_add_fetch(_M_p, _M_type_size(1), + memory_order_seq_cst); } __pointer_type operator--() noexcept - { return __atomic_sub_fetch(_M_p, 1, memory_order_seq_cst); } + { return __atomic_sub_fetch(_M_p, _M_type_size(1), + memory_order_seq_cst); } __pointer_type operator--() volatile noexcept - { return __atomic_sub_fetch(_M_p, 1, memory_order_seq_cst); } + { return __atomic_sub_fetch(_M_p, _M_type_size(1), + memory_order_seq_cst); } __pointer_type operator+=(ptrdiff_t __d) noexcept - { return __atomic_add_fetch(_M_p, __d, memory_order_seq_cst); } + { return __atomic_add_fetch(_M_p, _M_type_size(__d), + memory_order_seq_cst); } __pointer_type operator+=(ptrdiff_t __d) volatile noexcept - { return __atomic_add_fetch(_M_p, __d, memory_order_seq_cst); } + { return __atomic_add_fetch(_M_p, _M_type_size(__d), + memory_order_seq_cst); } __pointer_type operator-=(ptrdiff_t __d) noexcept - { return __atomic_sub_fetch(_M_p, __d, memory_order_seq_cst); } + { return __atomic_sub_fetch(_M_p, _M_type_size(__d), + memory_order_seq_cst); } __pointer_type operator-=(ptrdiff_t __d) volatile noexcept - { return __atomic_sub_fetch(_M_p, __d, memory_order_seq_cst); } + { return __atomic_sub_fetch(_M_p, _M_type_size(__d), + memory_order_seq_cst); } bool is_lock_free() const noexcept - { return __atomic_is_lock_free (sizeof (_M_p), _M_p); } + { return __atomic_is_lock_free(_M_type_size(1), _M_p); } bool is_lock_free() const volatile noexcept - { return __atomic_is_lock_free (sizeof (_M_p), _M_p); } + { return __atomic_is_lock_free(_M_type_size(1), _M_p); } void store(__pointer_type __p, @@ -789,22 +804,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept - { return __atomic_fetch_add(_M_p, __d, __m); } + { return __atomic_fetch_add(_M_p, _M_type_size(__d), __m); } __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept - { return __atomic_fetch_add(_M_p, __d, __m); } + { return __atomic_fetch_add(_M_p, _M_type_size(__d), __m); } __pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept - { return __atomic_fetch_sub(_M_p, __d, __m); } + { return __atomic_fetch_sub(_M_p, _M_type_size(__d), __m); } __pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept - { return __atomic_fetch_sub(_M_p, __d, __m); } + { return __atomic_fetch_sub(_M_p, _M_type_size(__d), __m); } }; // @} group atomics diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/operators/51811.cc b/libstdc++-v3/testsuite/29_atomics/atomic/operators/51811.cc new file mode 100644 index 000..7c234f2 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic/operators/51811.cc @@ -0,0 +1,90 @@ +// { dg-options -std=gnu++0x } + +// Copyright (C) 2012 Free Software Foundation
[v3] libstdc++/49445
I'm just going to check in this PR's derived test case, since it seems like something we should be tracking. tested x86/linux -benjamindiff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 656cc96..187ee49 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 2012-02-03 Benjamin Kosnik b...@redhat.com + PR libstdc++/49445 + * testsuite/29_atomics/atomic/cons/49445.cc: Add. + +2012-02-03 Benjamin Kosnik b...@redhat.com + PR libstdc++/51811 * include/bits/atomic_base.h (atomic_Tp*): Fix offsets. * testsuite/29_atomics/atomic/operators/51811.cc: New. diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/49445.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/49445.cc new file mode 100644 index 000..569df4a --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/49445.cc @@ -0,0 +1,42 @@ +// { dg-options -std=gnu++0x } + +// Copyright (C) 2012 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// http://www.gnu.org/licenses/. + +#include atomic + +enum class tacos : int +{ + cancun = 4, + el_loco = 5, + sabor = 6, + papalote = 9, + licious = 44, + jarritos = 55 +}; + +// should minimally compile and link +int main() +{ + std::atomicfloat af(0.0f); + float non_af = af; + + std::atomictacos ae(tacos::sabor); + tacos non_ae = ae; + + return 0; +}
[v3] libstdc++/52068
Remove install weirdness from 49829 fix. tested x86/linux -benjamin2012-02-02 Benjamin Kosnik b...@redhat.com PR libstdc++/52068 * src/c++11/Makefile.am (toolexeclib_LTLIBRARIES, libc__11_la_SOURCES): Remove. * src/c++11/Makefile.in: Regenerate. * src/c++98/Makefile.am (toolexeclib_LTLIBRARIES, libc__98_la_SOURCES): Remove. * src/c++98/Makefile.in: Regenerate. diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/Makefile.am index cc454bb..395af5c 100644 --- a/libstdc++-v3/src/c++11/Makefile.am +++ b/libstdc++-v3/src/c++11/Makefile.am @@ -25,7 +25,6 @@ include $(top_srcdir)/fragment.am # Convenience library for C++11 runtime. -toolexeclib_LTLIBRARIES = libc++11.la noinst_LTLIBRARIES = libc++11convenience.la headers = @@ -63,7 +62,6 @@ endif vpath % $(top_srcdir)/src/c++11 vpath % $(top_srcdir) -libc__11_la_SOURCES = $(sources) $(inst_sources) libc__11convenience_la_SOURCES = $(sources) $(inst_sources) # AM_CXXFLAGS needs to be in each subdirectory so that it can be diff --git a/libstdc++-v3/src/c++98/Makefile.am b/libstdc++-v3/src/c++98/Makefile.am index d5d39d1..e960d94 100644 --- a/libstdc++-v3/src/c++98/Makefile.am +++ b/libstdc++-v3/src/c++98/Makefile.am @@ -25,7 +25,6 @@ include $(top_srcdir)/fragment.am # Convenience library for C++98 runtime. -toolexeclib_LTLIBRARIES = libc++98.la noinst_LTLIBRARIES = libc++98convenience.la headers = @@ -156,7 +155,6 @@ sources = \ vpath % $(top_srcdir)/src/c++98 vpath % $(top_srcdir) -libc__98_la_SOURCES = $(sources) libc__98convenience_la_SOURCES = $(sources) # Use special rules for the deprecated source files so that they find
Re: [v3] libstdc++/49829
OK. The attached is closer, but still not quite there. one step further, to avoid the endless recursion in the install-debug target. unsure if that is the right approach. the install now works, but the debug library is now built in the install step, not in the build step. As checked in. tested x86/linux -benjamin2012-01-27 Benjamin Kosnik b...@redhat.com Matthias Klose d...@ubuntu.com * configure.ac (GLIBCXX_ENABLE_DEBUG_FLAGS): Use -gdwarf-4 -g3 -O0. * configure.in: Regenerated. * src/Makefile.am (all-once, install-data-once): New rules. (all-local, install-data-local): Use them. (build-debug, install-debug): Tweak. * src/Makefile.in: Regenerate. diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index c5f7901..7607e5b 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -124,7 +124,7 @@ GLIBCXX_ENABLE_LONG_LONG([yes]) GLIBCXX_ENABLE_WCHAR_T([yes]) GLIBCXX_ENABLE_C99([yes]) GLIBCXX_ENABLE_CONCEPT_CHECKS([no]) -GLIBCXX_ENABLE_DEBUG_FLAGS([-g3 -O0]) +GLIBCXX_ENABLE_DEBUG_FLAGS([-gdwarf-4 -g3 -O0]) GLIBCXX_ENABLE_DEBUG([no]) GLIBCXX_ENABLE_PARALLEL([yes]) GLIBCXX_ENABLE_CXX_FLAGS diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 87b2a16..2cd2774 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -168,16 +168,16 @@ version_arg = version_dep = endif -# Added rules. -# 1 debug library -# 2 supra-convenience library -if GLIBCXX_BUILD_DEBUG -all-local: libstdc++convenience.la build_debug -install-data-local: install_debug -else -all-local: libstdc++convenience.la -install-data-local: -endif + +# Control additional build primary rules. +# EXTRA_LTLIBRARIES = +all-once: libstdc++convenience.la $(STAMP_DEBUG) +install-data-once: $(STAMP_INSTALL_DEBUG) + +all-local: all-once +install-data-local: install-data-once +clean-local: + rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG) # Make a non-installed convenience library, so that --disable-static # may work. @@ -188,13 +188,26 @@ libstdc++convenience.la: $(toolexeclib_LTLIBRARIES) fi; \ echo `date` stamp-libstdc++convenience; -debugdir = debug +# Added rules. +# 1 debug library +# 2 supra-convenience library +if GLIBCXX_BUILD_DEBUG +STAMP_DEBUG = build-debug +STAMP_INSTALL_DEBUG = install-debug +CLEAN_DEBUG = debug +else +STAMP_DEBUG = +STAMP_INSTALL_DEBUG = +CLEAN_DEBUG = +endif -# Build a set of debug objects here. +# Build a debug variant. # Take care to fix all possibly-relative paths. +debugdir = ${glibcxx_builddir}/src/debug stamp-debug: if test ! -d ${debugdir}; then \ mkdir -p ${debugdir}; \ + for d in $(SUBDIRS); do mkdir -p ${debugdir}/$$d; done; \ (cd ${debugdir}; \ sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \ @@ -202,16 +215,30 @@ stamp-debug: -e 's/VPATH = \.\./VPATH = ..\/../' \ -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \ -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \ - -e 's/all-local: build_debug/all-local:/' \ - -e 's/install-data-local: install_debug/install-data-local:/' \ - ../Makefile Makefile) ; \ + ../Makefile Makefile ; \ + for d in . $(SUBDIRS); do \ + sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ + -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \ + -e 's/srcdir = \.\./srcdir = ..\/../' \ + -e 's/VPATH = \.\./VPATH = ..\/../' \ + -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \ + -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \ + ../$$d/Makefile $$d/Makefile ; \ + done) ; \ fi; \ echo `date` stamp-debug; -build_debug: stamp-debug - (cd ${debugdir} $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all) - -# Install debug library here. -install_debug: - (cd ${debugdir} $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) +build-debug: stamp-debug + (cd ${debugdir}; \ + mv Makefile Makefile.tmp; \ + sed -e 's,all-local: all-once,all-local:,' \ + -e 's,install-data-local: install-data-once,install-data-local:,' \ + -e 's,src/c,src/debug/c,' \ + Makefile.tmp Makefile ; \ + $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug all) ; + +# Install debug library. +install-debug: build-debug + (cd ${debugdir} $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ;
Re: [RFC] libstdc++ atomic_flag changes
The issue that I'm trying to solve is that we will have at least two targets whose test-and-set insn does not define set as 1, as a variable of type bool would expect. In the case of Sparc we *could* make the test-and-set implementation test for any non-zero value, but in the case of m68k the hw will only test-and-set the msb of the byte. This compiles on x86_64, and is still undergoing testing, but I wanted to get this out before Ben quits for the day. ;-) Looks fine to me. -benjamin
Re: [v3] libstdc++/49829
this breaks builds configured with --enable-libstdcxx-debug. confirmed Tried the following (not yet working) fix. OK. The attached is closer, but still not quite there. -benjamindiff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 87b2a16..59cc57d 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -172,13 +172,23 @@ endif # 1 debug library # 2 supra-convenience library if GLIBCXX_BUILD_DEBUG -all-local: libstdc++convenience.la build_debug -install-data-local: install_debug +STAMP_DEBUG = build-debug +STAMP_INSTALL_DEBUG = install-debug +CLEAN_DEBUG = debug else -all-local: libstdc++convenience.la -install-data-local: +STAMP_DEBUG = +STAMP_INSTALL_DEBUG = +CLEAN_DEBUG = endif +all-local-once: libstdc++convenience.la $(STAMP_DEBUG) +install-data-local-once: $(STAMP_INSTALL_DEBUG) + +all-local: all-local-once +install-data-local: install-data-local-once +clean-local: + rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG) + # Make a non-installed convenience library, so that --disable-static # may work. libstdc++convenience.la: $(toolexeclib_LTLIBRARIES) @@ -188,13 +198,13 @@ libstdc++convenience.la: $(toolexeclib_LTLIBRARIES) fi; \ echo `date` stamp-libstdc++convenience; -debugdir = debug - -# Build a set of debug objects here. +# Build a debug variant. # Take care to fix all possibly-relative paths. +debugdir = ${glibcxx_builddir}/src/debug stamp-debug: if test ! -d ${debugdir}; then \ mkdir -p ${debugdir}; \ + for d in $(SUBDIRS); do mkdir -p ${debugdir}/$$d; done; \ (cd ${debugdir}; \ sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \ @@ -202,16 +212,25 @@ stamp-debug: -e 's/VPATH = \.\./VPATH = ..\/../' \ -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \ -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \ - -e 's/all-local: build_debug/all-local:/' \ - -e 's/install-data-local: install_debug/install-data-local:/' \ - ../Makefile Makefile) ; \ + -e 's/all-local: all-local-once/all-local:/' \ + -e 's/install-data-local: install-data-local-once/install-data-local:/' \ + ../Makefile Makefile ; \ + for d in . $(SUBDIRS); do \ + sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ + -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \ + -e 's/srcdir = \.\./srcdir = ..\/../' \ + -e 's/VPATH = \.\./VPATH = ..\/../' \ + -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \ + -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \ + ../$$d/Makefile $$d/Makefile ; \ + done) ; \ fi; \ echo `date` stamp-debug; -build_debug: stamp-debug - (cd ${debugdir} $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all) +build-debug: stamp-debug + (cd ${debugdir} $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' libstdc++.la) -# Install debug library here. -install_debug: +# Install debug library. +install-debug: stamp-debug (cd ${debugdir} $(MAKE) \ toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
[v3] libstdc++/49829
This modularizes the libstdc++ sources such that the resulting library binaries are now composed of three convenience libraries. In short: libstdc++.[a, so] == libc++98 + libc++11 + libsupc++ Arguably, this is the way it should have been done all along. And certainly since the C++11 support hit 5 or more files In any case, this helps resolve the knots gcc/libstdc++ config and build get themselves into when gcc requires static libstdc++, but the build says no-static (--disable-static). There are some warts that need addressing by a proper build maintainer. 1) dependency tracking for libstdc++convenience.la. Help. It's not installed and not really used in most cases, so this isn't crucial. But, perfection is a cruel mistress, and I'd like to get this right. 2) I suppose the docs should be updated to reflect this. To-do. I'm trying to get over my fear of using git for check-ins that require a bunch of renames etc etc. So, this is my first one of these. If I did it all wrong, please let me know gently and I'll try to fix it. This patch is huge due to all the re-names. Please check out the patch posted in bugzilla instead. best, benjamin tested x86-64/linux tested x86-64/linux -x- arm-eabi tested x86-64/linux -x- cris-elf
Re: [v3] libstdc++/49829
tested x86-64/linux tested x86-64/linux -x- arm-eabi tested x86-64/linux -x- cris-elf Here is the missing bit, as tested above. -benjamindiff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index aa25a7e..87b2a16 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -184,9 +184,9 @@ endif libstdc++convenience.la: $(toolexeclib_LTLIBRARIES) $(CXXLINK) $(libstdc___la_LIBADD) $(LIBS); \ if test ! -f .libs/libstdc++.a; then \ - $(LN_S) .libs/libstdc++convenience.a .libs/libstdc++.a; \ - stamp-libstdc++convenience; \ - fi; + cp .libs/libstdc++convenience.a .libs/libstdc++.a; \ + fi; \ + echo `date` stamp-libstdc++convenience; debugdir = debug
Re: Cross-build breakage with libstdc++-v3 doc changes
...or for cross-targets, breakage. Something went wrong with this or subsequent changes; somewhere in the r183262:183268 I've started getting: [snip] checking for /usr/share/xml/docbook/stylesheet/docbook-xsl-ns/epub3/chunk.xsl... configure: error: cannot check for file existence when cross compiling make[1]: *** [configure-target-libstdc++-v3] Error 1 make[1]: Leaving directory `/tmp/hpautotest-gcc1/cris-elf/gccobj' make: *** [all] Error 2 Yes, I'm seeing the same problem when building a spu-elf cross-compiler ... Testing this patch, will check it in if passes, sorry. -benjamin 2012-01-18 Benjamin Kosnik b...@redhat.com * configure.ac: Move epub checks... * acinclude (GLIBCXX_CONFIGURE_DOCBOOK): ...here, use test -f instead of AC_CHECK_FILES. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 9d08178..fd3ba96 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -631,7 +631,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [ dnl -dnl Does any necessary configuration of the documentation directory. +dnl Does any necessary configuration for docbook in the docs directory. dnl dnl XSLTPROC must be set before this dnl @@ -642,7 +642,7 @@ dnl XSL_STYLE_DIR dnl AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [ -AC_MSG_CHECKING([for stylesheets used in generation of documentation]) +AC_MSG_CHECKING([for docbook stylesheets for documentation creation]) glibcxx_stylesheets=no if test x${XSLTPROC} = xyes echo 'title/' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2/dev/null; then glibcxx_stylesheets=yes @@ -669,6 +669,18 @@ if test x$glibcxx_local_stylesheets = xyes; then else glibcxx_stylesheets=no fi + +# Check for epub3 dependencies. +AC_MSG_CHECKING([for epub3 stylesheets for documentation creation]) +glibcxx_epub_stylesheets=no +if test x$glibcxx_local_stylesheets = xyes; then + if test -f ${XSL_STYLE_DIR}/epub3/chunk.xsl; then + glibcxx_epub_stylesheets=yes + fi +fi +AC_MSG_RESULT($glibcxx_epub_stylesheets) +AM_CONDITIONAL(BUILD_EPUB, test $glibcxx_epub_stylesheets= yes) + ]) diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 1c62aea..2429f04 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -380,15 +380,6 @@ AM_CONDITIONAL(BUILD_PDF, test $ac_cv_prog_DBLATEX = yes test $ac_cv_prog_PDFLATEX = yes) -# Check for epub dependencies. -AC_CHECK_FILE(/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/epub3/chunk.xsl, - ac_cv_file_epub3_a=yes, ac_cv_file_epub3_a=no) -AC_CHECK_FILE(/usr/share/sgml/docbook/xsl-ns-stylesheets/epub3/chunk.xsl, - ac_cv_file_epub3_b=yes, ac_cv_file_epub3_b=no) -AM_CONDITIONAL(BUILD_EPUB, - test $ac_cv_file_epub3_a = yes || - test $ac_cv_file_epub3_b = yes) - # Propagate the target-specific source directories through the build chain. ATOMICITY_SRCDIR=config/${atomicity_dir}
[v3] doc-epub rule updates
This updates the support for generating epub docs to EPUB3. Using the EPUB3 stylesheets allows the removal of ruby and other tool checks from configure, and generates a much better documentation file. tested x86/linux -benjamin2012-01-17 Benjamin Kosnik b...@redhat.com * configure.ac (BUILD_EPUB): Adjust for epub3. * configure: Regenerate. * Makefile.in: Same. * doc/Makefile.am (stamp-epub-docbook): Update for epub3. * doc/Makefile.in: Regenerate. * include/Makefile.in: Same. * libsupc++/Makefile.in: Same. * po/Makefile.in: Same. * python/Makefile.in: Same. * src/Makefile.in: Same. * testsuite/Makefile.in: Same. * doc/xml/manual/documentation_hacking.xml: Update. diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index d453f63..1c62aea 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -373,18 +373,21 @@ AM_CONDITIONAL(BUILD_MAN, test $ac_cv_prog_DOXYGEN = yes test $ac_cv_prog_DOT = yes) -# Check for pdf/epub dependencies. +# Check for pdf dependencies. AC_CHECK_PROG([DBLATEX], dblatex, yes, no) AC_CHECK_PROG([PDFLATEX], pdflatex, yes, no) AM_CONDITIONAL(BUILD_PDF, test $ac_cv_prog_DBLATEX = yes test $ac_cv_prog_PDFLATEX = yes) -AC_CHECK_PROG([RUBY], ruby, yes, no) -AC_CHECK_PROG([DBTOEPUB], dbtoepub, yes, no) +# Check for epub dependencies. +AC_CHECK_FILE(/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/epub3/chunk.xsl, + ac_cv_file_epub3_a=yes, ac_cv_file_epub3_a=no) +AC_CHECK_FILE(/usr/share/sgml/docbook/xsl-ns-stylesheets/epub3/chunk.xsl, + ac_cv_file_epub3_b=yes, ac_cv_file_epub3_b=no) AM_CONDITIONAL(BUILD_EPUB, - test $ac_cv_prog_RUBY = yes - test $ac_cv_prog_DBTOEPUB = yes) + test $ac_cv_file_epub3_a = yes || + test $ac_cv_file_epub3_b = yes) # Propagate the target-specific source directories through the build chain. diff --git a/libstdc++-v3/doc/Makefile.am b/libstdc++-v3/doc/Makefile.am index 3cb6dce..0f7b285 100644 --- a/libstdc++-v3/doc/Makefile.am +++ b/libstdc++-v3/doc/Makefile.am @@ -467,10 +467,11 @@ XSLT_PARAM = --param toc.section.depth 4 XSL_FO_STYLE = $(XSL_STYLE_DIR)/fo/docbook.xsl XSL_HTML_STYLE = $(XSL_STYLE_DIR)/xhtml-1_1/chunk.xsl XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/xhtml-1_1/docbook.xsl -XSL_EPUB_STYLE = $(XSL_STYLE_DIR)/epub/docbook.xsl +XSL_EPUB_STYLE = $(XSL_STYLE_DIR)/epub3/chunk.xsl ${docbook_outdir}/epub: mkdir -p ${docbook_outdir}/epub + mkdir -p ${docbook_outdir}/epub/OEBPS/images ${docbook_outdir}/fo: mkdir -p ${docbook_outdir}/fo @@ -592,20 +593,25 @@ doc-texinfo-docbook: stamp-texinfo-docbook doc-info-docbook: stamp-info-docbook -# EPUB, via ruby + dbtoepub -# Can verify document with: epubcheck +# EPUB version 3 +# http://sourceforge.net/projects/docbook/files/epub3/ +# Can verify document with epubcheck manual_epub = ${docbook_outdir}/epub/libstdc++-manual.epub stamp-epub-docbook: stamp-xml-single-docbook ${docbook_outdir}/epub @echo Generating epub files... if [ ! -d ${docbook_outdir}/images ]; then \ $(LN_S) ${top_srcdir}/doc/xml/images ${docbook_outdir}/; \ fi - ${XSL_STYLE_DIR}/epub/bin/dbtoepub -v -d -o ${manual_epub} ${set_xml} + $(XSLTPROC) $(XSLT_PARAM) $(XSLT_FLAGS) \ + --stringparam base.dir ${docbook_outdir}/epub/OEBPS/ \ + $(XSL_EPUB_STYLE) ${top_srcdir}/doc/xml/spine.xml + $(INSTALL_DATA) $(xml_images) ${docbook_outdir}/epub/OEBPS/images + zip -X0 ${manual_epub} ${docbook_outdir}/epub/mimetype + zip -r -X9 ${manual_epub} ${docbook_outdir}/epub/META-INF ${docbook_outdir}/epub/OEBPS $(STAMP) stamp-epub-docbook doc-epub-docbook: stamp-epub-docbook - # Performance doc and graph configuration. # Assumes pychart, beautiful soup installed. # Generates the plots/graph imagery for performance testing. diff --git a/libstdc++-v3/doc/xml/manual/documentation_hacking.xml b/libstdc++-v3/doc/xml/manual/documentation_hacking.xml index f6d7d55..2fe7692 100644 --- a/libstdc++-v3/doc/xml/manual/documentation_hacking.xml +++ b/libstdc++-v3/doc/xml/manual/documentation_hacking.xml @@ -611,6 +611,12 @@ entryinfo output/entry /row +row + entryepub3 stylesheets/entry + entryb3/entry + entryepub output/entry +/row + /tbody /tgroup /table @@ -675,6 +681,10 @@ For Texinfo output, something that transforms valid Docbook XML to Texinfo is required. The default choice is link xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://docbook2x.sourceforge.net/;docbook2X/link. /para + + para + For epub output, the link xmlns:xlink=http://www.w3.org/1999/xlink; xmlns:href=http://sourceforge.net/projects/docbook/files/epub3/;stylesheets/link for EPUB3 are required. These stylesheets are still in development. To validate the created file, link xmlns:xlink=http://www.w3.org/1999/xlink; xmlns:href=https://code.google.com/p/epubcheck/;epubcheck/link is necessary. + /para /section
[v3] doc updates
Regerate the html docs included in the source distribution. -benjamin 20120117-2.patch.bz2 Description: application/bzip
[v3] RFC libstdc++11convenience.la
This breaks separates the libstdc++ source files for C++11 from the C++03 sources, and puts C++11 files in a new source directory, src-c++11, which is compiled into libstdc++11convenience.a, and linked in to libstdc++ in the same manner that libsupc++ uses. Thus, no change to user-level or tool-level linking. To use C++11, you'd still just link in libstdc++. To use C++03, you'd still just link in libstdc++. The build rules for C++11 were established early on. This seems like a useful abstraction now that so many of the sources have to be built with C++11 flags. At some point, the continued ad hoc nature of src/Makefile.am's current approach will break down. At some other point, we might want to start building a libstdc++11 library with different flags from src/c++03. This is how to get there. tested x86/linux -benjamin2012-01-16 Benjamin Kosnik b...@redhat.com Add libstdc++11convenience.la. * src-c++11: New directory. * acinclude.m4: (GLIBCXX_CONFIGURE): Add src-c++11. * configure: Regenerated. * Makefile.am (hosted_source): Add src-c++11 to SUBDIRS. * Makefile.in: Regenerate. * libsupc++/Makefile.am (AM_CXXFLAGS): USe XTEMPLATE_FLAGS for -fno-implicit-templates. * libsupc++/Makefile.in: Regenerate. * src/Makefile.am (inst_sources): Move... C++11 files into separate directory for libstdc++11convenience.la. Files are: fstream-inst.cc, string-inst.cc, wlocale-inst.cc, wstring-inst.cc). (sources): Move C++11 files. Files are: compatibility-c++0x.cc, compatibility-atomic-c++0x.cc, debug.cc, functexcept.cc, functional.cc, hash_c++0x.cc, hashtable_c++0x.cc, limits.cc, system_error.cc, placeholders.cc, regex.cc, shared_ptr.cc, mutex.cc, condition_variable.cc, chrono.cc, thread.cc, future.cc. * src/Makefile.in: Regenerate. * src-c++11/Makefile.am: New. * src-c++11/Makefile.in: Generate. diff --git a/libstdc++-v3/Makefile.am b/libstdc++-v3/Makefile.am index f1b5b07..02d60e1 100644 --- a/libstdc++-v3/Makefile.am +++ b/libstdc++-v3/Makefile.am @@ -24,7 +24,7 @@ include $(top_srcdir)/fragment.am if GLIBCXX_HOSTED - hosted_source = doc src po testsuite + hosted_source = src-c++11 src doc po testsuite endif ## Keep this list sync'd with acinclude.m4:GLIBCXX_CONFIGURE. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 9d08178..0bb4d63 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -49,7 +49,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [ # Keep these sync'd with the list in Makefile.am. The first provides an # expandable list at autoconf time; the second provides an expandable list # (i.e., shell variable) at configure time. - m4_define([glibcxx_SUBDIRS],[include libsupc++ python src doc po testsuite]) + m4_define([glibcxx_SUBDIRS],[include libsupc++ python src-c++11 src doc po testsuite]) SUBDIRS='glibcxx_SUBDIRS' # These need to be absolute paths, yet at the same time need to diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am index fb5c26f..b27725d 100644 --- a/libstdc++-v3/libsupc++/Makefile.am +++ b/libstdc++-v3/libsupc++/Makefile.am @@ -104,8 +104,8 @@ libsupc__convenience_la_SOURCES = $(sources) $(c_sources) # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden # as the occasion call for it. AM_CXXFLAGS = \ - -fno-implicit-templates \ $(LIBSUPCXX_PICFLAGS) \ + $(XTEMPLATE_FLAGS) \ $(WARN_CXXFLAGS) \ $(OPTIMIZE_CXXFLAGS) \ $(CONFIG_CXXFLAGS) diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index eefa6e2..681f365 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -1,7 +1,7 @@ -## Makefile for the src subdirectory of the GNU C++ Standard library. +## Makefile for the C++11 sources of the GNU C++ Standard library. ## ## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -## 2006, 2007, 2008, 2009, 2010, 2011 +## 2006, 2007, 2008, 2009, 2010, 2011, 2012 ## Free Software Foundation, Inc. ## ## This file is part of the libstdc++ version 3 distribution. @@ -171,7 +171,6 @@ inst_sources = \ allocator-inst.cc \ concept-inst.cc \ ext-inst.cc \ - fstream-inst.cc \ ios-inst.cc \ iostream-inst.cc \ istream-inst.cc \ @@ -180,9 +179,7 @@ inst_sources = \ ostream-inst.cc \ sstream-inst.cc \ streambuf-inst.cc \ - string-inst.cc \ - wlocale-inst.cc \ - wstring-inst.cc + wlocale-inst.cc else XTEMPLATE_FLAGS = inst_sources = @@ -195,27 +192,19 @@ sources = \ mt_allocator.cc \ codecvt.cc \ compatibility.cc \ - compatibility-c++0x.cc \ - compatibility-atomic-c++0x.cc \ compatibility-debug_list.cc \ compatibility-debug_list-2.cc \ compatibility-list.cc \ compatibility-list-2.cc \ complex_io.cc \ ctype.cc \ - debug.cc \ - functexcept.cc \ - functional.cc \ globals_io.cc \ - hash_c++0x.cc \ hash_tr1.cc \ - hashtable_c++0x.cc \ hashtable_tr1.cc \ ios.cc \ ios_failure.cc \ ios_init.cc \ ios_locale.cc \ - limits.cc \ list.cc \ locale.cc
Re: [wwwdocs] gcc-4.7/porting_to.html
I went ahead and created a small patch with the changes above which is the second patch below and committed it. If you'd like to see some changes, just let me know. Thanks Gerald! This looks good. For the links, I just tried to add them where they'd been added before. Seems reasonable -benjamin
Re: [v3] Link libstdc++ with -lpthread on IRIX 6 (PR target/47852)
2011-02-25 Rainer Orth r...@cebitec.uni-bielefeld.de PR target/47852 * configure.host (irix6.5*): Add -lpthread to OPT_LDFLAGS. OK -benjamin
Re: [wwwdocs] gcc-4.7/porting_to.html
+ h3Boolean type promotion changes/h3 + + p + The C compiler no longer promotes boolean values in arithmetic + statements to integer values. Configure-related code that checks for + C99's lt;stdbool.hgt; may be impacted. If the following line is + newly present in configure logs, then lt;stdbool.hgt; support is + incorrectly configured. + /p This does not make sense to me as a description of any change in 4.7. + pre + checking for stdbool.h that conforms to C99... no + /pre That should have been fixed by: 2012-01-03 Richard Guenther rguent...@suse.de PR middle-end/51730 * fold-const.c (fold_comparison): Properly canonicalize tree offset and HOST_WIDE_INT bit position. Ah. Yes, this would explain why I can no longer reproduce it. Sorry, this analysis was done before the third of January. Thanks. I was hoping to get a better explanation of this change/issue and you've provided it. best, Benjamin
Re: [wwwdocs] gcc-4.7/porting_to.html
Here's the page with links, more validation fixes, and removal of the C item. best, Benjamin2012-01-12 Benjamin Kosnik b...@redhat.com * htdocs/gcc-4.7/porting_to.html: Fixup for validation. * htdocs/gcc-4.7/changes.html: Add link to porting_to.html. * htdocs/gcc-4.6/changes.html: Add link to porting_to.html. Index: htdocs/gcc-4.6/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.6/changes.html,v retrieving revision 1.136 diff -c -p -r1.136 changes.html *** htdocs/gcc-4.6/changes.html 30 Oct 2011 12:55:43 - 1.136 --- htdocs/gcc-4.6/changes.html 12 Jan 2012 19:33:38 - *** *** 125,130 --- 125,134 a href=../gcc-4.5/changes.html#obsoletedconfigurations obsoleted in GCC 4.5/a./li + liMore information on porting to GCC 4.6 from previous versions + of GCC can be found in + the a href=http://gcc.gnu.org/gcc-4.6/porting_to.html;porting + guide/a for this release./li /ul h2General Optimizer Improvements/h2 Index: htdocs/gcc-4.7/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v retrieving revision 1.72 diff -c -p -r1.72 changes.html *** htdocs/gcc-4.7/changes.html 30 Dec 2011 23:56:48 - 1.72 --- htdocs/gcc-4.7/changes.html 12 Jan 2012 19:33:38 - *** *** 50,55 --- 50,60 liSupport has been removed for the NetWare x86 configuration obsoleted in GCC 4.6./li + + liMore information on porting to GCC 4.7 from previous versions + of GCC can be found in + the a href=http://gcc.gnu.org/gcc-4.7/porting_to.html;porting + guide/a for this release./li /ul Index: htdocs/gcc-4.7/porting_to.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/porting_to.html,v retrieving revision 1.4 diff -c -p -r1.4 porting_to.html *** htdocs/gcc-4.7/porting_to.html 12 Jan 2012 19:30:54 - 1.4 --- htdocs/gcc-4.7/porting_to.html 12 Jan 2012 19:33:38 - *** Invalid options need to be removed from *** 54,76 by something that is valid. /p - h2C language issues/h2 - - h3Boolean type promotion changes/h3 - - p - The C compiler no longer promotes boolean values in arithmetic - statements to integer values. Configure-related code that checks for - C99's lt;stdbool.hgt; may be impacted. If the following line is - newly present in configure logs, then lt;stdbool.hgt; support is - incorrectly configured. - /p - - pre - checking for stdbool.h that conforms to C99... no - /pre - - h2C++ language issues/h2 h3Header dependency changes/h3 --- 54,59 *** const char *p = ldquo;foobarrdquo;__TI *** 237,248 pIn C++03, the code__TIME__/code macro expands to some string literal and is concatenated with the other one. In C++11 code__TIME__/code isn't expanded, instead operator ! code__TIME__/code is being looked up, resulting in the following diagnostic: /p pre ! error: unable to find string literal operator lsquo;operatorldquo;rdquo; __TIME__rsquo; /pre p --- 220,232 pIn C++03, the code__TIME__/code macro expands to some string literal and is concatenated with the other one. In C++11 code__TIME__/code isn't expanded, instead operator ! ldquo;rdquo; code__TIME__/code is being looked up, resulting in the following diagnostic: /p pre ! error: unable to find string literal operator ! lsquo;operatorldquo;rdquo; __TIME__rsquo; /pre p
[wwwdocs] gcc-4.7/porting_to.html
As requested by Jakub. I thought it better to get this in, warts and all, and have it be corrected than to dally around again and have it not checked in. -benjamin2012-01-11 Benjamin Kosnik b...@redhat.com * htdocs/gcc-4.7/porting_to.html: Add. Index: htdocs/gcc-4.7/porting_to.html === RCS file: htdocs/gcc-4.7/porting_to.html diff -N htdocs/gcc-4.7/porting_to.html *** /dev/null 1 Jan 1970 00:00:00 - --- htdocs/gcc-4.7/porting_to.html 12 Jan 2012 00:06:17 - *** *** 0 --- 1,266 + html + + head + titlePorting to GCC 4.7/title + /head + + body + h1Porting to GCC 4.7/h1 + + p + The GCC 4.7 release series differs from previous GCC releases in more + than the usual list of + a href=http://gcc.gnu.org/gcc-4.7/changes.html;changes/a. Some of + these are a result of bug fixing, and some old behaviors have been + intentionally changed in order to support new standards, or relaxed + in standards-conforming ways to facilitate compilation or runtime + performance. Some of these changes are not visible to the naked eye + and will not cause problems when updating from older versions. + /p + + p + However, some of these changes are visible, and can cause grief to + users porting to GCC 4.7. This document is an effort to identify major + issues and provide clear solutions in a quick and easily searched + manner. Additions and suggestions for improvement are welcome. + /p + + h2General issues/h2 + + h3Use of invalid flags when linking/h3 + + p + Earlier releases did not warn or error about completely invalid + options on gcc/g++/gfortran etc. command lines, if nothing was + compiled, but only linking was performed. This is no longer the + case. For example, + /p + + pre + gcc -Wl -o foo foo.o -mflat_namespace + /pre + + p + Now produces the following error + /p + + pre + error: unrecognized command line option â-Wlâ + error: unrecognized command line option â-mflat_namespaceâ + /pre + + p + Invalid options need to be removed from the command line or replaced + by something that is valid. + /p + + h2C language issues/h2 + + h3Boolean type promotion changes/h3 + + p + The C compiler no longer promotes boolean values in arithmetic + statements to integer values. Configure-related code that checks for + C99's lt;stdbool.hgt; may be impacted. If the following line is + newly present in configure logs, then lt;stdbool.hgt; support is + incorrectly configured. + /p + + pre + checking for stdbool.h that conforms to C99... no + /pre + + + h2C++ language issues/h2 + + h3Header dependency changes/h3 + + p + Many of the standard C++ library include files have been edited to no + longer include lt;unistd.hgt; to remove a href=http://gcc.gnu.org/PR49745;namespace pollution/a. + /p + + p + As such, C++ programs that used functions + including codetruncate/code, codesleep/code + or codepipe/code without first including lt;unistd.hgt; will no + longer compile. The diagnostic produced is similar to: + /p + + pre + error: âtruncateâ was not declared in this scope + /pre + + pre + error: âsleepâ was not declared in this scope + /pre + + pre + error: âpipeâ was not declared in this scope + /pre + + pre + error: there are no arguments to 'offsetof' that depend on a template + parameter, so a declaration of 'offsetof' must be available + /pre + + p + Fixing this issue is easy: just include lt;unistd.hgt;. + /p + + h3Note on proper checking for thread support/h3 + + p + At no time, should user-level code use private + GCC-implementation-space macros such as + code_GLIBCXX_HAS_GTHREADS/code to determine at compile-time + concurrency support. Instead, use the POSIX + macro code_REENTRANT/code. + /p + + h3Name lookup changes/h3 + + p + The C++ compiler no longer performs an extra unqualified lookups that + had performed in the past, namely a href=http://gcc.gnu.org/PR24163;dependant base class scope lookups/a and + a href=http://gcc.gnu.org/PR29131;unqualified template function/a + lookups. + /p + + p + C++ programs that depended on the compiler's previous behavior may + longer compile. For example, code such as + /p + + pre + templatetypename T + int t(T i) + { return f(i); } + + int + f(int i) + { return i; } + + int + main() + { + return t(1); + } + /pre + + + p + Will result in the following diagnostic: + /p + pre + In instantiation of âint t(T) [with T = int]â: + required from here + error: âfâ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] + note: âint f(int)â declared here, later in the translation unit + /pre + + p + To fix, make sure the function codef/code in the code above is + declared before first use in function codet/code. Like so: + /p + + pre + int + f(int i) + { return i; } + + templatetypename T + int t(T i) + { return f(i); } + + int + main
Re: [wwwdocs] gcc-4.7/porting_to.html
validation fixups... -benjamin2012-01-11 Benjamin Kosnik b...@redhat.com * htdocs/gcc-4.7/porting_to.html: Fixup for validation. Index: htdocs/gcc-4.7/porting_to.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/porting_to.html,v retrieving revision 1.1 diff -c -p -r1.1 porting_to.html *** htdocs/gcc-4.7/porting_to.html 12 Jan 2012 00:08:30 - 1.1 --- htdocs/gcc-4.7/porting_to.html 12 Jan 2012 01:09:24 - *** longer compile. For example, code such a *** 133,139 /p pre ! templatetypename T int t(T i) { return f(i); } --- 133,139 /p pre ! templatelt;typename Tgt; int t(T i) { return f(i); } *** int *** 169,175 f(int i) { return i; } ! templatetypename T int t(T i) { return f(i); } --- 169,175 f(int i) { return i; } ! templatelt;typename Tgt; int t(T i) { return f(i); }
Re: [wwwdocs] gcc-4.7/porting_to.html
validation fixups... More of them -benjamin2012-01-11 Benjamin Kosnik b...@redhat.com * htdocs/gcc-4.7/porting_to.html: Fixup for validation. Index: htdocs/gcc-4.7/porting_to.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/porting_to.html,v retrieving revision 1.2 diff -c -r1.2 porting_to.html *** htdocs/gcc-4.7/porting_to.html 12 Jan 2012 01:11:40 - 1.2 --- htdocs/gcc-4.7/porting_to.html 12 Jan 2012 02:51:05 - *** *** 45,52 /p pre ! error: unrecognized command line option â-Wlâ ! error: unrecognized command line option â-mflat_namespaceâ /pre p --- 45,52 /p pre ! error: unrecognized command line option lsquo;-Wlrsquo; ! error: unrecognized command line option lsquo;-mflat_namespacersquo; /pre p *** *** 88,102 /p pre ! error: âtruncateâ was not declared in this scope /pre pre ! error: âsleepâ was not declared in this scope /pre pre ! error: âpipeâ was not declared in this scope /pre pre --- 88,102 /p pre ! error: lsquo;truncatersquo; was not declared in this scope /pre pre ! error: lsquo;sleeprsquo; was not declared in this scope /pre pre ! error: lsquo;pipersquo; was not declared in this scope /pre pre *** *** 153,162 Will result in the following diagnostic: /p pre ! In instantiation of âint t(T) [with T = int]â: required from here ! error: âfâ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] ! note: âint f(int)â declared here, later in the translation unit /pre p --- 153,162 Will result in the following diagnostic: /p pre ! In instantiation of lsquo;int t(T) [with T = int]rsquo; required from here ! error: lsquo;frsquo; was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] ! note: lsquo;int f(int)rsquo; declared here, later in the translation unit /pre p *** *** 209,216 p pre ! error: redeclaration of âint iâ ! error: âint iâ previously declared here /pre p --- 209,216 p pre ! error: redeclaration of lsquo;int irsquo; ! error: lsquo;int irsquo; previously declared here /pre p *** *** 221,244 h3User-defined literals and whitespace/h3 p ! The C++ compiler in ISO C11 mode -std={c++11,c++0x,gnu++11,gnu++0x} supports user defined literals, which are incompatible with some valid ISO C++03 code. /p p ! In particular, whitespace is now needed after a string literal and before something that could be a valid user defined literal. Take the valid ISO C++03 code /p pre ! const char *p = foobar__TIME__; /pre ! pIn C++03, the code__TIME__/code macro expands to some string literal and is concatenated with the other one. In C++11 code__TIME__/code isn't expanded, instead operator code__TIME__/code is being looked up, resulting in the following diagnostic: /p pre ! error: unable to find string literal operator âoperator __TIME__â /pre p --- 221,250 h3User-defined literals and whitespace/h3 p ! The C++ compiler in ISO C11 mode codestd={c++11,c++0x,gnu++11,gnu++0x}/code supports user defined literals, which are incompatible with some valid ISO C++03 code. /p p ! In particular, whitespace is now needed after a string literal and ! before something that could be a valid user defined literal. Take the ! valid ISO C++03 code /p pre ! const char *p = ldquo;foobarrdquo;__TIME__; /pre ! pIn C++03, the code__TIME__/code macro expands to some string ! literal and is concatenated with the other one. In ! C++11 code__TIME__/code isn't expanded, instead operator ! code__TIME__/code is being looked up, resulting in the ! following diagnostic: /p pre ! error: unable to find string literal operator lsquo;operatorldquo;rdquo; __TIME__rsquo; /pre p
[v3] add -Wabi to build flags
As requested by Jason, I've added -Wabi to the libstdc++ build flags. The patch is trivial. The results are in line with what we expect. After I did this part and verified the build went swimmingly, I ran the testsuite with -Wabi as well. This part had some problems, I'm getting some odd results (things like constexpr functions being marked as changing with -fabi-version=3, which makes no sense to me.) I've filed this stuff in bugzilla with some notes, see the link for more info: http://gcc.gnu.org/PR51804 As an aside, the mangling changes for -fabi-version=3 look like they will impact a lot of code. tested x86/linux -benjamin2012-01-09 Benjamin Kosnik b...@redhat.com * fragment.am (WARN_CXXFLAGS): Add -Wabi. * Makefile.in: Regenerate. * doc/Makefile.in: Same. * include/Makefile.in: Same. * libsupc++/Makefile.in: Same. * src/Makefile.in: Same. * testsuite/Makefile.in: Same. * po/Makefile.in: Same. * python/Makefile.in: Same. diff --git a/libstdc++-v3/fragment.am b/libstdc++-v3/fragment.am index cae1ffd..2bcbc1a 100644 --- a/libstdc++-v3/fragment.am +++ b/libstdc++-v3/fragment.am @@ -18,7 +18,7 @@ toolexeclibdir = $(glibcxx_toolexeclibdir) CONFIG_CXXFLAGS = \ $(SECTION_FLAGS) $(EXTRA_CXX_FLAGS) -frandom-seed=$@ WARN_CXXFLAGS = \ - $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once + $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once -Wabi # -I/-D flags to pass when compiling. AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
[wwwdocs] correct libstdc++ links
Correct libstdc++ naming convention to be the same as used by the other html tarballs, ie library-html.tar.bz2. I just checked this in as I was fixing the recent gcc mailing list report of broken links. -benjamin2012-01-09 Benjamin Kosnik b...@redhat.com * onlinedocs/index.html: Use same naming conventions for html tarballs as the rest of the gcc docs. Index: onlinedocs/index.html === RCS file: /cvs/gcc/wwwdocs/htdocs/onlinedocs/index.html,v retrieving revision 1.120 diff -r1.120 index.html 68c68 href=http://gcc.gnu.org/onlinedocs/gcc-4.6.2/libstdc++/libstdc++-manual.html.tar.bz2;an --- href=http://gcc.gnu.org/onlinedocs/gcc-4.6.2/libstdc++/libstdc++-manual-html.tar.bz2;an 75c75 href=http://gcc.gnu.org/onlinedocs/gcc-4.6.2/libstdc++/libstdc++-api.html.tar.bz2;an --- href=http://gcc.gnu.org/onlinedocs/gcc-4.6.2/libstdc++/libstdc++-api-html.tar.bz2;an
Re: [patch libstdc++]: Fix PR/51673
This is ok, but I realized that some of the newer CXXABI symbols were missing, so I added them as well and then checked all of this in. See attached patch. best, Benjamin 2012-01-09 Kai Tietz kti...@redhat.com PR libstc++/51673 part 2 * config/abi/pre/gnu-versioned-namespace.ver: Adjusted new/delete operators signature for LLP64 size_t, and adjusted signatures for mt-allocator using size_t. 2012-01-09 Benjamin Kosnik b...@redhat.com PR libstc++/51673 part 1 * config/abi/pre/gnu-versioned-namespace.ver: Sync cxxabi symbols with gnu.ver. diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver index 13f06ef..2bd23cd 100644 --- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver +++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver @@ -1,6 +1,6 @@ ## Linker script for GNU namespace versioning. ## -## Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009, 2011 +## Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009, 2011, 2012 ## Free Software Foundation, Inc. ## ## This file is part of the libstdc++ version 3 distribution. @@ -42,9 +42,9 @@ GLIBCXX_7.0 { __once_proxy; # operator new(size_t) -_Znw[jm]; +_Znw[jmy]; # operator new(size_t, std::nothrow_t const) -_Znw[jm]RKSt9nothrow_t; +_Znw[jmy]RKSt9nothrow_t; # operator delete(void*) _ZdlPv; @@ -52,9 +52,9 @@ GLIBCXX_7.0 { _ZdlPvRKSt9nothrow_t; # operator new[](size_t) -_Zna[jm]; +_Zna[jmy]; # operator new[](size_t, std::nothrow_t const) -_Zna[jm]RKSt9nothrow_t; +_Zna[jmy]RKSt9nothrow_t; # operator delete[](void*) _ZdaPv; @@ -93,16 +93,16 @@ GLIBCXX_7.0 { # __gnu_cxx::__pool _ZN9__gnu_cxx3__76__poolILb[01]EE13_M_initializeEv; -_ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reserve_blockE[jm][jm]; -_ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reclaim_blockEPc[jm]; +_ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reserve_blockE[jmy][jmy]; +_ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reclaim_blockEPc[jmy]; _ZN9__gnu_cxx3__76__poolILb[01]EE10_M_destroyEv; _ZN9__gnu_cxx3__76__poolILb1EE16_M_get_thread_idEv; -_ZN9__gnu_cxx3__717__pool_alloc_base9_M_refillE[jm]; -_ZN9__gnu_cxx3__717__pool_alloc_base16_M_get_free_listE[jm]; +_ZN9__gnu_cxx3__717__pool_alloc_base9_M_refillE[jmy]; +_ZN9__gnu_cxx3__717__pool_alloc_base16_M_get_free_listE[jmy]; _ZN9__gnu_cxx3__717__pool_alloc_base12_M_get_mutexEv; -_ZN9__gnu_cxx3__79free_list6_M_getE[jm]; +_ZN9__gnu_cxx3__79free_list6_M_getE[jmy]; _ZN9__gnu_cxx3__79free_list8_M_clearEv; # __gnu_cxx::stdio_sync_filebuf @@ -145,16 +145,19 @@ CXXABI_2.0 { global: __cxa_allocate_exception; +__cxa_allocate_dependent_exception; __cxa_bad_cast; __cxa_bad_typeid; __cxa_begin_catch; __cxa_begin_cleanup; __cxa_call_unexpected; __cxa_current_exception_type; +__cxa_deleted_virtual; __cxa_demangle; __cxa_end_catch; __cxa_end_cleanup; __cxa_free_exception; +__cxa_free_dependent_exception; __cxa_get_exception_ptr; __cxa_get_globals; __cxa_get_globals_fast; @@ -199,6 +202,11 @@ CXXABI_2.0 { _ZSt17current_exceptionv; _ZSt17rethrow_exceptionNSt15__exception_ptr13exception_ptrE; +# std::nested_exception +_ZNSt16nested_exceptionD*; +_ZTISt16nested_exception; +_ZTVSt16nested_exception; + # std::bad_function_call. _ZNSt17bad_function_callD*; _ZTISt17bad_function_call; @@ -287,6 +295,11 @@ CXXABI_2.0 { _ZTIPDn; _ZTIPKDn; +# typeinfo for __int128 and unsigned __int128 +_ZTI[no]; +_ZTIP[no]; +_ZTIPK[no]; + # virtual table _ZTVN10__cxxabiv117__array_type_infoE; _ZTVN10__cxxabiv117__class_type_infoE;
[v3] fix num_put/.../9780-2 for recent glibcs
This removes a new fail that happens on bleeding edge linux with the testcase in the subject line. The behavior of the es_ES locale with respect to grouping has changed in some version of glibc around 2.14.90-x. It used to have no grouping, and now it has the usual /003/003 grouping that one would expect. So, I've modified the test case to deal with both cases, and add some commentary. With this, libstdc++ is back to zero fails on F16. Yay. Tis a bit of a hack, but there is no ios_base::showgrouping and corresponding manipulator to control the output of grouping characters in the standard. I consider this a bug, and am in support of resolving LWG-982 in a way that has some utility to C++ programmers. To this end, I have drafted language for a proposed resolution and sent it to the LWG chair. best, Benjamin tested x86/linux f14 -- glibc-2.13-2 tested x86/linux f16 -- glibc 2.14.90-212011-12-15 Benjamin Kosnik b...@redhat.com * testsuite/22_locale/num_put/put/char/9780-2.cc: Add test for C locale, add sanity checks in case of grouping. diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/9780-2.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/9780-2.cc index 7993691..5cf0d04 100644 --- a/libstdc++-v3/testsuite/22_locale/num_put/put/char/9780-2.cc +++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/9780-2.cc @@ -1,7 +1,7 @@ // { dg-require-namedlocale de_DE } // { dg-require-namedlocale es_ES } -// Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2009, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -22,23 +22,60 @@ #include locale #include testsuite_hooks.h -int main() +// Make sure that formatted output uses the locale in the output stream. +using namespace std; +locale l1 = locale(de_DE); +const num_putchar np = use_facetnum_putchar (l1); +const numpunctchar npunct = use_facetnumpunctchar (l1); + +void test01() { - using namespace std; + bool test __attribute__((unused)) = true; + + locale l2 = locale(C); + const numpunctchar npunct2 = use_facetnumpunctchar (l2); + char c = npunct2.thousands_sep(); + string s = npunct2.grouping(); + + ostringstream oss; + oss.imbue(l2); + + long l = 1234567890; + np.put(oss.rdbuf(), oss, ' ', l); + string res = oss.str(); + + VERIFY( res == 1234567890 ); +} +void test02() +{ bool test __attribute__((unused)) = true; - locale l1 = locale(de_DE); + locale l2 = locale(es_ES); - - const num_putchar np = use_facetnum_putchar (l1); + const numpunctchar npunct3 = use_facetnumpunctchar (l2); + char c = npunct3.thousands_sep(); + string s = npunct3.grouping(); + ostringstream oss; oss.imbue(l2); long l = 1234567890; - np.put(oss.rdbuf(), oss, ' ', l); // 1234567890 + np.put(oss.rdbuf(), oss, ' ', l); string res = oss.str(); - - VERIFY( res == 1234567890 ); + if (!s.empty()) +VERIFY( res == 1.234.567.890 ); + else +VERIFY( res == 1234567890 ); +} + +int main() +{ + // Sanity check. + char c = npunct.thousands_sep(); + string s = npunct.grouping(); + + test01(); + test02(); return 0; }
Re: [v3] doxygen warnings
This patch just removes/restructures some of the doxygen markup to avoid warnings when generating the documentation. Most of the libstdc++ headers are pretty doxygen clean now. By the way, I recently made this feature request for Doxygen: https://bugzilla.gnome.org/show_bug.cgi?id=665506 That would allow us to refer to pos not __pos in the doxygen comments, and for the generated docs to be much nicer to read, without uglified names. Awesome. That would be useful. At this point, most of the libstdc++ headers have pretty much warning-free docs, at least with current doxygen binaries. The macro trickery in PB_DS kind of makes doxygen go crazy. And some of the new C++11 features like variadic and mutable/default/deleted etc. result in weird/humorous messages. That said, the latest doxygen (1.7.6?) fails miserably, on cxxabi.h no less. And the PDF_HYPERLINKS issue is still present. Some of the time I think I can at least pinpoint the file with the markup that is making this crazy/bad by editing out docs/doxygen/user.cfg.in to only be all the files in bits or all the files in ext, etc. Alas, I've not been able to get anything reproducible. But this argument thing would really be nice to have. I went ahead and uglified the markup in algorithm since that was triggering so many warnings elsewere. -benjamin
Re: [v3] RFC: rename __calculate_memory_order
* include/bits/atomic_base.h (__calculate_memory_order): Rename to... (__cmpexch_failure_order): This, and rewrite as constexpr function. (compare_exchange_strong, compare_exchange_weak): Use it. * include/std/atomic (compare_exchange_strong, compare_exchange_weak): Likewise. Tested x86_64-linux. looks great to me. More constexpr, what's not to like? -benjamin
Re: [PATCH] Re: [v3] updated atomic configury
Thanks Andrew. Here's the updated patch, as checked in. This removes one level of cruft WRT atomic configure-ness (leaving us with the most primordial...). tested x86/linux tested x86/linux x arm-eabi tested x86/linux x cris-elf -benjamin 2011-11-30 Benjamin Kosnik b...@redhat.com * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Remove size-specific macros. _GLIBCXX_ATOMIC_BUILTINS_1, _GLIBCXX_ATOMIC_BUILTINS_2, _GLIBCXX_ATOMIC_BUILTINS_4, _GLIBCXX_ATOMIC_BUILTINS_8. Use _GLIBCXX_ATOMIC_BUILTINS to indicate use of C++11 atomic builtins. * config.h.in: Regenerate. * configure: Regenerate. * include/Makefile.am (bits_sup_headers): Add atomic_lockfree_defines.h. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am: Compile C++11 support with -std=gnu++0x. * libsupc++/Makefile.in: Regenerate. * include/bits/atomic_base.h: Move lock-free property macros... * libsupc++/atomic_lockfree_defines.h: ...here. * include/std/future: Use C++11 macros. * libsupc++/eh_ptr.cc: Same. * libsupc++/eh_throw.cc: Same. * libsupc++/exception: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/guard.cc: Same. * libsupc++/nested_exception.cc: Same. * libsupc++/nested_exception.h: Same. * src/future.cc: Same. * include/ext/atomicity.h: Use _GLIBCXX_ATOMIC_BUILTINS. * doc/doxygen/user.cfg.in * doc/xml/manual/concurrency_extensions.xml * testsuite/18_support/exception_ptr/lifespan.cc * testsuite/lib/libstdc++.exp diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index fee5c6f..9d08178 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -2683,12 +2683,6 @@ dnl dnl Note: dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD. dnl -dnl Defines: -dnl _GLIBCXX_ATOMIC_BUILTINS_1 -dnl _GLIBCXX_ATOMIC_BUILTINS_2 -dnl _GLIBCXX_ATOMIC_BUILTINS_4 -dnl _GLIBCXX_ATOMIC_BUILTINS_8 -dnl AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ AC_LANG_SAVE AC_LANG_CPLUSPLUS @@ -2729,10 +2723,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [glibcxx_cv_atomic_bool=yes], [glibcxx_cv_atomic_bool=no]) ]) - if test $glibcxx_cv_atomic_bool = yes; then -AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1, - [Define if builtin atomic operations for bool are supported on this host.]) - fi AC_MSG_RESULT($glibcxx_cv_atomic_bool) AC_MSG_CHECKING([for atomic builtins for short]) @@ -2751,10 +2741,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [glibcxx_cv_atomic_short=yes], [glibcxx_cv_atomic_short=no]) ]) - if test $glibcxx_cv_atomic_short = yes; then -AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1, - [Define if builtin atomic operations for short are supported on this host.]) - fi AC_MSG_RESULT($glibcxx_cv_atomic_short) AC_MSG_CHECKING([for atomic builtins for int]) @@ -2773,10 +2759,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [glibcxx_cv_atomic_int=yes], [glibcxx_cv_atomic_int=no]) ]) - if test $glibcxx_cv_atomic_int = yes; then -AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1, - [Define if builtin atomic operations for int are supported on this host.]) - fi AC_MSG_RESULT($glibcxx_cv_atomic_int) AC_MSG_CHECKING([for atomic builtins for long long]) @@ -2795,10 +2777,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [glibcxx_cv_atomic_long_long=yes], [glibcxx_cv_atomic_long_long=no]) ]) - if test $glibcxx_cv_atomic_long_long = yes; then -AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1, - [Define if builtin atomic operations for long long are supported on this host.]) - fi AC_MSG_RESULT($glibcxx_cv_atomic_long_long) else @@ -2832,8 +2810,6 @@ EOF if grep __sync_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_bool=no else - AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1, - [Define if builtin atomic operations for bool are supported on this host.]) glibcxx_cv_atomic_bool=yes fi fi @@ -2862,8 +2838,6 @@ EOF if grep __sync_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_short=no else - AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1, - [Define if builtin atomic operations for short are supported on this host.]) glibcxx_cv_atomic_short=yes fi fi @@ -2893,8 +2867,6 @@ EOF if grep __sync_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_int=no else - AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1, - [Define if builtin atomic operations for int are supported on this host.]) glibcxx_cv_atomic_int=yes fi fi @@ -2923,8 +2895,6 @@ EOF if grep __sync_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_long_long=no else - AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1, - [Define if builtin atomic operations for long long are supported on this host
[v3] updated atomic configury
Here's the first step in making the libstdc++ atomic configure bits into something that makes more sense. This consolidates the builtin parts of the configury, such that builtins mean C++11 atomics, not C++11 atomics mixed with pre-C++11 atomics. I think this is mostly right, modulo my logic on the equivalency of ATOMIC_INT_LOCK_FREE == _GLIBCXX_ATOMIC_BUILTINS_4. This is something that should hold, IMHO. I was expecting the C++11 macros for lock-free properties, ie ATOMIC_BOOL_LOCK_FREE to be either 0, 1, 2, and to be able to use them like: #if (ATOMIC_INT_LOCK_FREE 1) // yes, cool, yeah! #endif But this doesn't seem to work. And what I have in this patch, which is #if defined(ATOMIC_INT_LOCK_FREE) doesn't really say the same thing... -benjamin tested x86/linux tested x86/linux x cris-elf tested x86/linux x arm-eabi-elf2011-11-21 Benjamin Kosnik b...@redhat.com * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Remove size-specific macros. _GLIBCXX_ATOMIC_BUILTINS_1, _GLIBCXX_ATOMIC_BUILTINS_2, _GLIBCXX_ATOMIC_BUILTINS_4, _GLIBCXX_ATOMIC_BUILTINS_8. Use _GLIBCXX_ATOMIC_BUILTINS to indicate use of C++11 atomic builtins. * config.h.in: Regenerate. * configure: Regenerate. * include/Makefile.am (bits_sup_headers): Add atomic_lockfree_defines.h. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am: Compile C++11 support with -std=gnu++0x. * libsupc++/Makefile.in: Regenerate. * include/bits/atomic_base.h: Move lock-free property macros... * libsupc++/atomic_lockfree_defines.h: ...here. * include/std/future: Use C++11 macros. * libsupc++/eh_ptr.cc: Same. * libsupc++/eh_throw.cc: Same. * libsupc++/exception: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/guard.cc: Same. * libsupc++/nested_exception.cc: Same. * libsupc++/nested_exception.h: Same. * src/future.cc: Same. * include/ext/atomicity.h: Use _GLIBCXX_ATOMIC_BUILTINS. * doc/doxygen/user.cfg.in * doc/xml/manual/concurrency_extensions.xml * testsuite/18_support/exception_ptr/lifespan.cc * testsuite/lib/libstdc++.exp diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index fee5c6f..9d08178 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -2683,12 +2683,6 @@ dnl dnl Note: dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD. dnl -dnl Defines: -dnl _GLIBCXX_ATOMIC_BUILTINS_1 -dnl _GLIBCXX_ATOMIC_BUILTINS_2 -dnl _GLIBCXX_ATOMIC_BUILTINS_4 -dnl _GLIBCXX_ATOMIC_BUILTINS_8 -dnl AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ AC_LANG_SAVE AC_LANG_CPLUSPLUS @@ -2729,10 +2723,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [glibcxx_cv_atomic_bool=yes], [glibcxx_cv_atomic_bool=no]) ]) - if test $glibcxx_cv_atomic_bool = yes; then -AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1, - [Define if builtin atomic operations for bool are supported on this host.]) - fi AC_MSG_RESULT($glibcxx_cv_atomic_bool) AC_MSG_CHECKING([for atomic builtins for short]) @@ -2751,10 +2741,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [glibcxx_cv_atomic_short=yes], [glibcxx_cv_atomic_short=no]) ]) - if test $glibcxx_cv_atomic_short = yes; then -AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1, - [Define if builtin atomic operations for short are supported on this host.]) - fi AC_MSG_RESULT($glibcxx_cv_atomic_short) AC_MSG_CHECKING([for atomic builtins for int]) @@ -2773,10 +2759,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [glibcxx_cv_atomic_int=yes], [glibcxx_cv_atomic_int=no]) ]) - if test $glibcxx_cv_atomic_int = yes; then -AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1, - [Define if builtin atomic operations for int are supported on this host.]) - fi AC_MSG_RESULT($glibcxx_cv_atomic_int) AC_MSG_CHECKING([for atomic builtins for long long]) @@ -2795,10 +2777,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ [glibcxx_cv_atomic_long_long=yes], [glibcxx_cv_atomic_long_long=no]) ]) - if test $glibcxx_cv_atomic_long_long = yes; then -AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1, - [Define if builtin atomic operations for long long are supported on this host.]) - fi AC_MSG_RESULT($glibcxx_cv_atomic_long_long) else @@ -2832,8 +2810,6 @@ EOF if grep __sync_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_bool=no else - AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1, - [Define if builtin atomic operations for bool are supported on this host.]) glibcxx_cv_atomic_bool=yes fi fi @@ -2862,8 +2838,6 @@ EOF if grep __sync_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_short=no else - AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1, - [Define if builtin atomic operations for short are supported on this host.]) glibcxx_cv_atomic_short=yes fi fi @@ -2893,8 +2867,6 @@ EOF if grep __sync_ conftest.s /dev/null 21 ; then glibcxx_cv_atomic_int=no else - AC_DEFINE
Re: cxx-mem-model merge [6 of 9] - libstdc++-v3
I just realized I may be feeding you an inconsistent configuration, see the atomicity stuff in libstdc++-v3/config/cpu/cris. Is that just obsolete and unused now or what do I need to add for that to work? You don't need to do anything there. I think that atomicity stuff will soon be obsolete, but bkoz will have to answer that question. It looks to me like that was some gnu atomic extentions which predate atomic support in the standard. In theory, that would all be able to go away or be integrated into the gcc machine description with the modern patterns, if its not already there. That is very obsolete and should be removed as it's now just causing confusion. That was pre-builtin days, let's call this atomics-try-1. So, all: config/cpu/*/atomicity.h ./i486/atomicity.h ./i386/atomicity.h ./sparc/atomicity.h ./sh/atomicity.h ./m68k/atomicity.h ./cris/atomicity.h ./hppa/atomicity.h ./generic/atomicity_mutex/atomicity.h ./generic/atomicity_builtins/atomicity.h ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR ATOMIC_FLAGS Should go. I'll look in to peeling off this cruft sharpish. bkoz: As relates to the existing problem, how is the legacy support invoked in compatibility-atomic-c++0x.cc? That has the old style implementation of atomic_flag with a lock, which would allow this target to compile... which is another option perhaps. or is that purely for pervious releases somehow? compatibility-atomic-c++0x.cc is the support for previous builtins attempt, let's call this atomics-try-2. We need to keep these symbols exported and doing the same thing done in previous releases. (Or else abi-check will fail.) If this system used to use a lock to work, then that is what it should still do. The behavior shouldn't change. -benjamin
Re: [v3] doxygen markup for tr2
One more buglet -benjamin2011-11-04 Benjamin Kosnik b...@redhat.com * scripts/run_doxygen: Fix sed quoting. diff --git a/libstdc++-v3/scripts/run_doxygen b/libstdc++-v3/scripts/run_doxygen index 3fef95f..7b601bc 100644 --- a/libstdc++-v3/scripts/run_doxygen +++ b/libstdc++-v3/scripts/run_doxygen @@ -261,7 +261,7 @@ for f in $problematic; do # this is also slow, but safe and easy to debug oldh=`sed -n '/fC#include /s/.*\(.*\).*/\1/p' $f` newh=`echo $oldh | ./stdheader` -sed s=${oldh}=${newh}= $f TEMP +sed 's=${oldh}=${newh}=' $f TEMP mv TEMP $f done rm stdheader
[v3] doxygen markup for tr2
Some doxygen markup tweaks to get the tr2 components to show up. Also, I've regenerated doc/html. tested x86/linux -benjamin 2011-11-03 Benjamin Kosnik b...@redhat.com * doc/doxygen/doxygroups.cc: Add markup for namespace tr2. * include/tr2/bool_set: Adjust doxygen markup. * include/tr2/dynamic_bitset: Same. * include/tr2/type_traits: Same. diff --git a/libstdc++-v3/doc/doxygen/doxygroups.cc b/libstdc++-v3/doc/doxygen/doxygroups.cc index 0017538..1212b6f 100644 --- a/libstdc++-v3/doc/doxygen/doxygroups.cc +++ b/libstdc++-v3/doc/doxygen/doxygroups.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001, 2002, 2005, 2008, 2009, 2010 + Copyright (C) 2001, 2002, 2005, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. See license.html for license. @@ -29,6 +29,12 @@ /** @namespace std::tr1::__detail * @brief Implementation details not part of the namespace std::tr1 interface. */ +/** @namespace std::tr2 + * @brief ISO C++ TR2 entities toplevel namespace is std::tr2. +*/ +/** @namespace std::tr2::__detail + * @brief Implementation details not part of the namespace std::tr2 interface. +*/ /** @namespace __gnu_cxx * @brief GNU extensions for public use. */ diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in index 0b01ceb..e5d8c98 100644 --- a/libstdc++-v3/doc/doxygen/user.cfg.in +++ b/libstdc++-v3/doc/doxygen/user.cfg.in @@ -1389,7 +1389,7 @@ LATEX_FOOTER = # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. -PDF_HYPERLINKS = NO +PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a diff --git a/libstdc++-v3/include/tr2/bool_set b/libstdc++-v3/include/tr2/bool_set index fe32267..f577ed0 100644 --- a/libstdc++-v3/include/tr2/bool_set +++ b/libstdc++-v3/include/tr2/bool_set @@ -26,16 +26,6 @@ * This is a TR2 C++ Library header. */ -// -// Sort of an implementation of bool_set in n2136 Hervé Brönnimann, -// Guillaume Melquiond, Sylvain Pion. -// -// The implicit conversion to bool is slippery! I may use the new -// explicit conversion. This has been specialized in the language so -// that in contexts requiring a bool the conversion happens -// implicitly. Thus most objections should be eliminated. -// - #ifndef _GLIBCXX_TR2_BOOL_SET #define _GLIBCXX_TR2_BOOL_SET 1 @@ -50,6 +40,17 @@ namespace tr2 { _GLIBCXX_BEGIN_NAMESPACE_VERSION + /** + * bool_set + * + * See N2136, Bool_set: multi-valued logic + * by Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion. + * + * The implicit conversion to bool is slippery! I may use the new + * explicit conversion. This has been specialized in the language + * so that in contexts requiring a bool the conversion happens + * implicitly. Thus most objections should be eliminated. + */ class bool_set { public: @@ -60,7 +61,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Constructor from bool. bool_set(bool __t) : _M_b(_Bool_set_val(__t)) { } -/// // I'm not sure about this. bool contains(bool_set __b) const { return this-is_singleton() this-equals(__b); } diff --git a/libstdc++-v3/include/tr2/dynamic_bitset b/libstdc++-v3/include/tr2/dynamic_bitset index 5a4b794..b5c3bf3 100644 --- a/libstdc++-v3/include/tr2/dynamic_bitset +++ b/libstdc++-v3/include/tr2/dynamic_bitset @@ -120,11 +120,11 @@ public: } void - _M_assign(const __dynamic_bitset_baseblock_type, allocator_type __b) + _M_assign(const __dynamic_bitset_base __b) { this-_M_w = __b._M_w; } void - _M_swap(__dynamic_bitset_baseblock_type, allocator_type __b) + _M_swap(__dynamic_bitset_base __b) { this-_M_w.swap(__b._M_w); } void @@ -178,7 +178,7 @@ public: { return this-_M_w[_M_w.size() - 1]; } void - _M_do_and(const __dynamic_bitset_baseblock_type, allocator_type __x) + _M_do_and(const __dynamic_bitset_base __x) { if (__x._M_w.size() == this-_M_w.size()) for (size_t __i = 0; __i this-_M_w.size(); ++__i) @@ -188,7 +188,7 @@ public: } void - _M_do_or(const __dynamic_bitset_baseblock_type, allocator_type __x) + _M_do_or(const __dynamic_bitset_base __x) { if (__x._M_w.size() == this-_M_w.size()) for (size_t __i = 0; __i this-_M_w.size(); ++__i) @@ -198,7 +198,7 @@ public: } void - _M_do_xor(const __dynamic_bitset_baseblock_type, allocator_type __x) + _M_do_xor(const __dynamic_bitset_base __x) { if (__x._M_w.size() == this-_M_w.size()) for (size_t __i = 0; __i this-_M_w.size(); ++__i) @@ -208,7 +208,7 @@ public: } void - _M_do_dif(const __dynamic_bitset_baseblock_type, allocator_type __x) + _M_do_dif(const __dynamic_bitset_base __x
[v3] tr2 missing bits
Ooops, noticed some minor bits when I was regenerating the docs. Some of the TR2 man pages needed munging, and the c++config bits for versioning TR2 needed to go in. tested x86/linux best, benjamin 2011-11-02 Benjamin Kosnik b...@redhat.com * include/bits/c++config: Add tr2 to versioned namespaces. * scripts/run_doxygen: Adjust generated man files as well. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index f77da5e..e76e742 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -148,6 +148,8 @@ namespace __detail { } } +namespace tr2 { } + namespace decimal { } namespace chrono { } @@ -197,6 +199,9 @@ namespace std namespace __detail { inline namespace __7 { } } } + namespace tr2 + { inline namespace __7 { } } + namespace decimal { inline namespace __7 { } } namespace chrono { inline namespace __7 { } } diff --git a/libstdc++-v3/scripts/run_doxygen b/libstdc++-v3/scripts/run_doxygen index 48b1724..3fef95f 100644 --- a/libstdc++-v3/scripts/run_doxygen +++ b/libstdc++-v3/scripts/run_doxygen @@ -339,6 +339,10 @@ for f in std_tr1_*; do newname=`echo $f | sed 's/^std_tr1_/std::tr1::/'` mv $f $newname done +for f in std_tr2_*; do +newname=`echo $f | sed 's/^std_tr2_/std::tr2::/'` +mv $f $newname +done for f in std_*; do newname=`echo $f | sed 's/^std_/std::/'` mv $f $newname diff --git a/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc b/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc index 4e2d071..c6e6fea 100644 --- a/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc +++ b/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc @@ -25,4 +25,4 @@ #include vector -// { dg-error multiple inlined namespaces { target *-*-* } 258 } +// { dg-error multiple inlined namespaces { target *-*-* } 263 }
Re: Intrinsics for N2965: Type traits and base classes
Please post a ChangeLog entry with a patch. Someone added one for you: 2011-10-17 Michael Spertus mike_sper...@symantec.com * gcc/c-family/c-common.c (c_common_reswords): Add __bases, __direct_bases. * gcc/c-family/c-common.h: Add RID_BASES and RID_DIRECT_BASES. but it is in the wrong file (c-family has its own ChangeLog) and shouldn't contain the gcc/c-family prefix (paths are relative to the directory). Sorry Eric, this was my fault. I see that Paolo has already fixed this up. Thanks Paolo! best, benjamin
[v3] tr2: bool_set, dynamic_bitset, ratio
Hi Edward! I have reviewed and selectively merged your development branch, libstdcxx-tr2-ideas-branch, into trunk. As ISO C++ is now looking at new library efforts for TR2 (and N2965 has already been checked in to trunk) I thought it well-timed. Please check my work, patch attached. On libstdcxx-tr2-ideas-branch, I found: 1) N1718 + extensions for polynomial. 2) N2136 bool_set 3) N2050 dynamic_bitset 4) ratio extensions for binary 5) cmath extensions 6) C++0x rope Of these, I selected 2, 3, and 4 for merging. It is sad to leave N1718 unmerged, I think there is a lot of good work here and frankly see N1744 (marked with open status for LWG) as a weaker candidate. But it's hard for me to justify putting this in given that it was explicitly rejected by LWG. Perhaps you have current status or thoughts? For the rope extensions, I would suggest just adding C++0x bits to ext/rope, instead of making tr2/rope. The cmath additions look interesting but I just saw declarations and no actual implementation so I punted. I would encourage you to continue working on TR2 projects! This future work can now proceed on mainline, without a special branch. tested x86_64/linux -benjamin 20111019-1.patch.bz2 Description: application/bzip
Re: [v3] Remove duplicate symbol in gnu.ver (PR bootstrap/50715)
Agh. Sorry about this Rainer. Thanks for the patch. -benjamin
Re: Intrinsics for N2965: Type traits and base classes
, vector, i)); +} + return bases_vec; +} + +/* Implement the __bases keyword: Return the base classes + of type */ + +/* Find morally non-virtual base classes by walking binfo hierarchy */ +/* Virtual base classes are handled separately in finish_bases */ + +static tree +dfs_calculate_bases_pre (tree binfo, ATTRIBUTE_UNUSED void *data_) +{ + /* Don't walk bases of virtual bases */ + return BINFO_VIRTUAL_P (binfo) ? dfs_skip_bases : NULL_TREE; +} + +static tree +dfs_calculate_bases_post (tree binfo, void *data_) +{ + VEC(tree, gc) **data = (VEC(tree, gc) **) data_; + if (!BINFO_VIRTUAL_P (binfo)) +{ + VEC_safe_push (tree, gc, *data, BINFO_TYPE (binfo)); +} + return NULL_TREE; +} + +/* Calculates the morally non-virtual base classes of a class */ +static VEC(tree, gc) * +calculate_bases_helper (tree type) +{ + VEC(tree, gc) *vector = make_tree_vector(); + + /* Now add non-virtual base classes in order of construction */ + dfs_walk_all (TYPE_BINFO (type), +dfs_calculate_bases_pre, dfs_calculate_bases_post, vector); + return vector; +} + +tree +calculate_bases (tree type) +{ + VEC(tree, gc) *vector = make_tree_vector(); + tree bases_vec = NULL_TREE; + unsigned i; + VEC(tree, gc) *vbases; + VEC(tree, gc) *nonvbases; + tree binfo; + + complete_type (type); + + if (!NON_UNION_CLASS_TYPE_P (type)) +return make_tree_vec (0); + + /* First go through virtual base classes */ + for (vbases = CLASSTYPE_VBASECLASSES (type), i = 0; + VEC_iterate (tree, vbases, i, binfo); i++) +{ + VEC(tree, gc) *vbase_bases = calculate_bases_helper (BINFO_TYPE (binfo)); + VEC_safe_splice (tree, gc, vector, vbase_bases); + release_tree_vector (vbase_bases); +} + + /* Now for the non-virtual bases */ + nonvbases = calculate_bases_helper (type); + VEC_safe_splice (tree, gc, vector, nonvbases); + release_tree_vector (nonvbases); + + /* Last element is entire class, so don't copy */ + bases_vec = make_tree_vec (VEC_length (tree, vector) - 1); + + for (i = 0; i VEC_length (tree, vector) - 1; ++i) +{ + TREE_VEC_ELT (bases_vec, i) = VEC_index (tree, vector, i); +} + release_tree_vector (vector); + return bases_vec; +} + +tree +finish_bases (tree type, bool direct) +{ + tree bases = NULL_TREE; + + if (!processing_template_decl) +{ + /* Parameter packs can only be used in templates */ + error (Parameter pack __bases only valid in template declaration); + return error_mark_node; +} + + bases = cxx_make_type (BASES); + BASES_TYPE (bases) = type; + BASES_DIRECT (bases) = direct; + SET_TYPE_STRUCTURAL_EQUALITY (bases); + + return bases; +} + /* Perform C++-specific checks for __builtin_offsetof before calling fold_offsetof. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 500c142..39efdcc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-10-17 Michael Spertus mike_sper...@symantec.com + + * g++.dg/ext/bases.C: New test. + 2011-10-17 David S. Miller da...@davemloft.net * gcc.target/sparc/fand.c: Remove __LP64__ ifdefs and expect diff --git a/gcc/testsuite/g++.dg/ext/bases.C b/gcc/testsuite/g++.dg/ext/bases.C new file mode 100644 index 000..0582f72 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/bases.C @@ -0,0 +1,35 @@ +// { dg-options -std=gnu++0x -w } +// { dg-do run } + +#includetypeinfo +#includecassert + +// A simple typelist +templatetypename... _Elements struct types {}; + +// Simple bases implementation +templatetypename T struct b { + typedef types__bases(T)... type; +}; + +// Simple direct_bases implementation +templatetypename T struct db { + typedef types__direct_bases(T)... type; +}; + +template class,class struct assert_same_type; +template class T struct assert_same_typeT,T {}; + +struct A {}; +struct C : virtual A {}; +struct D : public C {}; +struct B : D, virtual A {}; +struct E : C, virtual D, B {}; +struct F : A, B, E {}; + +int main() { + assert_same_typebF::type, typesA,C,D,A,C,D,B,C,C,D,B,E(); + assert_same_typedbF::type, typesA,B,E(); + assert_same_typedbint::type, types(); + return 0; +} diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e8a621a..3baca8c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,23 @@ +2011-10-17 Michael Spertus mike_sper...@symantec.com + + * include/tr2/type_traits (bases, direct_bases, typelist): New. + +2011-10-17 Benjamin Kosnik b...@redhat.com + + * libstdc++-v3/include/Makefile.am: Add tr2 directory and includes. + * libstdc++-v3/include/Makefile.in: Regenerate. + + * scripts/create_testsuite_files: Search tr2 directory. + * testsuite/libstdc++-dg/conformance.exp: Same. + + * testsuite/tr2/bases/requirements/explicit_instantiation.cc: New. + * testsuite/tr2/bases/requirements/typedefs.cc: New. + * testsuite/tr2/bases/value.cc: New. + * testsuite/tr2/direct_bases/requirements/ + explicit_instantiation.cc: New. + * testsuite/tr2
Re: [wwwdocs] gcc-4.6/porting_to.html
I realized this one hasn't made it in, but is really nice. I made a number of minor edits (typos, markup, simplifying headings,... among others). What do you think -- should we include this? Many users still won't have GCC 4.6 deployed yet, so I think it's still worth it. What do you think? Ouch. I see this is not in, and I though I checked in the draft months ago. Please check this in immediately!!! -benjamin
Re: [v3] cxxabi.h vs. unwind-cxx.h
Here's a patch that works for both C and C++. tested x86/linux -benjamin 2011-10-10 Benjamin Kosnik b...@redhat.com PR libstdc++/49818 * config/abi/pre/gnu.ver (CXXABI_1.3.6): Add symbols. * testsuite/util/testsuite_abi.cc: Same. * libsupc++/unwind-cxx.h: Move required eh API... * libsupc++/cxxabi.h: ... to here. Add required forward declarations. Use _GLIBCXX_NOTHROW. * libsupc++/pure.cc (__cxa_deleted_virtual): Add. * libsupc++/eh_alloc.cc: Use _GLIBCXX_NOTHROW. * libsupc++/eh_catch.cc: Same. * libsupc++/eh_globals.cc: Same. * libsupc++/eh_type.cc: Same. diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 5e5aa6a..c45b7db 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -104,7 +104,7 @@ GLIBCXX_3.4 { std::logic_error*; std::locale::[A-Za-e]*; std::locale::facet::[A-Za-z]*; - std::locale::facet::_S_get_c_locale*; + std::locale::facet::_S_get_c_locale*; std::locale::facet::_S_clone_c_locale*; std::locale::facet::_S_create_c_locale*; std::locale::facet::_S_destroy_c_locale*; @@ -145,7 +145,7 @@ GLIBCXX_3.4 { std::strstream*; std::strstreambuf*; # std::t[a-q]*; - std::t[a-g]*; + std::t[a-g]*; std::th[a-h]*; std::th[j-q]*; std::th[s-z]*; @@ -238,7 +238,7 @@ GLIBCXX_3.4 { _ZNKSs8_M_limit*; _ZNKSs9_M_ibeginEv; _ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_E*; -_ZNKSs7compare*; +_ZNKSs7compare*; _ZNKSs5c_strEv; _ZNKSs8capacityEv; _ZNKSs4copyEPc[jmy][jmy]; @@ -435,10 +435,10 @@ GLIBCXX_3.4 { # std::locale destructors _ZNSt6localeD*; - + # std::locale::facet destructors _ZNSt6locale5facetD*; - + # std::locale::_Impl constructors, destructors _ZNSt6locale5_ImplC*; _ZNSt6locale5_ImplD*; @@ -447,7 +447,7 @@ GLIBCXX_3.4 { _ZNSt8ios_baseD*; _ZNSt8ios_base4InitD*; -# bool std::has_facet +# bool std::has_facet _ZSt9has_facetIS*; # std::use_facet @@ -486,7 +486,7 @@ GLIBCXX_3.4 { # std::time_get_byname _ZNSt15time_get_byname*; - + # std::time_put _ZNSt8time_put*; _ZNKSt8time_put*; @@ -569,7 +569,7 @@ GLIBCXX_3.4 { _ZNK11__gnu_debug16_Error_formatter13_M_print_word*; _ZNK11__gnu_debug16_Error_formatter15_M_print_string*; _ZNK11__gnu_debug16_Error_formatter8_M_error*; - + # exceptions as functions _ZSt16__throw_bad_castv; _ZSt17__throw_bad_allocv; @@ -809,11 +809,11 @@ GLIBCXX_3.4 { }; GLIBCXX_3.4.1 { - + _ZNSt12__basic_fileIcE4fileEv; - + } GLIBCXX_3.4; - + GLIBCXX_3.4.2 { _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE4fileEv; @@ -825,7 +825,7 @@ GLIBCXX_3.4.2 { } GLIBCXX_3.4.1; GLIBCXX_3.4.3 { - + # stub functions from libmath acosf; acosl; @@ -969,7 +969,7 @@ GLIBCXX_3.4.10 { _ZNKSt4hashIeEclEe; _ZSt17__verify_grouping*; - + _ZNSt8__detail12__prime_listE; _ZNSt3tr18__detail12__prime_listE; @@ -992,7 +992,7 @@ GLIBCXX_3.4.10 { } GLIBCXX_3.4.9; GLIBCXX_3.4.11 { - + # atomic __atomic_flag_for_address; __atomic_flag_wait_explicit; @@ -1328,16 +1328,16 @@ CXXABI_1.3 { __cxa_rethrow; __cxa_throw; __cxa_type_match; +__cxa_vec_ctor; __cxa_vec_cctor; __cxa_vec_cleanup; -__cxa_vec_ctor; +__cxa_vec_delete; __cxa_vec_delete2; __cxa_vec_delete3; -__cxa_vec_delete; __cxa_vec_dtor; +__cxa_vec_new; __cxa_vec_new2; __cxa_vec_new3; -__cxa_vec_new; __gxx_personality_v0; __gxx_personality_sj0; __dynamic_cast; @@ -1491,3 +1491,12 @@ CXXABI_1.3.5 { _ZTVSt16nested_exception; } CXXABI_1.3.4; + +CXXABI_1.3.6 { + +__cxa_allocate_dependent_exception; +__cxa_free_dependent_exception; +__cxa_get_exception_ptr; +__cxa_deleted_virtual; + +} CXXABI_1.3.5; \ No newline at end of file diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h index 0f3856e..e78f551 100644 --- a/libstdc++-v3/libsupc++/cxxabi.h +++ b/libstdc++-v3/libsupc++/cxxabi.h @@ -123,23 +123,26 @@ namespace __cxxabiv1 void __cxa_guard_abort(__guard*) _GLIBCXX_NOTHROW; + // DSO destruction. + int + __cxa_atexit(void (*)(void*), void*, void*) _GLIBCXX_NOTHROW; + + int + __cxa_finalize(void*); + // Pure virtual functions. void __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); - // Exception handling. void - __cxa_bad_cast(); + __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); - void - __cxa_bad_typeid(); - - // DSO destruction. - int - __cxa_atexit(void (*)(void*), void*, void*) _GLIBCXX_NOTHROW; + // Exception handling auxillary. + void + __cxa_bad_cast() __attribute__((__noreturn__)); - int - __cxa_finalize(void*); + void + __cxa_bad_typeid() __attribute__((__noreturn__)); /** @@ -185,6 +188,7
Re: Intrinsics for N2965: Type traits and base classes
This is looking pretty good, from the libstdc++ side. This latest round of gcc hacking fixes the previous testsuite fixes, so once you get the gcc bits OK'd by Jason you can check in. I'd still like to see some testcases for the intrinsic, independent of the library. Seems like some simple test case along the lines of gcc/testsuite/g++.dg/ext/is_base_of.C will suffice. -benjamin
Re: [v3] use NSDMI in C++11 mutex types
Does anyone have any comments or objections to going in this direction? If the new base classes aren't OK the NSDMI syntax could still be used, just without refactoring to remove the code duplication. I like where you are going here. This looks good to me. -benjamin
Re: [v3] versioned-namespaces spelling/soname change
... I went ahead and reverted the change, wasn't documented anywhere, definitely unintended. Thanks -benjamin
[v3] cxxabi.h vs. unwind-cxx.h
In 49818, it's pointed out that none of the EH routines required by chapter four of the C++ ABI docs are in cxxabi.h. Instead, they are in unwind-cxx.h. Along with other, GNU-specific implementation items. Note that the function definitions have always been exported from the libsupc++/libstdc++ binary. But the declarations have not been in the required header. This conundrum is now fixed with the following patch, which more cleanly divides the C++ ABI standard from the GNU implementation. Forward declarations and pointers, solid friends always. tested x86_64/linux -benjamin 2011-10-06 Benjamin Kosnik b...@redhat.com PR libstdc++/49818 * config/abi/pre/gnu.ver (CXXABI_1.3.6): Add symbols. * testsuite/util/testsuite_abi.cc: Same. * libsupc++/unwind-cxx.h: Move required eh API... * libsupc++/cxxabi.h: ... to here. Add required forward declarations. * libsupc++/pure.cc (__cxa_deleted_virtual): Add. diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 5e5aa6a..c45b7db 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -104,7 +104,7 @@ GLIBCXX_3.4 { std::logic_error*; std::locale::[A-Za-e]*; std::locale::facet::[A-Za-z]*; - std::locale::facet::_S_get_c_locale*; + std::locale::facet::_S_get_c_locale*; std::locale::facet::_S_clone_c_locale*; std::locale::facet::_S_create_c_locale*; std::locale::facet::_S_destroy_c_locale*; @@ -145,7 +145,7 @@ GLIBCXX_3.4 { std::strstream*; std::strstreambuf*; # std::t[a-q]*; - std::t[a-g]*; + std::t[a-g]*; std::th[a-h]*; std::th[j-q]*; std::th[s-z]*; @@ -238,7 +238,7 @@ GLIBCXX_3.4 { _ZNKSs8_M_limit*; _ZNKSs9_M_ibeginEv; _ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_E*; -_ZNKSs7compare*; +_ZNKSs7compare*; _ZNKSs5c_strEv; _ZNKSs8capacityEv; _ZNKSs4copyEPc[jmy][jmy]; @@ -435,10 +435,10 @@ GLIBCXX_3.4 { # std::locale destructors _ZNSt6localeD*; - + # std::locale::facet destructors _ZNSt6locale5facetD*; - + # std::locale::_Impl constructors, destructors _ZNSt6locale5_ImplC*; _ZNSt6locale5_ImplD*; @@ -447,7 +447,7 @@ GLIBCXX_3.4 { _ZNSt8ios_baseD*; _ZNSt8ios_base4InitD*; -# bool std::has_facet +# bool std::has_facet _ZSt9has_facetIS*; # std::use_facet @@ -486,7 +486,7 @@ GLIBCXX_3.4 { # std::time_get_byname _ZNSt15time_get_byname*; - + # std::time_put _ZNSt8time_put*; _ZNKSt8time_put*; @@ -569,7 +569,7 @@ GLIBCXX_3.4 { _ZNK11__gnu_debug16_Error_formatter13_M_print_word*; _ZNK11__gnu_debug16_Error_formatter15_M_print_string*; _ZNK11__gnu_debug16_Error_formatter8_M_error*; - + # exceptions as functions _ZSt16__throw_bad_castv; _ZSt17__throw_bad_allocv; @@ -809,11 +809,11 @@ GLIBCXX_3.4 { }; GLIBCXX_3.4.1 { - + _ZNSt12__basic_fileIcE4fileEv; - + } GLIBCXX_3.4; - + GLIBCXX_3.4.2 { _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE4fileEv; @@ -825,7 +825,7 @@ GLIBCXX_3.4.2 { } GLIBCXX_3.4.1; GLIBCXX_3.4.3 { - + # stub functions from libmath acosf; acosl; @@ -969,7 +969,7 @@ GLIBCXX_3.4.10 { _ZNKSt4hashIeEclEe; _ZSt17__verify_grouping*; - + _ZNSt8__detail12__prime_listE; _ZNSt3tr18__detail12__prime_listE; @@ -992,7 +992,7 @@ GLIBCXX_3.4.10 { } GLIBCXX_3.4.9; GLIBCXX_3.4.11 { - + # atomic __atomic_flag_for_address; __atomic_flag_wait_explicit; @@ -1328,16 +1328,16 @@ CXXABI_1.3 { __cxa_rethrow; __cxa_throw; __cxa_type_match; +__cxa_vec_ctor; __cxa_vec_cctor; __cxa_vec_cleanup; -__cxa_vec_ctor; +__cxa_vec_delete; __cxa_vec_delete2; __cxa_vec_delete3; -__cxa_vec_delete; __cxa_vec_dtor; +__cxa_vec_new; __cxa_vec_new2; __cxa_vec_new3; -__cxa_vec_new; __gxx_personality_v0; __gxx_personality_sj0; __dynamic_cast; @@ -1491,3 +1491,12 @@ CXXABI_1.3.5 { _ZTVSt16nested_exception; } CXXABI_1.3.4; + +CXXABI_1.3.6 { + +__cxa_allocate_dependent_exception; +__cxa_free_dependent_exception; +__cxa_get_exception_ptr; +__cxa_deleted_virtual; + +} CXXABI_1.3.5; \ No newline at end of file diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h index 0f3856e..3694420 100644 --- a/libstdc++-v3/libsupc++/cxxabi.h +++ b/libstdc++-v3/libsupc++/cxxabi.h @@ -54,6 +54,12 @@ #ifdef __cplusplus namespace __cxxabiv1 { + // Forward declarations. + struct __cxa_exception; + struct __cxa_refcounted_exception; + struct __cxa_dependent_exception; + struct __cxa_eh_globals; + extern C { #endif @@ -123,23 +129,72 @@ namespace __cxxabiv1 void __cxa_guard_abort(__guard*) _GLIBCXX_NOTHROW; + // DSO destruction. + int + __cxa_atexit(void (*)(void*), void*, void*) _GLIBCXX_NOTHROW; + + int
Re: [v3] versioned-namespaces spelling/soname change
I'm going to let this chill a bit on mainline and then check in to 4.6.x. Seems fine so I dropped this into the 4_6-branch tested x86/linux -benjamin 2011-10-05 Benjamin Kosnik b...@redhat.com Jonathan Wakely jwakely@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. Index: configure.ac === --- configure.ac (revision 179579) +++ configure.ac (working copy) @@ -11,10 +11,6 @@ # exported. Only used at the end of this file. ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD -# For libtool versioning info, format is CURRENT:REVISION:AGE -libtool_VERSION=6:16:0 -AC_SUBST(libtool_VERSION) - # Find the rest of the source tree framework. AM_ENABLE_MULTILIB(, ..) @@ -303,6 +299,8 @@ # This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no. GLIBCXX_ENABLE_SYMVERS([yes]) +AC_SUBST(libtool_VERSION) + GLIBCXX_ENABLE_VISIBILITY([yes]) ac_ldbl_compat=no Index: include/bits/locale_facets.tcc === --- include/bits/locale_facets.tcc (revision 179579) +++ include/bits/locale_facets.tcc (working copy) @@ -635,15 +635,11 @@ const char_type __c = *__beg; - if (!__donef) - __testf = __c == __lc-_M_falsename[__n]; - + __testf = __c == __lc-_M_falsename[__n]; if (!__testf __donet) break; - if (!__donet) - __testt = __c == __lc-_M_truename[__n]; - + __testt = __c == __lc-_M_truename[__n]; if (!__testt __donef) break; Index: include/bits/c++config === --- include/bits/c++config (revision 179579) +++ include/bits/c++config (working copy) @@ -162,41 +162,42 @@ // Defined if inline namespaces are used for versioning. -#define _GLIBCXX_INLINE_VERSION +#define _GLIBCXX_INLINE_VERSION // Inline namespace for symbol versioning. #if _GLIBCXX_INLINE_VERSION + namespace std { - inline namespace _6 { } + inline namespace __7 { } - namespace rel_ops { inline namespace _6 { } } + namespace rel_ops { inline namespace __7 { } } namespace tr1 { -inline namespace _6 { } -namespace placeholders { inline namespace _6 { } } -namespace regex_constants { inline namespace _6 { } } -namespace __detail { inline namespace _6 { } } +inline namespace __7 { } +namespace placeholders { inline namespace __7 { } } +namespace regex_constants { inline namespace __7 { } } +namespace __detail { inline namespace __7 { } } } - namespace decimal { inline namespace _6 { } } + namespace decimal { inline namespace __7 { } } - namespace chrono { inline namespace _6 { } } - namespace placeholders { inline namespace _6 { } } - namespace regex_constants { inline namespace _6 { } } - namespace this_thread { inline namespace _6 { } } + namespace chrono { inline namespace __7 { } } + namespace placeholders { inline namespace __7 { } } + namespace regex_constants { inline namespace __7 { } } + namespace this_thread { inline namespace __7 { } } - namespace __detail { inline namespace _6 { } } - namespace __regex { inline namespace _6 { } } + namespace __detail { inline namespace __7 { } } + namespace __regex { inline namespace __7 { } } } namespace __gnu_cxx { - inline namespace _6 { } - namespace __detail { inline namespace _6 { } } + inline namespace __7 { } + namespace __detail { inline namespace __7 { } } } -# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace _6 { +# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 { # define _GLIBCXX_END_NAMESPACE_VERSION } #else # define _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -213,7 +214,7 @@ namespace __cxx1998 { #if _GLIBCXX_INLINE_VERSION - inline namespace _6 { } + inline namespace __7 { } #endif } Index: include/c_global/cwchar === --- include/c_global/cwchar (revision 179579) +++ include/c_global/cwchar (working copy) @@ -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) Index: testsuite/ext/profile/mutex_extensions_neg.cc
Re: Intrinsics for N2965: Type traits and base classes
OK. Here is a new diff that hopefully takes into account all of Jason's and Benjamin's comments. Benjamin's TR2 build patch is not repeated (or tested!) here. Benjamin, I'd really appreciate if you wouldn't mind confirming I handled that correctly in tr2/type_traits (Including the inclusion of std/type_traits). Hey! Here is a preliminary test suite. Just the basics on this one. There's a bit of an issue with fundamental types, ICEs, but seems fixable. From here on in, just populate the testsuite/tr2/* directories with .cc files. They will be tested by the testsuite machinery. Your typelist interface looks pretty good. We should start here for the interface, and can embellish it after it goes in. -benjamin diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits new file mode 100644 index 000..94aebf0 --- /dev/null +++ b/libstdc++-v3/include/tr2/type_traits @@ -0,0 +1,102 @@ +// TR2 type_traits -*- C++ -*- + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// http://www.gnu.org/licenses/. + +/** @file tr2/type_traits + * This is a TR2 C++ Library header. + */ + +#ifndef _GLIBCXX_TR2_TYPE_TRAITS +#define _GLIBCXX_TR2_TYPE_TRAITS 1 + +#pragma GCC system_header +#include type_traits +#include bits/c++config.h + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace tr2 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup metaprogramming Type Traits + * @ingroup utilities + * + * Compile time type transformation and information. + * @{ + */ + + templatetypename... _Elements +struct typelist; + + template +struct typelist +{ + typedef std::true_type empty; +}; + + templatetypename _First, typename... _Rest +struct typelist_First, _Rest... +{ + typedef std::false_type empty; + + struct first + { + typedef _First type; + }; + + struct rest + { + typedef typelist_Rest... type; + }; +}; + + // Sequence abstraction metafunctions default to looking in the type + templatetypename _Tp +struct first : public _Tp::first { }; + + templatetypename _Tp +struct rest : public _Tp::rest { }; + + templatetypename _Tp +struct empty : public _Tp::empty { }; + + + templatetypename _Tp +struct bases +{ + typedef typelist__bases(_Tp)... type; +}; + + templatetypename _Tp +struct direct_bases +{ + typedef typelist__direct_bases(_Tp)... type; +}; + +_GLIBCXX_END_NAMESPACE_VERSION +} +} + +#endif // _GLIBCXX_TR2_TYPE_TRAITS diff --git a/libstdc++-v3/scripts/create_testsuite_files b/libstdc++-v3/scripts/create_testsuite_files index f4a0bcd..a427eef 100755 --- a/libstdc++-v3/scripts/create_testsuite_files +++ b/libstdc++-v3/scripts/create_testsuite_files @@ -32,7 +32,7 @@ cd $srcdir # This is the ugly version of everything but the current directory. It's # what has to happen when find(1) doesn't support -mindepth, or -xtype. dlist=`echo [0-9][0-9]*` -dlist=$dlist abi backward ext performance tr1 decimal +dlist=$dlist abi backward ext performance tr1 tr2 decimal find $dlist ( -type f -o -type l ) -name *.cc -print $tmp.01 find $dlist ( -type f -o -type l ) -name *.c -print $tmp.02 cat $tmp.01 $tmp.02 | sort $tmp.1 diff --git a/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp b/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp index 8642eb7..19fa0e2 100644 --- a/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp +++ b/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp @@ -58,6 +58,7 @@ if {[info exists tests_file] [file exists $tests_file]} { lappend subdirs $srcdir/ext lappend subdirs $srcdir/performance lappend subdirs $srcdir/tr1 +lappend subdirs $srcdir/tr2 lappend subdirs $srcdir/decimal verbose subdirs are $subdirs diff --git a/libstdc++-v3/testsuite/tr2/bases/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr2/bases/requirements/explicit_instantiation.cc new file mode 100644 index 000..ddd6d6f --- /dev/null
Re: Intrinsics for N2965: Type traits and base classes
OK. Here are some simple benchmarks. I simulated heavy use of reflection with 1000 classes that each had about a thousand base classes. I also created a super-simple typelist class templatetypename... T struct typelist {}; // Variadic templates rock If bases returns a typelist, the program takes about 4 sec. If bases returns a tuple, the program takes about 4 min. If I make the program any bigger, the tuple case fails to compile with spurious error messages, while the typelist version stays quick. Given that metaprograms typically create large class hierarchies (look at Alexandrescu's CreateScatterHierarchy that he uses to implement factory in the Modern C++ design book) and that compile times are an enormous obstacle to metaprogramming, I don't think these tests are at all ridiculous. I think this shows we need to return a typelist instead of a tuple. Yes, compelling. As I mentioned earlier, I could just return the typelist, or hide it by returning an unspecified type (which would actually be a typelist) that you would apply a first and a rest template to walk through. The interface is still simple, I like it. This would give us more flexibility for the future (e.g., if a standard typelist type is adopted. Likewise, we would be covered if wanted to change bases implementation in the future to return an associative container. For example, if using sizegrepA, basesE::type::value to count the number of occurrences of A as a base class of E turns out to be useful). This plan sounds excellent to me. -benjamin
Re: Intrinsics for N2965: Type traits and base classes
Oops, this is the right patch. -benjamindiff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a59a0b6..e1176ee 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,14 @@ 2011-09-27 Benjamin Kosnik b...@redhat.com + * doc/Makefile.am: Add tr2 support. + * doc/Makefile.in: Regenerate. + +2011-09-27 Mike Spertus mike_sper...@symantec.com + + * include/tr2/type_traits (bases, direct_bases): New. + +2011-09-27 Benjamin Kosnik b...@redhat.com + * doc/html/*: Regenerate. * doc/Makefile.am: Un-nest the ext output directory. diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 4016882..9fdaa8d 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -604,6 +604,11 @@ tr1_headers = \ ${tr1_srcdir}/wchar.h \ ${tr1_srcdir}/wctype.h +tr2_srcdir = ${glibcxx_srcdir}/include/tr2 +tr2_builddir = ./tr2 +tr2_headers = \ + ${tr2_srcdir}/type_traits + decimal_srcdir = ${glibcxx_srcdir}/include/decimal decimal_builddir = ./decimal decimal_headers = \ @@ -887,7 +892,7 @@ endif # CLEANFILES and all-local are kept up-to-date. allstamped = \ stamp-std stamp-bits stamp-bits-sup stamp-c_base stamp-c_compatibility \ - stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-decimal \ + stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-tr2 stamp-decimal \ stamp-debug stamp-parallel stamp-profile stamp-profile-impl \ stamp-host @@ -1002,6 +1007,11 @@ stamp-tr1: ${tr1_headers} @-cd ${tr1_builddir} $(LN_S) $? . 2/dev/null @$(STAMP) stamp-tr1 +stamp-tr2: ${tr2_headers} + @-mkdir -p ${tr2_builddir} + @-cd ${tr2_builddir} $(LN_S) $? . 2/dev/null + @$(STAMP) stamp-tr2 + stamp-decimal: ${decimal_headers} @-mkdir -p ${decimal_builddir} @-cd ${decimal_builddir} $(LN_S) $? . 2/dev/null @@ -1245,6 +1255,9 @@ install-headers: $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_builddir} for file in ${tr1_headers}; do \ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done + $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr2_builddir} + for file in ${tr2_headers}; do \ + $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr2_builddir}; done $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${decimal_builddir} for file in ${decimal_headers}; do \ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${decimal_builddir}; done @@ -1291,7 +1304,7 @@ clean-local: # developer tries to create them via make in the include build # directory. (This is more of an example of how this kind of rule can # be made.) -.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) +.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr2_headers) $(decimal_headers) $(ext_headers) $(std_headers): ; @: $(c_base_headers): ; @: diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 58dbfc4..5ad5932 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -854,6 +854,11 @@ tr1_headers = \ ${tr1_srcdir}/wchar.h \ ${tr1_srcdir}/wctype.h +tr2_srcdir = ${glibcxx_srcdir}/include/tr2 +tr2_builddir = ./tr2 +tr2_headers = \ + ${tr2_srcdir}/type_traits + decimal_srcdir = ${glibcxx_srcdir}/include/decimal decimal_builddir = ./decimal decimal_headers = \ @@ -1125,7 +1130,7 @@ PCHFLAGS = -x c++-header -nostdinc++ $(CXXFLAGS) # CLEANFILES and all-local are kept up-to-date. allstamped = \ stamp-std stamp-bits stamp-bits-sup stamp-c_base stamp-c_compatibility \ - stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-decimal \ + stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-tr2 stamp-decimal \ stamp-debug stamp-parallel stamp-profile stamp-profile-impl \ stamp-host @@ -1402,6 +1407,11 @@ stamp-tr1: ${tr1_headers} @-cd ${tr1_builddir} $(LN_S) $? . 2/dev/null @$(STAMP) stamp-tr1 +stamp-tr2: ${tr2_headers} + @-mkdir -p ${tr2_builddir} + @-cd ${tr2_builddir} $(LN_S) $? . 2/dev/null + @$(STAMP) stamp-tr2 + stamp-decimal: ${decimal_headers} @-mkdir -p ${decimal_builddir} @-cd ${decimal_builddir} $(LN_S) $? . 2/dev/null @@ -1630,6 +1640,9 @@ install-headers: $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_builddir} for file in ${tr1_headers}; do \ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done + $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr2_builddir} + for file in ${tr2_headers}; do \ + $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr2_builddir}; done $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${decimal_builddir} for file in ${decimal_headers}; do \ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${decimal_builddir}; done @@ -1673,7 +1686,7 @@ clean-local: # developer tries to create them via make in the include build # directory. (This is more of an example of how this kind of rule can # be made.) -.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) +.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers
[v3] versioned-namespaces spelling/soname change
As noticed by Jonathan, the namespace chosen for this extension is not in the implementation namespace and clashes with a similar name in functional: the placeholders for bind. Fixed thusly. And another name injection patchlet. However, there's a bit of an added wrinkle in that now libstdc++ is linked in earlier in the build, and is not just this target library. So, to avoid confusion and build errors, --enable-symvers=gnu-versioned-namespace Now sets libstdc++.so's SONAME to libstdc++.so.7, not libstdc++.so.6.x.x. Ie, incompatible. This is not really a huge conceptual change. This flag was always about creating a new ABI for libstdc++ and has clearly been marked as incompatible. Now, I've explicitly named it as such. Yay! I'm going to let this chill a bit on mainline and then check in to 4.6.x. -benjamin tested x86/linux tested x86/linux --enable-gnu-versioned-namespace2011-09-26 Benjamin Kosnik b...@redhat.com Jonathan Wakely jwakely@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. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index ccfb2ce..1b9d025 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -3054,10 +3054,15 @@ dnl dnl Add version tags to symbols in shared library (or not), additionally dnl marking other symbols as private/local (or not). dnl +dnl Sets libtool_VERSION, and determines shared library SONAME. +dnl +dnl This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no. +dnl dnl --enable-symvers=style adds a version script to the linker call when dnl creating the shared library. The choice of version script is dnl controlled by 'style'. dnl --disable-symvers does not. +dnl dnl + Usage: GLIBCXX_ENABLE_SYMVERS[(DEFAULT)] dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to dnl choose a default style based on linker characteristics. Passing @@ -3194,7 +3199,10 @@ changequote([,])dnl fi fi -# Everything parsed; figure out what file to use. +# For libtool versioning info, format is CURRENT:REVISION:AGE +libtool_VERSION=6:17:0 + +# Everything parsed; figure out what files and settings to use. case $enable_symvers in no) SYMVER_FILE=config/abi/pre/none.ver @@ -3205,6 +3213,7 @@ case $enable_symvers in [Define to use GNU versioning in the shared library.]) ;; gnu-versioned-namespace) +libtool_VERSION=7:0:0 SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1, [Define to use GNU namespace versioning in the shared library.]) diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver index ab9380c..32bcf67 100644 --- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver +++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver @@ -20,23 +20,23 @@ ## with this library; see the file COPYING3. If not see ## http://www.gnu.org/licenses/. -GLIBCXX_5.0 { +GLIBCXX_7.0 { global: # Names inside the 'extern' block are demangled names. extern C++ { - std::_6::*; + std::__7::*; std::* }; # locale -_ZNSt2_69has_facetINS_*; +_ZNSt3__79has_facetINS_*; # hash -_ZNSt8__detail2_612__prime_listE; -_ZNSt3tr18__detail2_612__prime_listE; +_ZNSt8__detail3__712__prime_listE; +_ZNSt3tr18__detail3__712__prime_listE; # thread/mutex/condition_variable/future __once_proxy; @@ -73,41 +73,41 @@ GLIBCXX_5.0 { _ZTv0_n*; # std::__detail::_List_node_base -_ZNSt8__detail2_615_List_node_base7_M_hook*; -_ZNSt8__detail2_615_List_node_base9_M_unhookEv; -_ZNSt8__detail2_615_List_node_base10_M_reverseEv; -_ZNSt8__detail2_615_List_node_base11_M_transfer*; -_ZNSt8__detail2_615_List_node_base4swapER*; +_ZNSt8__detail3__715_List_node_base7_M_hook*; +_ZNSt8__detail3__715_List_node_base9_M_unhookEv; +_ZNSt8__detail3__715_List_node_base10_M_reverseEv; +_ZNSt8__detail3__715_List_node_base11_M_transfer*; +_ZNSt8__detail3__715_List_node_base4swapER*; # std::__convert_to_v -_ZNSt2_614__convert_to_v*; +_ZNSt3__714__convert_to_v*; # std::__copy_streambufs -_ZNSt2_617__copy_streambufsI*; -_ZNSt2_621__copy_streambufs_eofI*; +_ZNSt3__717__copy_streambufsI*; +_ZNSt3__721__copy_streambufs_eofI*; # __gnu_cxx::__atomic_add # __gnu_cxx::__exchange_and_add
[v3] doc-epub
Fix for image directory location. The generated epub is ok, but missing images. There's another tool that may be used to generate epubs, called db2epub.py, but it isn't cooperating. So we will stick with the status quo for now. -benjamin2011-09-21 Benjamin Kosnik b...@redhat.com * doc/Makefile.am (stamp-epub-docbook): Fix image directory location. * doc/Makefile.in: Regenerate. diff --git a/libstdc++-v3/doc/Makefile.am b/libstdc++-v3/doc/Makefile.am index 71b6e69..1e38682 100644 --- a/libstdc++-v3/doc/Makefile.am +++ b/libstdc++-v3/doc/Makefile.am @@ -396,7 +396,7 @@ xml_image_basic = \ ${xml_image_dir}/pbds_tree_node_invariants.png \ ${xml_image_dir}/pbds_tree_node_updator_policy_cd.png \ ${xml_image_dir}/pbds_trie_node_updator_policy_cd.png \ - ${xml_image_dir}/pbds_update_seq_diagram.png + ${xml_image_dir}/pbds_update_seq_diagram.png xml_image_generated = \ ${xml_image_dir}/pbds_binary_priority_queue_int_push_pop.png \ @@ -488,7 +488,6 @@ ${docbook_outdir}/texinfo: ${docbook_outdir}/xml: mkdir -p ${docbook_outdir}/xml - mkdir -p ${docbook_outdir}/xml/images # Validate existing XML structure. XMLLINT = xmllint @@ -512,9 +511,6 @@ stamp-xml-single-docbook: $(xml_sources) ${docbook_outdir}/xml ${top_srcdir}/doc/xml/manual/spine.xml ${manual_xml}; $(XMLLINT) $(XMLLINT_FLAGS) \ ${top_srcdir}/doc/xml/spine.xml ${set_xml}; - if [ ! -d ${docbook_outdir}/xml/images ]; then \ - $(LN_S) ${top_srcdir}/doc/xml/images ${docbook_outdir}/xml/; \ - fi $(STAMP) stamp-xml-single-docbook doc-xml-single-docbook: stamp-xml-single-docbook @@ -595,10 +591,14 @@ doc-texinfo-docbook: stamp-texinfo-docbook doc-info-docbook: stamp-info-docbook -# EPUB, via dbtoepub + ruby +# EPUB, via ruby + dbtoepub +# Can verify document with: epubcheck manual_epub = ${docbook_outdir}/epub/libstdc++-manual.epub stamp-epub-docbook: stamp-xml-single-docbook ${docbook_outdir}/epub @echo Generating epub files... + if [ ! -d ${docbook_outdir}/images ]; then \ + $(LN_S) ${top_srcdir}/doc/xml/images ${docbook_outdir}/; \ + fi ${XSL_STYLE_DIR}/epub/bin/dbtoepub -v -d -o ${manual_epub} ${set_xml} $(STAMP) stamp-epub-docbook
Re: [v3] tuple round 2
2011-08-03 Benjamin Kosnik b...@redhat.com François Dumont francois.cppd...@free.fr * testsuite/23_containers/array/at_neg.cc: Move... * testsuite/23_containers/array/at.cc: ...here. Remove -fno-exceptions, call const at member function. I've reverted the name change. -benjamin
[v3] constexpr tuple
Here's the tuple additions for constexpr now that it's ok to return this. I'm not quite sure what to do with the get, tie, tuple_cat functions given the current signatures. Is tuple_cat now considered conforming? If so, certain signatures can be constexpr. tested x86/linux benjamin2011-09-06 Benjamin Kosnik b...@redhat.com * include/std/tuple (_Tuple_impl::_M_head, _M_tail): Mark constexpr. (tuple(tuple)): Same. (tuple(const tuple_UElements... __in)): Same. (tuple(tuple_UElements... __in)): Same. (tuple_cat(const tuple_TElements..., const tuple_UElements...)): Same. (get): Same. * include/std/array: Consolidate array::data usage. * testsuite/23_containers/array/requirements/constexpr_functions.cc: Remove extra include. * testsuite/20_util/tuple/creation_functions/constexpr.cc: New. * testsuite/20_util/tuple/cons/constexpr-2.cc: Add tests. * testsuite/20_util/tuple/cons/constexpr-3.cc: Same. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust line numbers. Index: include/std/tuple === --- include/std/tuple (revision 178557) +++ include/std/tuple (working copy) @@ -143,7 +143,7 @@ _Head _M_head() noexcept { return *this; } - const _Head + constexpr const _Head _M_head() const noexcept { return *this; } }; @@ -189,7 +189,7 @@ _Head _M_head() noexcept { return _M_head_impl; } - const _Head + constexpr const _Head _M_head() const noexcept { return _M_head_impl; } _Head _M_head_impl; @@ -248,13 +248,13 @@ _Head _M_head() noexcept { return _Base::_M_head(); } - const _Head + constexpr const _Head _M_head() const noexcept { return _Base::_M_head(); } _Inherited _M_tail() noexcept { return *this; } - const _Inherited + constexpr const _Inherited _M_tail() const noexcept { return *this; } constexpr _Tuple_impl() @@ -280,7 +280,7 @@ _Base(std::forward_Head(__in._M_head())) { } templatetypename... _UElements -_Tuple_impl(const _Tuple_impl_Idx, _UElements... __in) +constexpr _Tuple_impl(const _Tuple_impl_Idx, _UElements... __in) : _Inherited(__in._M_tail()), _Base(__in._M_head()) { } templatetypename _UHead, typename... _UTails @@ -409,7 +409,7 @@ constexpr tuple(const tuple) = default; - tuple(tuple) = default; + constexpr tuple(tuple) = default; templatetypename... _UElements, typename = typename enable_if__and_integral_constantbool, sizeof...(_UElements) @@ -417,7 +417,7 @@ __all_convertible__conv_typesconst _UElements..., __conv_types_Elements... ::value::type -tuple(const tuple_UElements... __in) +constexpr tuple(const tuple_UElements... __in) : _Inherited(static_castconst _Tuple_impl0, _UElements...(__in)) { } @@ -427,7 +427,7 @@ __all_convertible__conv_types_UElements..., __conv_types_Elements... ::value::type -tuple(tuple_UElements... __in) +constexpr tuple(tuple_UElements... __in) : _Inherited(static_cast_Tuple_impl0, _UElements...(__in)) { } // Allocator-extended constructors. @@ -548,18 +548,18 @@ constexpr tuple(const tuple) = default; - tuple(tuple) = default; + constexpr tuple(tuple) = default; templatetypename _U1, typename _U2, typename = typename enable_if__and_is_convertibleconst _U1, _T1, is_convertibleconst _U2, _T2::value::type -tuple(const tuple_U1, _U2 __in) +constexpr tuple(const tuple_U1, _U2 __in) : _Inherited(static_castconst _Tuple_impl0, _U1, _U2(__in)) { } templatetypename _U1, typename _U2, typename = typename enable_if__and_is_convertible_U1, _T1, is_convertible_U2, _T2::value::type -tuple(tuple_U1, _U2 __in) +constexpr tuple(tuple_U1, _U2 __in) : _Inherited(static_cast_Tuple_impl0, _U1, _U2(__in)) { } templatetypename _U1, typename _U2, typename = typename @@ -571,7 +571,7 @@ templatetypename _U1, typename _U2, typename = typename enable_if__and_is_convertible_U1, _T1, is_convertible_U2, _T2::value::type - tuple(pair_U1, _U2 __in) + constexpr tuple(pair_U1, _U2 __in) : _Inherited(std::forward_U1(__in.first), std::forward_U2(__in.second)) { } @@ -752,7 +752,7 @@ { return __t._M_head(); } templatestd::size_t __i, typename _Head, typename... _Tail -inline typename __add_c_ref_Head::type +inline constexpr typename __add_c_ref_Head::type __get_helper(const _Tuple_impl__i, _Head, _Tail... __t) noexcept { return __t._M_head(); } @@ -767,7 +767,7 @@ { return __get_helper__i(__t); } templatestd::size_t __i, typename... _Elements -inline typename __add_c_ref +inline constexpr typename
Re: RFC: add a testsuite for libstdc++ pretty-printers
Any comments on this? I'd like to get it in; Phil found a bug in the std::tuple printer, and it would be nice to put in a test case along with the fix. Hey Tom (and Phil!). Sorry for the delay: this looks fine. Please put it in on trunk and enjoy your vacation! -benjamin
Re: [v3] doxygen markup fixes
+/** @file bits/alloc_traits.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{scoped_allocator} + */ + The correct header for allocator_traits is memory Ack. Thanks for the review. Kind of mind-numbing, these changes. -benjamin
[v3] docbook vs. images
This fixes the docbook html output with respect to images. Now, filerefs for PNG data are relative to the html install directory, and an images directory is copied and populated so that the links match PNG files. tested x86/linux -benjamin2011-08-04 Benjamin Kosnik b...@redhat.com * doc/xml/manual/build_hacking.xml: Use relative fileref for PNG imagedata. * doc/xml/manual/test_policy_data_structures.xml: Same. * doc/xml/manual/policy_data_structures.xml: Same. * doc/Makefile.am (stamp-html-docbook-images) (stamp-html-docbook-lwg, stamp-html-docbook-data): New. (xml_extra): Add lwg html file dependencies. (xml_images): Add image html file dependencies. * doc/Makefile.in: Regenerate. (stamp-html): Change to stamp-html-docbook-data. (stamp-html-copy): Remove. Index: doc/xml/manual/build_hacking.xml === --- doc/xml/manual/build_hacking.xml (revision 177416) +++ doc/xml/manual/build_hacking.xml (working copy) @@ -45,10 +45,10 @@ titleConfigure and Build File Dependencies/title mediaobject imageobject - imagedata align=center format=PDF scale=75 fileref=/mnt/share/src/gcc.svn-trunk/libstdc++-v3/doc/xml/images/confdeps.pdf/ + imagedata align=center format=PDF scale=75 fileref=../images/confdeps.pdf/ /imageobject imageobject - imagedata align=center format=PNG scale=100 fileref=/mnt/share/src/gcc.svn-trunk/libstdc++-v3/doc/xml/images/confdeps.png/ + imagedata align=center format=PNG scale=100 fileref=../images/confdeps.png/ /imageobject textobject phraseDependency Graph for Configure and Build Files/phrase Index: doc/xml/manual/test_policy_data_structures.xml === --- doc/xml/manual/test_policy_data_structures.xml (revision 177416) +++ doc/xml/manual/test_policy_data_structures.xml (working copy) @@ -106,7 +106,7 @@ /imageobject imageobject imagedata align=center format=PNG scale=100 - fileref=/mnt/share/src/gcc.svn-trunk/libstdc++-v3/doc/xml/images/pbds_text_find_timing_test_hash_local.png/ + fileref=../images/pbds_text_find_timing_test_hash_local.png/ /imageobject /mediaobject /informalfigure @@ -433,7 +433,7 @@ /imageobject imageobject imagedata align=center format=PNG scale=100 - fileref=/mnt/share/src/gcc.svn-trunk/libstdc++-v3/doc/xml/images/pbds_cc_hash_random_int_find_timing_test_local.png/ + fileref=../images/pbds_cc_hash_random_int_find_timing_test_local.png/ /imageobject /mediaobject /informalfigure @@ -694,7 +694,7 @@ /imageobject imageobject imagedata align=center format=PNG scale=100 - fileref=/mnt/share/src/gcc.svn-trunk/libstdc++-v3/doc/xml/images/pbds_gp_hash_random_int_find_timing_test_local.png/ + fileref=../images/pbds_gp_hash_random_int_find_timing_test_local.png/ /imageobject /mediaobject /informalfigure @@ -953,7 +953,7 @@ /imageobject imageobject imagedata align=center format=PNG scale=100 - fileref=/mnt/share/src/gcc.svn-trunk/libstdc++-v3/doc/xml/images/pbds_cc_hash_random_int_subscript_timing_test_find_local.png/ + fileref=../images/pbds_cc_hash_random_int_subscript_timing_test_find_local.png/ /imageobject /mediaobject /informalfigure @@ -1212,7 +1212,7 @@ /imageobject imageobject imagedata align=center format=PNG scale=100 - fileref=/mnt/share/src/gcc.svn-trunk/libstdc++-v3/doc/xml/images/pbds_gp_hash_random_int_subscript_timing_test_find_local.png/ + fileref=../images/pbds_gp_hash_random_int_subscript_timing_test_find_local.png/ /imageobject /mediaobject /informalfigure @@ -1452,7 +1452,7 @@ /imageobject imageobject imagedata align=center format=PNG scale=100 - fileref=/mnt/share/src/gcc.svn-trunk/libstdc++-v3/doc/xml/images/pbds_cc_hash_random_int_subscript_timing_test_insert_local.png/ + fileref=../images/pbds_cc_hash_random_int_subscript_timing_test_insert_local.png/ /imageobject /mediaobject /informalfigure @@ -1711,7 +1711,7 @@ /imageobject imageobject imagedata align=center format=PNG scale=100 - fileref=/mnt/share/src/gcc.svn-trunk/libstdc++-v3/doc/xml/images/pbds_gp_hash_random_int_subscript_timing_test_insert_local.png/ + fileref=../images/pbds_gp_hash_random_int_subscript_timing_test_insert_local.png/ /imageobject /mediaobject /informalfigure @@ -1983,7 +1983,7 @@ /imageobject imageobject imagedata align=center format=PNG scale=100 - fileref=/mnt/share/src/gcc.svn-trunk/libstdc++-v3/doc/xml/images/pbds_hash_zlob_random_int_find_timing_test_local.png/ + fileref=../images/pbds_hash_zlob_random_int_find_timing_test_local.png/ /imageobject /mediaobject /informalfigure @@ -2282,7 +2282,7
[v3] tuple round 2
Hey this fixes up the array::at issue as pointed out on this list. In addition, it adds some more tuple markup for constexpr. I'm going to stage in the tuple work, as some of it is more controversial. tested x86/linux -benjamin2011-08-03 Benjamin Kosnik b...@redhat.com * include/std/tuple: Mark more constructors constexpr. * testsuite/20_util/tuple/cons/constexpr.cc: Split into and extend as: * testsuite/20_util/tuple/cons/constexpr-2.cc: ...this. * testsuite/20_util/tuple/cons/constexpr-3.cc: ... and this. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust line numbers. 2011-08-03 Benjamin Kosnik b...@redhat.com François Dumont francois.cppd...@free.fr * testsuite/23_containers/array/at_neg.cc: Move... * testsuite/23_containers/array/at.cc: ...here. Remove -fno-exceptions, call const at member function. Index: include/std/tuple === --- include/std/tuple (revision 177290) +++ include/std/tuple (working copy) @@ -114,7 +114,7 @@ templatetypename _UHead, typename = typename enable_if!is_convertible_UHead, __uses_alloc_base::value::type -_Head_base(_UHead __h) +constexpr _Head_base(_UHead __h) : _Head(std::forward_UHead(__h)) { } _Head_base(__uses_alloc0) @@ -140,8 +140,11 @@ _Head_base(__uses_alloc2_Alloc __a, _UHead __uhead) : _Head(std::forward_UHead(__uhead), *__a._M_a) { } - _Head _M_head() noexcept { return *this; } - const _Head _M_head() const noexcept { return *this; } + _Head + _M_head() noexcept { return *this; } + + const _Head + _M_head() const noexcept { return *this; } }; templatestd::size_t _Idx, typename _Head @@ -156,7 +159,7 @@ templatetypename _UHead, typename = typename enable_if!is_convertible_UHead, __uses_alloc_base::value::type -_Head_base(_UHead __h) +constexpr _Head_base(_UHead __h) : _M_head_impl(std::forward_UHead(__h)) { } _Head_base(__uses_alloc0) @@ -183,9 +186,12 @@ _Head_base(__uses_alloc2_Alloc __a, _UHead __uhead) : _M_head_impl(std::forward_UHead(__uhead), *__a._M_a) { } - _Head _M_head() noexcept { return _M_head_impl; } - const _Head _M_head() const noexcept { return _M_head_impl; } + _Head + _M_head() noexcept { return _M_head_impl; } + const _Head + _M_head() const noexcept { return _M_head_impl; } + _Head _M_head_impl; }; @@ -239,12 +245,18 @@ typedef _Tuple_impl_Idx + 1, _Tail... _Inherited; typedef _Head_base_Idx, _Head, std::is_empty_Head::value _Base; - _Head_M_head() noexcept { return _Base::_M_head(); } - const _Head _M_head() const noexcept { return _Base::_M_head(); } + _Head + _M_head() noexcept { return _Base::_M_head(); } - _Inherited _M_tail() noexcept { return *this; } - const _Inherited _M_tail() const noexcept { return *this; } + const _Head + _M_head() const noexcept { return _Base::_M_head(); } + _Inherited + _M_tail() noexcept { return *this; } + + const _Inherited + _M_tail() const noexcept { return *this; } + constexpr _Tuple_impl() : _Inherited(), _Base() { } @@ -255,7 +267,7 @@ templatetypename _UHead, typename... _UTail, typename = typename enable_ifsizeof...(_Tail) == sizeof...(_UTail)::type explicit -_Tuple_impl(_UHead __head, _UTail... __tail) +constexpr _Tuple_impl(_UHead __head, _UTail... __tail) : _Inherited(std::forward_UTail(__tail)...), _Base(std::forward_UHead(__head)) { } @@ -371,7 +383,7 @@ } }; - /// tuple + /// Primary class template, tuple templatetypename... _Elements class tuple : public _Tuple_impl0, _Elements... { @@ -392,10 +404,11 @@ __conv_types_Elements... ::value::type explicit -tuple(_UElements... __elements) +constexpr tuple(_UElements... __elements) : _Inherited(std::forward_UElements(__elements)...) { } constexpr tuple(const tuple) = default; + tuple(tuple) = default; templatetypename... _UElements, typename = typename @@ -417,7 +430,7 @@ tuple(tuple_UElements... __in) : _Inherited(static_cast_Tuple_impl0, _UElements...(__in)) { } - // allocator-extended constructors + // Allocator-extended constructors. templatetypename _Alloc tuple(allocator_arg_t __tag, const _Alloc __a) @@ -503,6 +516,7 @@ { _Inherited::_M_swap(__in); } }; + // Explicit specialization, zero-element tuple. template class tuple { @@ -510,7 +524,8 @@ void swap(tuple) noexcept { /* no-op */ } }; - /// tuple (2-element), with construction and assignment from a pair
Re: [build] Move unwinder to toplevel libgcc (v2)
+++ b/libstdc++-v3/acinclude.m4 @@ -685,9 +685,9 @@ AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [ fi # Stuff in the actual top level. Currently only used by libsupc++ to - # get unwind* headers from the gcc dir. - #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include' - TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc' + # get unwind* headers from the libgcc dir. + #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc -I$(toplevel_srcdir)/include' + TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc' # Now, export this to all the little Makefiles AC_SUBST(GLIBCXX_INCLUDES) Ok, as a formality. -benjamin
[v3] check-performance compile fail cleanup
These tests recently started failing at compile time for me due to no declarations for unlink due to no include of unistd.h. So, I did the obvious thing and included it. tested x86/linux -benjamin2011-08-03 Benjamin Kosnik b...@redhat.com * testsuite/performance/27_io/filebuf_sputn_unbuf.cc: Include unistd.h for unlink. * testsuite/performance/27_io/ofstream_insert_int.cc: Same. * testsuite/performance/27_io/ifstream_extract_int.cc: Same. * testsuite/performance/27_io/ifstream_getline-2.cc: Same. * testsuite/performance/27_io/fstream_seek_write.cc: Same. * testsuite/performance/27_io/ifstream_extract_chars.cc: Same. * testsuite/performance/27_io/ofstream_insert_float.cc: Same. * testsuite/performance/27_io/ifstream_extract_float.cc: Same. * testsuite/performance/27_io/filebuf_sputc.cc: Same. Index: testsuite/performance/27_io/filebuf_sputn_unbuf.cc === --- testsuite/performance/27_io/filebuf_sputn_unbuf.cc (revision 177306) +++ testsuite/performance/27_io/filebuf_sputn_unbuf.cc (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2004, 2009 Free Software Foundation, Inc. +// Copyright (C) 2004, 2009, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // http://www.gnu.org/licenses/. - +#include unistd.h #include cstdio #include fstream #include testsuite_performance.h Index: testsuite/performance/27_io/ofstream_insert_int.cc === --- testsuite/performance/27_io/ofstream_insert_int.cc (revision 177306) +++ testsuite/performance/27_io/ofstream_insert_int.cc (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2003, 2009 Free Software Foundation, Inc. +// Copyright (C) 2003, 2009, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // http://www.gnu.org/licenses/. - +#include unistd.h #include fstream #include testsuite_performance.h Index: testsuite/performance/27_io/ifstream_extract_int.cc === --- testsuite/performance/27_io/ifstream_extract_int.cc (revision 177306) +++ testsuite/performance/27_io/ifstream_extract_int.cc (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2003, 2009 Free Software Foundation, Inc. +// Copyright (C) 2003, 2009, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // http://www.gnu.org/licenses/. - +#include unistd.h #include fstream #include testsuite_performance.h Index: testsuite/performance/27_io/ifstream_getline-2.cc === --- testsuite/performance/27_io/ifstream_getline-2.cc (revision 177306) +++ testsuite/performance/27_io/ifstream_getline-2.cc (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2004, 2009 Free Software Foundation, Inc. +// Copyright (C) 2004, 2009, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // http://www.gnu.org/licenses/. - +#include unistd.h #include cstdio #include fstream #include string Index: testsuite/performance/27_io/fstream_seek_write.cc === --- testsuite/performance/27_io/fstream_seek_write.cc (revision 177306) +++ testsuite/performance/27_io/fstream_seek_write.cc (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2003, 2009 Free Software Foundation, Inc. +// Copyright (C) 2003, 2009, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // http://www.gnu.org/licenses/. - +#include unistd.h #include fstream #include testsuite_performance.h Index: testsuite/performance/27_io/ifstream_extract_chars.cc === --- testsuite/performance/27_io/ifstream_extract_chars.cc (revision 177306) +++ testsuite/performance/27_io/ifstream_extract_chars.cc (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2005, 2009 Free Software Foundation, Inc. +// Copyright (C) 2005, 2009, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library
[v3] docbook biblioid/imagedata markup fixes
As noted earlier today, this removes various warnings when processing doc/xml/* files. tested x86/linux -benjamin2011-07-29 Benjamin Kosnik b...@redhat.com * doc/xml/manual/build_hacking.xml: Markup imagedata changes. * doc/xml/manual/policy_data_structures.xml: Same. * doc/xml/class.txml: Remove biblioid. * doc/xml/manual/allocator.xml: Same. * doc/xml/manual/ctype.xml: Same. * doc/xml/manual/codecvt.xml: Same. * doc/xml/manual/backwards_compatibility.xml: Same. * doc/xml/manual/abi.xml: Same. * doc/xml/manual/shared_ptr.xml: Same. * doc/xml/manual/using_exceptions.xml: Same. * doc/xml/manual/messages.xml: Same. Index: doc/xml/class.txml === --- doc/xml/class.txml (revision 176956) +++ doc/xml/class.txml (working copy) @@ -108,48 +108,57 @@ /para /section -bibliography xml:id=allocator.biblio xreflabel=allocator.biblioinfotitleBibliography/title/info +bibliography xml:id=allocator.biblio xreflabel=allocator.biblio +info + title + Bibliography + /title +/info !-- - biblioentry -abbrev -/abbrev +biblioentry xml:id=biblio.xxx + title + link xmlns:xlink=http://www.w3.org/1999/xlink; + xlink:href=http://xxx.html; + XXX + /link + /title + date + + /date -biblioid class=uri - ulink url=http://about:blank; - /ulink -/biblioid -citetitle -The Title -/citetitle + authorgroup + author + personname + firstname + E. + /firstname + surname + Gamma + /surname + /personname + /author + author + personname + firstname + R. + /firstname + surname + Helm + /surname + /personname + /author + /authorgroup -editor - firstname/firstname - surname/surname -/editor + publisher + publishername -author - surname/surname - firstname/firstname -/author - -copyright - year/year - holder/holder -/copyright -pagenums/pagenums - -publisher - publishername - /publishername -/publisher - - /biblioentry + /publishername + /publisher +/biblioentry -- - biblioentry - /biblioentry /bibliography Index: doc/xml/manual/allocator.xml === --- doc/xml/manual/allocator.xml (revision 176956) +++ doc/xml/manual/allocator.xml (working copy) @@ -504,11 +504,12 @@ /biblioentry biblioentry -biblioid xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://www.drdobbs.com/cpp/184403759; class=uri -/biblioid -citetitle + title + link xmlns:xlink=http://www.w3.org/1999/xlink; + xlink:href=http://www.drdobbs.com/cpp/184403759; The Standard Librarian: What Are Allocators Good For? -/citetitle + /link + /title authorpersonnamefirstnameMatt/firstnamesurnameAustern/surname/personname/author publisher @@ -519,21 +520,23 @@ /biblioentry biblioentry -biblioid xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://www.cs.umass.edu/~emery/hoard/; class=uri -/biblioid -citetitle + title + link xmlns:xlink=http://www.w3.org/1999/xlink; + xlink:href=http://www.cs.umass.edu/~emery/hoard; The Hoard Memory Allocator -/citetitle + /link + /title authorpersonnamefirstnameEmery/firstnamesurnameBerger/surname/personname/author /biblioentry biblioentry -biblioid xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://www.cs.umass.edu/~emery/pubs/berger-oopsla2002.pdf; class=uri -/biblioid -citetitle + title + link xmlns:xlink=http://www.w3.org/1999/xlink; + xlink:href=http://www.cs.umass.edu/~emery/pubs/berger-oopsla2002.pdf; Reconsidering Custom Memory Allocation -/citetitle + /link + /title authorpersonnamefirstnameEmery/firstnamesurnameBerger/surname/personname/author authorpersonnamefirstnameBen/firstnamesurnameZorn/surname/personname/author @@ -546,12 +549,14 @@ biblioentry -biblioid xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://www.angelikalanger.com/Articles/C++Report/Allocators/Allocators.html; class=uri -/biblioid -citetitle + title + link xmlns:xlink=http://www.w3.org/1999/xlink; + xlink:href=http://www.angelikalanger.com/Articles/C++Report/Allocators/Allocators.html; Allocator Types -/citetitle + /link + /title + authorpersonnamefirstnameKlaus/firstnamesurnameKreft/surname/personname/author authorpersonnamefirstnameAngelika/firstnamesurnameLanger/surname/personname/author publisher Index: doc/xml/manual/ctype.xml === --- doc/xml/manual/ctype.xml (revision 176956) +++ doc/xml/manual/ctype.xml (working copy) @@ -166,11 +166,12 @@ /biblioentry biblioentry -biblioid xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href
[v3] constexpr pair additions
Add constexpr markup to move/forward, and enable more std::pair constructors. tested x86/linux -benjamin2011-07-22 Benjamin Kosnik b...@redhat.com Daniel Krugler daniel.krueg...@googlemail.com * include/bits/move.h (move, forward): Mark constexpr. * include/bits/stl_pair.h (pair): Mark move ctors constexpr. * testsuite/20_util/pair/make_pair/constexpr.cc: New. * testsuite/20_util/pair/cons/constexpr.cc: Add tests. Index: include/bits/move.h === --- include/bits/move.h (revision 176670) +++ include/bits/move.h (working copy) @@ -58,12 +58,12 @@ /// forward (as per N3143) templatetypename _Tp -inline _Tp +inline constexpr _Tp forward(typename std::remove_reference_Tp::type __t) noexcept { return static_cast_Tp(__t); } templatetypename _Tp -inline _Tp +inline constexpr _Tp forward(typename std::remove_reference_Tp::type __t) noexcept { static_assert(!std::is_lvalue_reference_Tp::value, template argument @@ -78,7 +78,7 @@ * @return Same, moved. */ templatetypename _Tp -inline typename std::remove_reference_Tp::type +inline constexpr typename std::remove_reference_Tp::type move(_Tp __t) noexcept { return static_casttypename std::remove_reference_Tp::type(__t); } Index: include/bits/stl_pair.h === --- include/bits/stl_pair.h (revision 176670) +++ include/bits/stl_pair.h (working copy) @@ -128,24 +128,24 @@ // DR 811. templateclass _U1, class = typename enable_ifis_convertible_U1, _T1::value::type - pair(_U1 __x, const _T2 __y) + constexpr pair(_U1 __x, const _T2 __y) : first(std::forward_U1(__x)), second(__y) { } templateclass _U2, class = typename enable_ifis_convertible_U2, _T2::value::type - pair(const _T1 __x, _U2 __y) + constexpr pair(const _T1 __x, _U2 __y) : first(__x), second(std::forward_U2(__y)) { } templateclass _U1, class _U2, class = typename enable_if__and_is_convertible_U1, _T1, is_convertible_U2, _T2::value::type - pair(_U1 __x, _U2 __y) + constexpr pair(_U1 __x, _U2 __y) : first(std::forward_U1(__x)), second(std::forward_U2(__y)) { } templateclass _U1, class _U2, class = typename enable_if__and_is_convertible_U1, _T1, is_convertible_U2, _T2::value::type - pair(pair_U1, _U2 __p) + constexpr pair(pair_U1, _U2 __p) : first(std::forward_U1(__p.first)), second(std::forward_U2(__p.second)) { } @@ -275,8 +275,8 @@ #ifdef __GXX_EXPERIMENTAL_CXX0X__ // NB: DR 706. templateclass _T1, class _T2 -inline pairtypename __decay_and_strip_T1::__type, - typename __decay_and_strip_T2::__type +inline constexpr pairtypename __decay_and_strip_T1::__type, + typename __decay_and_strip_T2::__type make_pair(_T1 __x, _T2 __y) { typedef typename __decay_and_strip_T1::__type __ds_type1; Index: testsuite/20_util/pair/make_pair/constexpr.cc === --- testsuite/20_util/pair/make_pair/constexpr.cc (revision 0) +++ testsuite/20_util/pair/make_pair/constexpr.cc (revision 0) @@ -0,0 +1,42 @@ +// { dg-do compile } +// { dg-options -std=gnu++0x } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// http://www.gnu.org/licenses/. + + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on pair, and also vector. If the implementation +// changes this test may begin to fail. + +#include memory +#include testsuite_hooks.h + +void +test1() +{ + bool test __attribute__((unused)) = true; + typedef std::pairint, float pair_type; + constexpr pair_type p1 = std::make_pair(22, 22.222); +} + +int +main() +{ + test1(); + return 0; +} Index: testsuite/20_util/pair/cons/constexpr.cc === --- testsuite/20_util/pair/cons/constexpr.cc (revision 176670) +++ testsuite/20_util/pair/cons/constexpr.cc (working copy) @@ -1,7 +1,7 @@ // { dg-do compile } // { dg-options -std=gnu++0x } -// Copyright (C) 2010 Free Software Foundation, Inc. +// Copyright (C) 2010, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library
[v3] testsuite renames
Some shortened pathnames from doc cleanup branch. tested x86/linux -benjamin2011-07-21 Benjamin Kosnik b...@redhat.com * testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc: Move... * testsuite/ext/pb_ds/regression/tree_set_rand.cc: ... here. * testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc: Move... * testsuite/ext/pb_ds/regression/tree_set_rand_debug.cc: ... here. * testsuite/ext/pb_ds/regression/tree_data_map_rand.cc: Move... * testsuite/ext/pb_ds/regression/tree_map_rand.cc: ... here. * testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc: Move... * testsuite/ext/pb_ds/regression/tree_map_rand_debug.cc: ... here. * testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc: Move... * testsuite/ext/pb_ds/regression/trie_set_rand.cc: ... here. * testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc: Move... * testsuite/ext/pb_ds/regression/trie_set_rand_debug.cc: ... here. * testsuite/ext/pb_ds/regression/trie_data_map_rand.cc: Move... * testsuite/ext/pb_ds/regression/trie_map_rand.cc: ... here. * testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc: Move... * testsuite/ext/pb_ds/regression/trie_map_rand_debug.cc: ... here. * testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc: Move. * testsuite/ext/pb_ds/regression/list_update_set_rand.cc: ...here. * testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc: Move... * testsuite/ext/pb_ds/regression/list_update_set_rand_debug.cc: ...here. * testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc: Move... * testsuite/ext/pb_ds/regression/list_update_map_rand.cc: ...here. * testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc: Move... * testsuite/ext/pb_ds/regression/list_update_map_rand_debug.cc: ...here. * testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc: Move... * testsuite/ext/pb_ds/regression/hash_set_rand.cc: ...here. * testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc: Move... * testsuite/ext/pb_ds/regression/hash_set_rand_debug.cc: ...here. * testsuite/ext/pb_ds/regression/hash_data_map_rand.cc: Move... * testsuite/ext/pb_ds/regression/hash_map_rand.cc: ...here. * testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc: Move... * testsuite/ext/pb_ds/regression/hash_map_rand_debug.cc: ...here. Index: testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc === --- testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc (revision 176612) +++ testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc (working copy) @@ -1,144 +0,0 @@ -// { dg-require-debug-mode } -// { dg-require-time } -// This can take long on simulators, timing out the test. -// { dg-options -DITERATIONS=5 { target simulator } } -// { dg-timeout-factor 2.0 } - -// -*- C++ -*- - -// Copyright (C) 2011 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the terms -// of the GNU General Public License as published by the Free Software -// Foundation; either version 3, or (at your option) any later -// version. - -// This library is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING3. If not see -// http://www.gnu.org/licenses/. - -/** - * @file tree_data_map_rand_debug.cc - * Contains a random-operation test for maps and sets, separated out. - */ - -#define PB_DS_REGRESSION -//#define PB_DS_REGRESSION_TRACE - -#include regression/rand/assoc/rand_regression_test.hpp -#include regression/common_type.hpp -#include ext/throw_allocator.h -#include ext/pb_ds/tag_and_trait.hpp - -#ifndef ITERATIONS -# define ITERATIONS 100 -#endif - -#ifndef KEYS -# define KEYS 200 -#endif - -// Debug version of the rand regression tests, based on tree_data_map. - -// 1 -// Simplify things by unrolling the typelist of the different -// container types into individual statements. -// -// Unroll the typelist represented by tree_types, from -// regression/common_type.hpp. This is just a compile-time list of 6 -// tree types, with different policies for the type of tree -// (ov_tree_tag, rb_tree_tag, splay_tree_tag) and for the node -// update (null_node_update, tree_order_statistics_node_update) - -using namespace __gnu_pbds::test::detail; -using namespace __gnu_pbds; -typedef __gnu_pbds::test::basic_type basic_type; -typedef __gnu_cxx::throw_allocator_randombasic_type allocator_type; - -// ov_tree_tag -typedef treebasic_type, null_type, std
[v3] constexpr n3291 missing bits
While reviewing the state of gcc constexpr vs. ISO C++, I noticed that the bitset access operator was missing, so I added it thusly. Like ice cream on a hot summer day, the expanded constexpr diagnostics do not disappoint. Thanks Jason! An example: testsuite/23_containers/bitset/operations/constexpr.cc:28:31: error: call to non-constexpr function ‘constexpr bool std::bitset_Nb::operator[](std::size_t) const [with long unsigned int _Nb = 6ul, std::size_t = long unsigned int]’ In file included from bitset:1126:7: note: ‘constexpr bool std::bitset_Nb::operator[](std::size_t) const [with long unsigned int _Nb = 6ul, std::size_t = long unsigned int]’ is not constexpr because it does not satisfy the requirements: bitset:1127:42: error: call to non-constexpr function ‘constexpr bool std::bitset_Nb::_Unchecked_test(std::size_t) const [with long unsigned int _Nb = 6ul, std::size_t = long unsigned int]’ bitset:1021:7: note: ‘constexpr bool std::bitset_Nb::_Unchecked_test(std::size_t) const [with long unsigned int _Nb = 6ul, std::size_t = long unsigned int]’ is not constexpr because it does not satisfy the requirements: bitset:1023:28: error: call to non-constexpr function ‘std::_Base_bitset1ul::_WordT std::_Base_bitset1ul::_M_getword(std::size_t) const’ Yay! This makes speculating about constexpr much easier to debug. tested x86/linux -benjamin Index: include/std/bitset === --- include/std/bitset (revision 176490) +++ include/std/bitset (working copy) @@ -111,7 +111,7 @@ _M_getword(size_t __pos) _GLIBCXX_NOEXCEPT { return _M_w[_S_whichword(__pos)]; } - _WordT + _GLIBCXX_CONSTEXPR _WordT _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT { return _M_w[_S_whichword(__pos)]; } @@ -221,12 +221,11 @@ // find first on bit size_t - _M_do_find_first(size_t __not_found) const _GLIBCXX_NOEXCEPT; + _M_do_find_first(size_t) const _GLIBCXX_NOEXCEPT; // find the next on bit that follows prev size_t - _M_do_find_next(size_t __prev, size_t __not_found) const - _GLIBCXX_NOEXCEPT; + _M_do_find_next(size_t, size_t) const _GLIBCXX_NOEXCEPT; }; // Definitions of non-inline functions from _Base_bitset. @@ -405,7 +404,7 @@ _M_getword(size_t) _GLIBCXX_NOEXCEPT { return _M_w; } - _WordT + _GLIBCXX_CONSTEXPR _WordT _M_getword(size_t) const _GLIBCXX_NOEXCEPT { return _M_w; } @@ -557,7 +556,7 @@ return *new _WordT; } - _WordT + _GLIBCXX_CONSTEXPR _WordT _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT { return 0; } @@ -1017,7 +1016,7 @@ return *this; } - bool + _GLIBCXX_CONSTEXPR bool _Unchecked_test(size_t __pos) const _GLIBCXX_NOEXCEPT { return ((this-_M_getword(__pos) _Base::_S_maskbit(__pos)) != static_cast_WordT(0)); } @@ -1122,7 +1121,7 @@ operator[](size_t __position) { return reference(*this, __position); } - bool + _GLIBCXX_CONSTEXPR bool operator[](size_t __position) const { return _Unchecked_test(__position); } //@} Index: testsuite/23_containers/bitset/operations/constexpr.cc === --- testsuite/23_containers/bitset/operations/constexpr.cc (revision 0) +++ testsuite/23_containers/bitset/operations/constexpr.cc (revision 0) @@ -0,0 +1,40 @@ +// { dg-do compile } +// { dg-options -std=gnu++0x } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// http://www.gnu.org/licenses/. + +#include bitset + +int main() +{ + // bitset base type + typedef std::_Base_bitset6 bitset_base; + constexpr bitset_base base = bitset_base(); + + constexpr auto r1 = base._M_getword(2); + // constexpr auto r2 = base._M_getdata(); // error, pointer to this + auto r2 = base._M_getdata(); + constexpr auto r3 = base._M_hiword(); + + // bitset operators + typedef std::bitset6 bitset_type; + constexpr bitset_type a = bitset_type(); + constexpr auto v = a[0]; + + return 0; +}
Re: Remove NetWare support
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4 --- a/libstdc++-v3/crossconfig.m4 +++ b/libstdc++-v3/crossconfig.m4 @@ -173,14 +173,6 @@ case ${host} in AC_DEFINE(HAVE_ISNANL) fi ;; - *-netware) -SECTION_FLAGS='-ffunction-sections -fdata-sections' -AC_SUBST(SECTION_FLAGS) -GLIBCXX_CHECK_LINKER_FEATURES -AC_DEFINE(HAVE_HYPOT) -AC_DEFINE(HAVE_ISINF) -AC_DEFINE(HAVE_ISNAN) -;; *-qnx6.1* | *-qnx6.2*) SECTION_FLAGS='-ffunction-sections -fdata-sections' AC_SUBST(SECTION_FLAGS) OK. -benjamin
[v3] constexpr time_point additions
This updates chrono to N3291, and adds constexpr to time_point nonmember arithmetic operations, as pointed out to me in private email by Daniel Krugler. Indeed, they can become constant expressions: thanks! These additions are on top of N3229. tested x86/linux -benjamin2011-07-20 Benjamin Kosnik b...@redhat.com Daniel Krugler daniel.krueg...@googlemail.com * include/std/chrono: (system_clock::is_steady): Update to N3291 from is_monotonic. (time_point): Add constexpr to nonmember arithmetic operators. * src/chrono.cc: Modify for above. * src/compatibility-c++0x.cc: Same. * testsuite/20_util/time_point/nonmember/constexpr.cc: New. * testsuite/20_util/time_point/1.cc: Modify. * testsuite/20_util/system_clock/constexpr_data.cc: Modify. * testsuite/20_util/system_clock/1.cc: Modify. * testsuite/20_util/monotonic_clock/constexpr_data.cc: Move to... * testsuite/20_util/steady_clock/constexpr_data.cc: ...here. * testsuite/30_threads/condition_variable/members/2.cc: Modify. * testsuite/30_threads/condition_variable_any/members/2.cc: Modify. Index: src/chrono.cc === --- src/chrono.cc (revision 176534) +++ src/chrono.cc (working copy) @@ -39,7 +39,7 @@ { _GLIBCXX_BEGIN_NAMESPACE_VERSION - constexpr bool system_clock::is_monotonic; +constexpr bool system_clock::is_steady; system_clock::time_point system_clock::now() throw () @@ -63,10 +63,10 @@ } #ifdef _GLIBCXX_USE_CLOCK_MONOTONIC -constexpr bool monotonic_clock::is_monotonic; +constexpr bool steady_clock::is_steady; -monotonic_clock::time_point -monotonic_clock::now() +steady_clock::time_point +steady_clock::now() { timespec tp; // -EINVAL, -EFAULT Index: src/compatibility-c++0x.cc === --- src/compatibility-c++0x.cc (revision 176534) +++ src/compatibility-c++0x.cc (working copy) @@ -1,6 +1,6 @@ // Compatibility symbols for previous versions, C++0x bits -*- C++ -*- -// Copyright (C) 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -81,4 +81,17 @@ const size_t __tmp = std::_Hash_impl::hash(__e._M_value); return std::_Hash_impl::__hash_combine(__e._M_cat, __tmp); } + + + // gcc-4.7.0 + // chrono changes is_monotonic to is_steady. + namespace chrono + { +struct system_clock +{ + static constexpr bool is_monotonic = false; +}; +constexpr bool system_clock::is_monotonic; + } // namespace chrono } + Index: include/std/chrono === --- include/std/chrono (revision 176534) +++ include/std/chrono (working copy) @@ -585,7 +585,7 @@ templatetypename _Clock, typename _Dur1, typename _Rep2, typename _Period2 - inline time_point_Clock, + inline constexpr time_point_Clock, typename common_type_Dur1, duration_Rep2, _Period2::type operator+(const time_point_Clock, _Dur1 __lhs, const duration_Rep2, _Period2 __rhs) @@ -593,27 +593,37 @@ typedef duration_Rep2, _Period2 __dur2; typedef typename common_type_Dur1,__dur2::type __ct; typedef time_point_Clock, __ct __time_point; - return __time_point(__lhs) += __rhs; + return __time_point(__lhs.time_since_epoch() + __rhs); } templatetypename _Rep1, typename _Period1, typename _Clock, typename _Dur2 - inline time_point_Clock, + inline constexpr time_point_Clock, typename common_typeduration_Rep1, _Period1, _Dur2::type operator+(const duration_Rep1, _Period1 __lhs, const time_point_Clock, _Dur2 __rhs) - { return __rhs + __lhs; } + { + typedef duration_Rep1, _Period1 __dur1; + typedef typename common_type__dur1,_Dur2::type __ct; + typedef time_point_Clock, __ct __time_point; + return __time_point(__rhs.time_since_epoch() + __lhs); + } templatetypename _Clock, typename _Dur1, typename _Rep2, typename _Period2 - inline time_point_Clock, + inline constexpr time_point_Clock, typename common_type_Dur1, duration_Rep2, _Period2::type operator-(const time_point_Clock, _Dur1 __lhs, const duration_Rep2, _Period2 __rhs) - { return __lhs + (-__rhs); } + { + typedef duration_Rep2, _Period2 __dur2; + typedef typename common_type_Dur1,__dur2::type __ct; + typedef time_point_Clock, __ct __time_point; + return __time_point(__lhs.time_since_epoch() -__rhs); + } templatetypename _Clock, typename _Dur1, typename _Dur2 - inline typename common_type_Dur1, _Dur2::type + inline constexpr typename common_type_Dur1, _Dur2::type operator-(const time_point_Clock, _Dur1 __lhs, const time_point_Clock, _Dur2 __rhs) { return
[v3] constexpr array additions
Also pointed out by Daniel. It's kind of hokey to work around -fno-exceptions like this, but seems harmless. In this particular case, deferring the throw to a function like __throw_out_of_range makes the ::at member an invalid constant expression. Yay! std::array with compile time operator []! tested x86/linux -benjamin2011-07-20 Benjamin Kosnik b...@redhat.com Daniel Krugler daniel.krueg...@googlemail.com * include/std/array (array::at, array::operator[]): Mark constexpr. * testsuite/23_containers/array/requirements/ constexpr_element_access.cc: Add. Index: include/std/array === --- include/std/array (revision 176549) +++ include/std/array (working copy) @@ -35,6 +35,7 @@ # include bits/c++0x_warning.h #else +#include stdexcept #include bits/stl_algobase.h #include bits/range_access.h @@ -150,8 +151,8 @@ operator[](size_type __n) { return _M_instance[__n]; } - const_reference - operator[](size_type __n) const + constexpr const_reference + operator[](size_type __n) const noexcept { return _M_instance[__n]; } reference @@ -162,12 +163,15 @@ return _M_instance[__n]; } - const_reference + constexpr const_reference at(size_type __n) const { - if (__n = _Nm) - std::__throw_out_of_range(__N(array::at)); - return _M_instance[__n]; + return __n _Nm ? _M_instance[__n] : +#ifdef __EXCEPTIONS + throw out_of_range(__N(array::at)); +#else + _M_instance[0]; +#endif } reference Index: testsuite/23_containers/array/requirements/constexpr_element_access.cc === --- testsuite/23_containers/array/requirements/constexpr_element_access.cc (revision 0) +++ testsuite/23_containers/array/requirements/constexpr_element_access.cc (revision 0) @@ -0,0 +1,31 @@ +// { dg-do compile } +// { dg-options -std=gnu++0x } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// http://www.gnu.org/licenses/. + +#include array + +int main() +{ + // array + typedef std::arraystd::size_t, 6 array_type; + constexpr array_type a = { 0, 55, 66, 99, 4115, 2 }; + constexpr auto v1 = a[1]; + constexpr auto v2 = a.at(2); + return 0; +}
Re: [PATCH][libstdc++] Also install cxxabi_tweaks.h in freestanding mode.
2011-04-27 Doug Kwan dougk...@google.com * include/Makefile.am (install-freestanding-headers): Also install cxxabi_tweaks.h. * include/Makefile.in: Regnerate. OK for trunk and 4.6 -benjamin
Re: [wwdocs] add libstdc++ docs for 4.6.0
I ended up fiddling a bit with permissions and such, but everything should be in place now and I also committed the web patch on your behalf. Thanks! This pleases me a great deal. Testing the links, there is one thing does does not work, and where I was not sure how to address it: The first link to the manual, http://gcc.gnu.org/onlinedocs/gcc-4.6.0/libstdc++/manual/ does not work. Should be: http://gcc.gnu.org/onlinedocs/gcc-4.6.0/libstdc++/manual/spine.html -benjamin
[wwdocs] add libstdc++ docs for 4.6.0
Hi Gerald! I've gone ahead and generated libstdc++ documentation for the 4.6.0 release. Please find enclosed a patch for the main gcc documentation page (http://gcc.gnu.org/onlinedocs) that adds these links. Of course, these links are predicated on your moving: ~bkoz/gcc-4.6.0/libstdc++ into /sourceware/www/gcc/htdocs/onlinedocs/gcc-4.6.0 best, benjamin2011-04-05 Benjamin Kosnik b...@redhat.com * htdocs/onlinedocs/index.html: Add libstdc++ documentation for 4.6.0. Index: htdocs/onlinedocs/index.html === RCS file: /cvs/gcc/wwwdocs/htdocs/onlinedocs/index.html,v retrieving revision 1.113 diff -c -p -r1.113 index.html *** htdocs/onlinedocs/index.html 25 Mar 2011 20:09:00 - 1.113 --- htdocs/onlinedocs/index.html 6 Apr 2011 01:09:02 - *** *** 60,65 --- 60,79 href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gnat_ugn_unw.ps.gz;PostScript/a or a href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gnat_ugn_unw-html.tar.gz;an HTML tarball/a)/li + lia href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/libstdc++/manual/;GCC + 4.6.0 Standard C++ Library Manual /a (a + href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/libstdc++/libstdc++-manual.pdf.bz2;also + in PDF/a or a + href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/libstdc++/libstdc++-manual-single.xml.bz2;XML/a or a + href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/libstdc++/libstdc++-manual.html.tar.bz2;an + HTML tarball/a)/li + lia href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/libstdc++/api/;GCC + 4.6.0 Standard C++ Library Reference Manual /a (a + href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/libstdc++/libstdc++-api.pdf.bz2;also + in PDF/a or a + href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/libstdc++/libstdc++-api-single.xml.bz2;XML/a or a + href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/libstdc++/libstdc++-api.html.tar.bz2;an + HTML tarball/a)/li lia href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gccgo/;GCCGO 4.6.0 Manual/a (a href=http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gccgo.pdf;also in PDF/a or a
Re: [PATCH] sparc and alpha baseline_symbols.txt update
2011-03-22 Matthias Klose d...@ubuntu.com * config/abi/post/sparc-linux-gnu/baseline_symbols.txt: Regenerated. 2011-03-22 Uros Bizjak ubiz...@gmail.com * config/abi/post/alpha-linux-gnu/baseline_symbols.txt: Regenerated. Yay. Jakub I'm deferring to you on this, your analysis seems sound. The consistency checks between arches is a positive sign -benjamin
Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release
2011-03-15 Rainer Orth r...@cebitec.uni-bielefeld.de * config/abi/post/solaris2.8/baseline_symbols.txt: Regenerate. * config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/amd64/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt: Likewise. OK. Looks great thanks Ranier. -benjamin
Re: [Patch] [libstdc++] [C++0x] Export std::string base object move constructor.
Here is updated patch with testcases, tested with unpatched libstdc++ where it failed to link and patched where it succeeded. The testcases are copies of corresponding moveable.cc tests, just using the new class inheriting from std::basic_stringchar resp. std::basic_stringwchar_t and with -fno-inline. Is that ok? 2011-03-22 Jakub Jelinek ja...@redhat.com * config/abi/pre/gnu.ver (GLIBCXX_3.4.15): Export _ZNSsC2EOSs and _ZNSbIwSt11char_traitsIwESaIwEEC2EOS2_. * config/abi/post/solaris2.8/baseline_symbols.txt: Regenerated. * config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt: Likewise. * config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Likewise. * config/abi/post/powerpc-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/amd64/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt: Likewise. * config/abi/post/i486-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/i386-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/s390-linux-gnu/baseline_symbols.txt: Likewise. * testsuite/21_strings/basic_string/cons/char/moveable2.cc: New test. * testsuite/21_strings/basic_string/cons/wchar_t/moveable2.cc: New test. OK. Thanks! -benjamin
Re: [PATCH] libstdc++ ABI issues with __int128
2011-03-19 Jakub Jelinek ja...@redhat.com * config/abi/pre/gnu.ver (CXXABI_1.3): Don't export _ZT[IS][PK]*[no]. (CXXABI_1.3.5): Export _ZTI[PK]*[no]. This looks good to me, nice catch. I'll figure out what happened with check_abi when I'm back, conductivity-wise. And: And another question is, we still export a bunch of new _ZTS* symbols, isn't that now pointless when we always do strcmp anyway? Yes, indeed it is as long as !__GXX_TYPEINFO_EQUALITY_INLINE !__GXX_MERGED_TYPEINFO_NAMES for all targets that have baseline symbols. I think that is correct, since they are all linux targets. But arm-linux too? I'm talking about _ZTSSt16nested_exception@@CXXABI_1.3.5 OBJECT WEAK DEFAULT 21 _ZTSNSt13__future_base11_State_baseE@@GLIBCXX_3.4.15 OBJECT WEAK DEFAULT 33 _ZTSNSt13__future_base12_Result_baseE@@GLIBCXX_3.4.15 OBJECT WEAK DEFAULT 34 _ZTSSt11regex_error@@GLIBCXX_3.4.15 OBJECT WEAK DEFAULT 16 _ZTSSt12bad_weak_ptr@@GLIBCXX_3.4.15 OBJECT WEAK DEFAULT 17 _ZTSSt17bad_function_call@@GLIBCXX_3.4.15 OBJECT WEAK DEFAULT 22 here. Yeah, basically all _ZTS* from GLIBCXX_3.4.15 and CXXABI_1.3.5 . -benjamin
Re: [v3] typeinfo tuning
Could that be related to the fact that I now keep getting linker errors about std::range_error::~range_error() being undefined? The .o file is looking for _ZNSt11range_errorD2Ev but libstdc++ has D0Ev and D1Ev. Indeed. Fixed thusly. tested x86/linux -benjamin 2011-03-16 Benjamin Kosnik b...@redhat.com * config/abi/pre/gnu.ver: Add base destructors for stdexcept classes. * testsuite/19_diagnostics/stdexcept.cc: New. Index: testsuite/19_diagnostics/stdexcept.cc === --- testsuite/19_diagnostics/stdexcept.cc (revision 0) +++ testsuite/19_diagnostics/stdexcept.cc (revision 0) @@ -0,0 +1,228 @@ +// 2011-03-16 Benjamin Kosnik b...@redhat.com + +// Copyright (C) 2011 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// http://www.gnu.org/licenses/. + +#include string +#include stdexcept +#include testsuite_hooks.h + +void test01() +{ + using namespace std; + std::string s(error); + + try +{ + logic_error e1(s); + throw e1; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + domain_error e2(s); + throw e2; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + invalid_argument e3(s); + throw e3; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + length_error e4(s); + throw e4; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + out_of_range e5(s); + throw e5; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + runtime_error e6(s); + throw e6; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + range_error e7(s); + throw e7; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + overflow_error e8(s); + throw e8; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + underflow_error e9(s); + throw e9; +} + catch(const exception e) +{ + s = e.what(); +} +} + +templatetypename _Tp +struct extra_error : public _Tp +{ + extra_error(const std::string s) : _Tp(s) { } +}; + +void test02() +{ + using namespace std; + std::string s(error); + + try +{ + extra_errorlogic_error e1(s); + throw e1; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + extra_errordomain_error e2(s); + throw e2; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + extra_errorinvalid_argument e3(s); + throw e3; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + extra_errorlength_error e4(s); + throw e4; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + extra_errorout_of_range e5(s); + throw e5; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + extra_errorruntime_error e6(s); + throw e6; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + extra_errorrange_error e7(s); + throw e7; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + extra_erroroverflow_error e8(s); + throw e8; +} + catch(const exception e) +{ + s = e.what(); +} + + try +{ + extra_errorunderflow_error e9(s); + throw e9; +} + catch(const exception e) +{ + s = e.what(); +} +} + +int main(void) +{ + test01(); + test02(); + return 0; +} Index: config/abi/pre/gnu.ver === --- config/abi/pre/gnu.ver (revision 171047) +++ config/abi/pre/gnu.ver (working copy) @@ -1221,6 +1221,14 @@ _ZNSt8__detail15_List_node_base11_M_transfer*; _ZNSt8__detail15_List_node_base4swapERS0_S1_; +_ZNSt11range_errorD2Ev; +_ZNSt12domain_errorD2Ev; +_ZNSt12length_errorD2Ev; +_ZNSt12out_of_rangeD2Ev; +_ZNSt14overflow_errorD2Ev; +_ZNSt15underflow_errorD2Ev; +_ZNSt16invalid_argumentD2Ev; + _ZNSt11regex_errorD*; _ZNKSt11regex_error4whatEv; _ZTSSt11regex_error;
Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release
I think we agreed that it would be useful to regenerate the Solaris 2 libstdc++ baselines close to the GCC 4.6.0 release, especially given that symbol versioning on Solaris appears in 4.6.0 for the first time and several symbols have been added to the libstdc++.so ABI since the last update. I agree we should do this for 4.6.0, but I disagree as to what the exact exports should be. -benjamin
Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release
The lines in question are ##_ZTISt16nested_exception (glob) _ZTISt16nested_exception; ##_ZTSSt16nested_exception (glob) _ZTSSt16nested_exception; ##_ZTVSt16nested_exception (glob) _ZTVSt16nested_exception; in CXXABI_1.3.5, but the same symbols are also matched by ##_ZTISt[0-9][0-9][m-q]* (glob) ##_ZTSSt[0-9][0-9][m-q]* (glob) ##_ZTVSt[0-9][0-9][m-q]* (glob) in GLIBCXX_3.4. I fear that I need to update contrib/make_sunver.pl to handle this, but would need to know the exact semantics of such a version script first. Here's a patch that makes this exports crystal clear. FWIW, the linux exports for these nested_exception symbols were in GLIBCXX_3.15 which was correct. This is still the case, even with the explicit carve-outs in the patch below. I've also changed the bad_function_call exports to not be in libsupc++, or the freestanding version. (ie to GLIBCXX from CXXABI). I think this was probably a simple thinko, right Paolo? If it's not, I'm not sure of the rationale and would appreciate any commentary. best, benjamin2011-03-15 Benjamin Kosnik b...@redhat.com * config/abi/pre/gnu.ver: Make nested_exception exports super clear. Move bad_function_call exports from CXXABI_1.3.5 to GLIBCXX_3.4.15. Index: config/abi/pre/gnu.ver === --- config/abi/pre/gnu.ver (revision 171002) +++ config/abi/pre/gnu.ver (working copy) @@ -618,7 +618,10 @@ _ZTVSt[0-9][0-9][g-k]*; _ZTVSt11logic_error; _ZTVSt12length_error; -_ZTVSt[0-9][0-9][m-q]*; +# _ZTVSt[0-9][0-9][m-q]*; +_ZTVSt[0-9][0-9][m]*; +_ZTVSt[0-9][0-9]n[^e]*; +_ZTVSt[0-9][0-9][o-q]*; _ZTVSt11range_error; _ZTVSt13runtime_error; _ZTVSt[0-9][0-9][t-z]*; @@ -648,7 +651,10 @@ _ZTISt[0-9][0-9][g-k]*; _ZTISt11logic_error; _ZTISt12length_error; -_ZTISt[0-9][0-9][m-q]*; +# _ZTISt[0-9][0-9][m-q]*; +_ZTISt[0-9][0-9][m]*; +_ZTISt[0-9][0-9]n[^e]*; +_ZTISt[0-9][0-9][o-q]*; _ZTISt11range_error; _ZTISt13runtime_error; _ZTISt[0-9][0-9][t-z]*; @@ -682,7 +688,10 @@ _ZTSSt[0-9][0-9][g-k]*; _ZTSSt11logic_error; _ZTSSt12length_error; -_ZTSSt[0-9][0-9][m-q]*; +# _ZTSSt[0-9][0-9][m-q]*; +_ZTSSt[0-9][0-9][m]*; +_ZTSSt[0-9][0-9]n[^e]*; +_ZTSSt[0-9][0-9][o-q]*; _ZTSSt11range_error; _ZTSSt13runtime_error; _ZTSSt[0-9][0-9][t-z]*; @@ -1219,12 +1228,19 @@ _ZTISt11regex_error; _ZSt19__throw_regex_errorNSt15regex_constants10error_typeE; +# std::bad_weak_ptr _ZNSt12bad_weak_ptrD*; _ZNKSt12bad_weak_ptr4whatEv; _ZTSSt12bad_weak_ptr; _ZTVSt12bad_weak_ptr; _ZTISt12bad_weak_ptr; +# std::bad_function_call +_ZNSt17bad_function_callD*; +_ZTISt17bad_function_call; +_ZTSSt17bad_function_call; +_ZTVSt17bad_function_call; + _ZNSt14error_categoryC*; _ZNSt14error_categoryD*; @@ -1422,12 +1438,6 @@ # FNV hash. _ZSt15_Fnv_hash_bytesPKv*; -# std::bad_function_call. -_ZNSt17bad_function_callD*; -_ZTISt17bad_function_call; -_ZTSSt17bad_function_call; -_ZTVSt17bad_function_call; - # std::nested_exception _ZNSt16nested_exceptionD*; _ZTISt16nested_exception;
[v3] regex versioned namespaces
Ugh. While doing other things I realized that the namespace versioning for regex header files is off: it's not on the inner-most nested namespace. Fixed thusly. tested x86/linux tested x86/linux --enable-symvers=gnu-namespace-versioned -benjamin2011-03-14 Benjamin Kosnik b...@redhat.com * include/bits/regex_compiler.h: Nest namespace versioning. * include/bits/regex_grep_matcher.tcc: Same. * include/bits/regex_grep_matcher.h: Same. * include/bits/regex_cursor.h: Same. * include/bits/regex_nfa.h: Same. * include/bits/regex_nfa.tcc: Same. * include/bits/regex_grep_matcher.h: Version forward declarations. * include/bits/c++config: Add namespace association for __regex. * include/bits/regex.h: Make sub_match consistent. Index: include/bits/regex_grep_matcher.h === --- include/bits/regex_grep_matcher.h (revision 170975) +++ include/bits/regex_grep_matcher.h (working copy) @@ -30,12 +30,15 @@ namespace std _GLIBCXX_VISIBILITY(default) { +_GLIBCXX_BEGIN_NAMESPACE_VERSION templatetypename _BiIter class sub_match; templatetypename _Bi_iter, typename _Allocator class match_results; + +_GLIBCXX_END_NAMESPACE_VERSION namespace __regex { Index: include/bits/c++config === --- include/bits/c++config (revision 170975) +++ include/bits/c++config (working copy) @@ -170,9 +170,6 @@ { inline namespace _6 { } - namespace __detail { inline namespace _6 { } } - - namespace rel_ops { inline namespace _6 { } } namespace tr1 @@ -189,6 +186,9 @@ namespace placeholders { inline namespace _6 { } } namespace regex_constants { inline namespace _6 { } } namespace this_thread { inline namespace _6 { } } + + namespace __detail { inline namespace _6 { } } + namespace __regex { inline namespace _6 { } } } namespace __gnu_cxx Index: include/bits/regex.h === --- include/bits/regex.h (revision 170975) +++ include/bits/regex.h (working copy) @@ -1459,7 +1459,7 @@ templatetypename _Bi_iter, typename _Allocator = allocatorsub_match_Bi_iter class match_results -: private std::vectorstd::sub_match_Bi_iter, _Allocator +: private std::vectorsub_match_Bi_iter, _Allocator { private: /* @@ -1473,8 +1473,7 @@ * [n+1] prefix * [n+2] suffix */ - typedef std::vectorstd::sub_match_Bi_iter, _Allocator - _Base_type; + typedef std::vectorsub_match_Bi_iter, _Allocator_Base_type; public: /**
Re: [v3] typeinfo tuning
It broke build, hopefully for trivial reasons. It seems like your bugzilla options are set to not receive email, so I'll have to bug you like this, and ask that you please have a look at PR48130. No problem. Sorry about the breakage. Indeed, it was trivial. tested x86_64/linux tested x86/64, compiled arm-eabi -benjamin2011-03-14 Benjamin Kosnik b...@redhat.com PR libstdc++/48130 * src/future.cc: Guard definitions. * libsupc++/nested_exception.cc: Same. Index: src/future.cc === --- src/future.cc (revision 170978) +++ src/future.cc (working copy) @@ -79,11 +79,14 @@ const char* future_error::what() const throw() { return _M_code.message().c_str(); } +#if defined(_GLIBCXX_HAS_GTHREADS) defined(_GLIBCXX_USE_C99_STDINT_TR1) \ + defined(_GLIBCXX_ATOMIC_BUILTINS_4) __future_base::_Result_base::_Result_base() = default; __future_base::_Result_base::~_Result_base() = default; __future_base::_State_base::~_State_base() = default; +#endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std Index: libsupc++/nested_exception.cc === --- libsupc++/nested_exception.cc (revision 170978) +++ libsupc++/nested_exception.cc (working copy) @@ -25,5 +25,7 @@ namespace std { +#ifdef _GLIBCXX_ATOMIC_BUILTINS_4 nested_exception::~nested_exception() = default; +#endif } // namespace std