Commit Graph

1109 Commits

Author SHA1 Message Date
Howard Hinnant 35b3b54548 More vector::iterator debug mode tests. Run by adding to OPTIONS -D_LIBCPP_DEBUG2=1.
llvm-svn: 177897
2013-03-25 20:03:19 +00:00
Howard Hinnant 92bd7c0337 Debug mode: learning to crawl. I need to set up some tests that actually test that the debug mode is working, but that won't cause problems when debug mode isn't on. This is my first prototype of such a test. It should call std::terminate() because it's comparing iterators from different containers. And std::terminate() is rigged up to exit normally. If debug mode fails, and doesn't call terminate, then the program asserts. The test is a no-op if _LIBCPP_DEBUG2 is not defined or is defined to be 0.
llvm-svn: 177892
2013-03-25 19:29:35 +00:00
Howard Hinnant a60ae88db2 Marshall Clow found some divide-by-zero warnings with UBSan in rand's binomial_distribution test. This eliminates the divide-by-zeros and describes in comments the numerical difficulties the test is having. Each of the problematic tests are exploring edge cases of the distribution.
llvm-svn: 177826
2013-03-23 19:29:45 +00:00
Howard Hinnant 65a87ccdbf This is a start at making the libc++ test suite friendlier to the -fnoexceptions flag. Although this is not a complete solution, it does reduce the number of test failures on OS X from 467 to 128 on OS X when -fno-exceptions is enabled, and does not impact the number of failures at all when -fno-exceptions is not enabled. The bulk of this code was donated anonymously.
llvm-svn: 177824
2013-03-23 17:27:16 +00:00
Howard Hinnant 7c5b88b134 Test cleanup with respect to use of deprecated tmpnam function. Also Windows port for these tests to use _tempnam. The bulk of this patch was donated anonymously. I've tested it on OS X and accept responsibility for it. If I've broken anyone's platform by switching from tmpnam to mktemp for the generation of temporary file names, just let me know. Should be easy to fix in test/support/platform_support.h
llvm-svn: 177755
2013-03-22 20:05:40 +00:00
Marshall Clow c962cdf8a5 Fix buffer read overflow in money_get::do_get(). Found by UBSan
llvm-svn: 177694
2013-03-22 02:14:40 +00:00
Marshall Clow 1c2c986796 Fix undefined behavior in syntax_option_type::operator~ and match_flag_type::operator./a.out Found by UBSan
llvm-svn: 177693
2013-03-22 02:13:55 +00:00
Marshall Clow 761b5cf087 Fix bug in test; found by AddressSanitizer
llvm-svn: 177464
2013-03-20 00:01:48 +00:00
Howard Hinnant 4bb98d0917 Marshall Clow found this memory problem in strstream using -fsanitize=address on the test suite.
llvm-svn: 177452
2013-03-19 22:16:57 +00:00
Howard Hinnant 591ebe3cbb This is an optimization which produces improved launching time. There should be no functionality change. Clients should see no ABI differences.
llvm-svn: 177443
2013-03-19 21:34:48 +00:00
Marshall Clow 1c00ce5070 Fix bug in test; found by AddressSanitizer
llvm-svn: 177355
2013-03-18 23:39:36 +00:00
Marshall Clow 69e76f80e2 Removed raw references to __sun__, __FreeBSD__, __GLIBC__ and __linux__; now just check to see if they are defined.
llvm-svn: 177310
2013-03-18 19:34:07 +00:00
Marshall Clow 7415c8b171 Removed raw references to _MSC_VER; now just check to see if it is defined.
llvm-svn: 177304
2013-03-18 18:20:48 +00:00
Marshall Clow b56e8587af Removed raw references to __APPLE__; now just check to see if it is defined.
llvm-svn: 177297
2013-03-18 17:45:34 +00:00
Marshall Clow 91907cbe82 Removed raw references to _WIN32; now just check to see if it is defined.
llvm-svn: 177291
2013-03-18 17:04:29 +00:00
Howard Hinnant 5efca64dd9 This should be nothing but a load-time optimization. I'm trying to reduce load time initializers and this is a big one. No visible functionality change intended.
llvm-svn: 177212
2013-03-16 00:17:53 +00:00
Marshall Clow 928f65a8aa Updated link to Marshall's instructions
llvm-svn: 177099
2013-03-14 19:00:34 +00:00
Howard Hinnant d70e6570fd Some forward-looking and optimistic documentation.
llvm-svn: 177093
2013-03-14 18:37:48 +00:00
Howard Hinnant 41801f14ed This SO question: http://stackoverflow.com/questions/15344402/how-can-i-read-a-0xff-in-a-file-with-libc-istream-iterator/15347225#15347225 highlighted the lack of a cast in the implementation of std::cin. Added. I unfortunately don't have a test case to add to the suite since this bug only shows itself when using std::cin. The current testsuite setup does not have a way a good way to test std::cin.
llvm-svn: 176822
2013-03-11 19:53:48 +00:00
Howard Hinnant 7e4844b353 Parsing floating point numbers with very long precision was broken, and this patch fixes it. This fixes http://llvm.org/bugs/show_bug.cgi?id=15445.
llvm-svn: 176711
2013-03-08 19:06:24 +00:00
Howard Hinnant c60bf548c5 Albert Wong: definition for regex_traits<_CharT>::__regex_word.
llvm-svn: 176640
2013-03-07 19:38:08 +00:00
Howard Hinnant ead480d30a Change _LIBCPP_TYPE_VIS to use __type_visibility__(default) instead of __visibility__(default) when available. This change makes just the type_info visible so that types like vectors and strings can be used as exception objects across dylib boundaries even when hidden visibility is specified globally (at the command line), and yet this allows clients to hide the member functions of things like vector and string (with global visibility commands).
llvm-svn: 176639
2013-03-07 19:25:03 +00:00
Howard Hinnant 6e41256f68 No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
llvm-svn: 176593
2013-03-06 23:30:19 +00:00
Howard Hinnant 65f58f3fe8 Have basic_istream::read call sgetn intead of sbumpc individual characters. This addresses http://llvm.org/bugs/show_bug.cgi?id=15427.
llvm-svn: 176573
2013-03-06 19:27:56 +00:00
Howard Hinnant 3fb6c6e50d Correct silly type-o. Thanks Richard.
llvm-svn: 176568
2013-03-06 18:16:12 +00:00
Howard Hinnant 53b9ee061f The bitset(unsigned long long) constructor was broken by the constexpr additions only on 32 bit platforms. Fixed. This addresses http://llvm.org/bugs/show_bug.cgi?id=15444.
llvm-svn: 176559
2013-03-06 17:30:26 +00:00
Howard Hinnant 5b22e99e77 Michael van der Westhuizen: correction to the libcxx build instructions when built with libcxxrt on Linux.
llvm-svn: 176093
2013-02-26 16:27:55 +00:00
Howard Hinnant a9f698009f Alexey Samsonov: #ifdefs out undefined function in static build of libc++ w/o RTTI.
llvm-svn: 176026
2013-02-25 15:50:36 +00:00
Howard Hinnant c0c9748c11 Constrain bind operator()() to not exist if the call is not valid. Fixes http://llvm.org/bugs/show_bug.cgi?id=15295.
llvm-svn: 175774
2013-02-21 18:16:55 +00:00
David Chisnall 8b6a4de64a Fix a bug in mutex_try_to_lock. This was previously trying to unlock a mutex that it didn't own, causing an assertion failure in mutex.cpp. The issue was that the unique_lock went out of scope, releasing the lock on m, then m.unlock() was called on an already-unlocked mutex.
This change removes the spurious m.unlock() call.  

If this test was previously passing for anyone with assertions enabled, then they should investigate bugs in their pthread implementation, as pthread_unlock() should not return 0 if the mutex is currently unlocked.

llvm-svn: 175506
2013-02-19 11:28:45 +00:00
Howard Hinnant 65af0388b9 Bruce Mitchener: Minor typo fixes.
llvm-svn: 175274
2013-02-15 15:37:50 +00:00
Daniel Dunbar 62b943935d [tests] Add support for a link_flags lit parameter.
- This is useful for testing with custom ABI libraries.
 - Patch by Michael van der Westhuizen.

llvm-svn: 174997
2013-02-12 19:28:51 +00:00
Daniel Dunbar 496f1765a2 [tests] Another batch of timeout increases.
llvm-svn: 174902
2013-02-11 21:04:34 +00:00
Howard Hinnant af00dc0420 Michael van der Westhuizen: Update instructions for building on Linux.
llvm-svn: 174733
2013-02-08 19:10:36 +00:00
Howard Hinnant 50232e50d8 Add Michael van der Westhuizen to CREDITS.TXT
llvm-svn: 174732
2013-02-08 19:08:06 +00:00
Howard Hinnant 0e2f292a30 Michael van der Westhuizen: update to CMake.
llvm-svn: 174731
2013-02-08 19:04:53 +00:00
Daniel Dunbar ceb47bb06d [tests] Another batch of timeout increases.
llvm-svn: 174726
2013-02-08 18:26:55 +00:00
Daniel Dunbar 76efb57666 [tests] Add back stdc macros I accidentally refactored out.
- Patch by Michael van der Westhuizen:
--
r174404 accidentally removed stdc format, limit and constant macros from the Linux test runner logic.  This small patch re-adds the macros.

Making this change fixes the following tests on Linux:
 - depr/depr.c.headers/inttypes_h.pass.cpp
 - depr/depr.c.headers/stdint_h.pass.cpp
 - input.output/file.streams/c.files/cinttypes.pass.cpp
 - language.support/cstdint/cstdint.syn/cstdint.pass.cpp
--

llvm-svn: 174722
2013-02-08 17:41:28 +00:00
Daniel Dunbar 577e696425 [tests] Increase a bunch of wait limits.
- Basically I just ran the thread tests many many times on a busy machine and
   bumped the timeouts whenever I hit a test failure.

 - This is obviously subpar, but is the best I can do without the tests being
   rewritten to not depend on arbitrary timeouts.

llvm-svn: 174721
2013-02-08 17:41:19 +00:00
Marshall Clow b6e5f854f5 Change the 'result_type' from unsigned to 'uint_fast32_t'. This eliminates truncation warnings on Linux
llvm-svn: 174669
2013-02-07 22:12:02 +00:00
Marshall Clow 0749262a11 Belt and suspenders when calling sysconf
llvm-svn: 174642
2013-02-07 18:48:09 +00:00
Marshall Clow 63f700e4d1 Another libc++ warning suppression on Linux; no functionality change
llvm-svn: 174637
2013-02-07 17:37:58 +00:00
Marshall Clow d58e0f5505 More libc++ warning suppression on Linux; no functionality change
llvm-svn: 174636
2013-02-07 17:20:56 +00:00
Howard Hinnant aba500d633 Revert accidental check-in. These changes are probably good, but premature at this point.
llvm-svn: 174625
2013-02-07 15:31:44 +00:00
Howard Hinnant 804f9116e5 Michael van der Westhuizen: The attached patch add support for building against libc++abi and libcxxrt to CMake builds of libc++.
Usage (with the appropriate CC and CXX environment variables) is:
$ cmake -DLIBCXX_CXX_ABI=libcxxabi '-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=/home/michael/libcxxabi/include' ../libcxx
and:
$ cmake -DLIBCXX_CXX_ABI=libcxxrt '-DLIBCXX_LIBCXXRT_INCLUDE_PATHS=/home/michael/libcxxrt/src' ../libcxx

llvm-svn: 174623
2013-02-07 15:27:39 +00:00
Marshall Clow eb159ee704 Clean up some warnings for Linux build; No functionality change
llvm-svn: 174611
2013-02-07 14:22:51 +00:00
Daniel Dunbar bdd4ec71db [build/Darwin] Use the correct libc++abi reexport list.
- This updates the build script to match the change originally in r149634, so
   that we re-export symbols from libc++abi appropriately.

llvm-svn: 174563
2013-02-07 00:24:19 +00:00
Daniel Dunbar 6bd3374de2 [build] Detabify.
llvm-svn: 174562
2013-02-07 00:24:17 +00:00
Howard Hinnant d3d4356f6e Marcin Zalewski: Change the name of a template parameter in __copy_backward from _InputIterator to _BidirectionalIterator to better document the intent of the algorithm.
llvm-svn: 174544
2013-02-06 21:03:39 +00:00
Howard Hinnant 584a65befd Give a lot more timing latitude to some of the timing tests. Busy buildbots are hitting the timing limits too often.
llvm-svn: 174539
2013-02-06 20:25:56 +00:00
Daniel Dunbar 05abe9372b [tests] Infer the cxx_under_test (as clang++).
- This is a reasonable default, and makes testing just work with no required
   parameters.

 - Add notes on all of the inferred or default values.

llvm-svn: 174538
2013-02-06 20:24:23 +00:00
Daniel Dunbar 5178942ded [tests] Change test default to run against locally built library.
llvm-svn: 174528
2013-02-06 17:47:08 +00:00
Daniel Dunbar d2d614cd84 [tests] Enable use_system_lib support on Linux.
- Patch by Michael van der Westhuizen.

llvm-svn: 174527
2013-02-06 17:45:53 +00:00
Daniel Dunbar 434fb1f6d5 [tests] One last batch of XFAILs, for tests using new symbols added to libc++.
- As of this commit, the test suite should now fully pass on both darwin11 and
   darwin12 when testing against either a locally built libc++ or the system libc++.

llvm-svn: 174478
2013-02-06 00:59:06 +00:00
Daniel Dunbar 76ff8b54b3 [build] Create the link for the final library install name in the lib dir.
- Otherwise, we never were actually linking against the right library when
   building the test applications.

llvm-svn: 174470
2013-02-06 00:04:54 +00:00
Daniel Dunbar ba65d61767 [tests] Accept XFAIL arguments that match any part of a feature.
llvm-svn: 174469
2013-02-06 00:04:52 +00:00
Daniel Dunbar 36860df355 [tests] XFAIL some locale tests that don't seem to work on any Darwin.
llvm-svn: 174459
2013-02-05 22:51:20 +00:00
Daniel Dunbar b6354a0767 [tests] If no explicit target triple is given, try to infer it.
llvm-svn: 174454
2013-02-05 22:28:03 +00:00
Daniel Dunbar a563f32c6a [tests] Mark another stream input expected failure (with system libc++).
llvm-svn: 174453
2013-02-05 22:21:52 +00:00
Daniel Dunbar d0f05fb1b7 [tests] Mark another stream input expected failure (with system libc++).
llvm-svn: 174452
2013-02-05 22:10:28 +00:00
Daniel Dunbar 5ce9a5358b [tests] Mark some string.conversions expected failures (with system libc++).
llvm-svn: 174451
2013-02-05 22:10:27 +00:00
Daniel Dunbar 1a7f7bc6bf [tests] XFAIL a few things that require libc (?) support missing on Darwin.
llvm-svn: 174450
2013-02-05 22:10:25 +00:00
Daniel Dunbar d15f013dc2 [tests] Mark some istream.unformatted expected failures (with system libc++).
llvm-svn: 174444
2013-02-05 21:43:32 +00:00
Daniel Dunbar 582c97defa [tests] Add an available feature that combines the triple and use_system_lib.
- This is so that we can easily write XFAIL markers for tests that are known
    to fail with versions of libc++ as were shipped with a particular triple.

llvm-svn: 174443
2013-02-05 21:43:30 +00:00
Daniel Dunbar f51f0319bb [tests] Add support for REQUIRES and XFAIL lines in libc++ tests.
- We parse up to the first non-empty non-comment (C++ style) line, otherwise
   the format and semantics match what is used for LLVM/Clang tests.

 - For now, the only interesting thing to test against is a user supplied
   target_triple test parameter.

llvm-svn: 174440
2013-02-05 21:03:25 +00:00
Daniel Dunbar 8495871807 [tests] Add a 'use_system_lib' parameter.
- This controls whether to execute against the locally built library or
   not. The default is currently True which maps to what was already being done
   by default.

 - I'd appreciate it if someone can implement the proper handling of this flag
   on linux, I no longer remember the details of its .so handling.

llvm-svn: 174404
2013-02-05 18:03:49 +00:00
Howard Hinnant 2446649c1e Saleem Abdulrasool: If errno is defined as volatile int, the qualifier differences can cause
template typename deductions on swap<> (used in string.cpp).  Use
decltype(errno) to replicate the type and qualifier information for holding the
errno value.  Because errno is expected to be assignable, there is no need to
use typename std::remove_const<decltype(errno)>::type to hold the value.

llvm-svn: 173172
2013-01-22 17:26:08 +00:00
Howard Hinnant f55c0db8b5 Saleem Abdulrasool: __terminate_handler and __unexpected_handler are defined but not used when
building against libsupc++ as the functions for which they are used are provided
by libsupc++.  Simply preprocess them away when building against libsupc++.

llvm-svn: 173165
2013-01-22 14:48:10 +00:00
Howard Hinnant 2ac1ae6150 Saleem Abdulrasool: Ensure that __GLIBCXX__ is defined when building with libsupc++.
llvm-svn: 173164
2013-01-22 14:44:06 +00:00
Howard Hinnant ead15d1f95 Implement the ATOMIC_*_LOCK_FREE macros.
llvm-svn: 173084
2013-01-21 20:39:41 +00:00
Howard Hinnant 8d3e797444 Donated anonymously: This enables GCC 4.8.0 to build libc++.
llvm-svn: 173060
2013-01-21 17:26:55 +00:00
Howard Hinnant d27745e4fb Make a few tests optimization-proof. These tests were failing under -O3 because the optimizer was eliminating the call to new.
llvm-svn: 172631
2013-01-16 17:56:06 +00:00
Howard Hinnant 3d7eb2f806 Optimize basic_ostream::write by having it call sputn instead of sputc.
llvm-svn: 172542
2013-01-15 17:22:03 +00:00
Howard Hinnant 980e7e7402 Make <cmath> classification macros work with integral types.
llvm-svn: 172461
2013-01-14 20:56:22 +00:00
Howard Hinnant 2153d69672 Fix a race in the construction of future. This fixes http://llvm.org/bugs/show_bug.cgi?id=14934.
llvm-svn: 172456
2013-01-14 20:01:24 +00:00
Howard Hinnant 1afbabab32 Fix string conversions functions to throw out_of_range properly. Fixes http://llvm.org/bugs/show_bug.cgi?id=14919.
llvm-svn: 172447
2013-01-14 18:59:43 +00:00
Howard Hinnant 3778f27b23 Michael van der Westhuizen: Improve support for testing on Linux. Fixes http://llvm.org/bugs/show_bug.cgi?id=14892.
llvm-svn: 172436
2013-01-14 17:12:54 +00:00
Howard Hinnant f1e633c154 Michael van der Westhuizen: Patches for Linux. Fixes http://llvm.org/bugs/show_bug.cgi?id=14648.
llvm-svn: 172435
2013-01-14 17:07:27 +00:00
Howard Hinnant 8d9aec8802 Fix exception safety bug in vector::push_back
llvm-svn: 172250
2013-01-11 20:36:59 +00:00
Marshall Clow 4476100a2f Made test output iterators have value_type of 'void'; matches ones in library
llvm-svn: 171980
2013-01-09 17:20:02 +00:00
Marshall Clow 322270842c Move common header files into a 'support' directory; make 'testit' include -I to that directory; rename 'iterators.h' to 'iterator_test.h'; remove hard-coded paths to include files from more than 350 source files
llvm-svn: 171594
2013-01-05 03:21:01 +00:00
Howard Hinnant 114676622f atomic_bool was missing (just a typedef to atomic<bool>).
llvm-svn: 171498
2013-01-04 18:58:50 +00:00
Marshall Clow f8c2b82337 ...and then there was one. Only one copy of 'iterators.h' in the test tree for libc++
llvm-svn: 171479
2013-01-04 18:24:04 +00:00
Marshall Clow f941359201 Removed another copy of 'iterators.h' files in libcxx/test
llvm-svn: 171456
2013-01-03 03:57:56 +00:00
Marshall Clow cf1589f749 Removed several more different 'iterators.h' files in libcxx/test
llvm-svn: 171452
2013-01-03 02:29:29 +00:00
Marshall Clow 9b726d242f Removed 7 (of 8) different 'iterators.h' files in test/localization
llvm-svn: 171443
2013-01-03 01:45:09 +00:00
Howard Hinnant 5b5e5336a4 Updating CREDITS.TXT
llvm-svn: 171347
2013-01-01 16:09:11 +00:00
NAKAMURA Takumi 43632a26a5 Update the copyright coredits -- Happy new year 2013!
llvm-svn: 171342
2013-01-01 10:00:19 +00:00
Howard Hinnant 861f006d3f Klaas de Vries: Fix bug in libc++'s std::string::find_first_not_of.
llvm-svn: 171321
2012-12-31 20:09:48 +00:00
Michael J. Spencer bb8cfd0fec [CMake] Fix c++ abi library configuration on Linux.
You can now configure from the command line using:
-DLIBCXX_CXX_ABI=libsupc++
-DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="path;path

Also documents how to build on Linux.

llvm-svn: 171316
2012-12-31 19:34:21 +00:00
Chandler Carruth e70a813b59 Don't mark variadic functions as always inline -- they cannot in fact be
inlined.

Patch by Saleem Abdulrasool, reviewed by Michael Spencer and Richard Smith.

llvm-svn: 171276
2012-12-31 06:09:54 +00:00
Chandler Carruth 3036ab26e3 Add a simple .arcconfig to make using the 'arc' commandline tool and the
phabricator code review site easier with libc++.

llvm-svn: 171275
2012-12-31 05:59:45 +00:00
Howard Hinnant a96d74585f Remove test for eof from istreambuf_iterator constructors. It is no longer necessary and potentially violates the constructor's noexcept spec.
llvm-svn: 171232
2012-12-29 17:45:42 +00:00
Howard Hinnant bd037ab4ba Saleem Abdulrasool: GCC complains about the template functions as potentially not being able to be
inlined.  These do not need to be always-inlined for ABI stability because they are not exported beyond this source due to the unnamed namespace.
Also simplified use of the Wmissing-field-initializers pragma as was done for clang.

llvm-svn: 171202
2012-12-28 18:15:01 +00:00
Howard Hinnant 0933f5d358 Saleem Abdulrasool: Add entry to CREDITS.TXT.
llvm-svn: 171174
2012-12-27 23:26:52 +00:00
Howard Hinnant 6b0101acae Saleem Abdulrasool: cleanup a few more compile warnings emitted by GCC.
llvm-svn: 171173
2012-12-27 23:24:31 +00:00
Howard Hinnant 80a11413bb Saleem Abdulrasool: avoid hardcoding buffer lengths.
llvm-svn: 171169
2012-12-27 21:17:53 +00:00
Howard Hinnant 43d978e5c4 Saleem Abdulrasool: Silence warning and reduce unnecessary code in hash.cpp.
llvm-svn: 171167
2012-12-27 18:59:05 +00:00
Howard Hinnant 267e3e1eb8 Saleem Abdulrasool: This just rounds up a few compile warnings emitted by GCC (4.7.2).
llvm-svn: 171165
2012-12-27 18:46:00 +00:00
Chad Rosier 7f902715e8 Remove redundant inits. Patch by Eitan Adler.
llvm-svn: 170967
2012-12-22 00:12:05 +00:00
Howard Hinnant d15de653f0 Test case for http://llvm.org/bugs/show_bug.cgi?id=14670.
llvm-svn: 170706
2012-12-20 16:50:07 +00:00
Howard Hinnant 3b42bdd58a Hyeon-Bin Jeong: readsome() need to reset gcount to zero. This fixes http://llvm.org/bugs/show_bug.cgi?id=14670.
llvm-svn: 170703
2012-12-20 15:40:28 +00:00
Richard Smith e3fbbccc0f Implement std::is_base_of for the case where we don't have a compiler
intrinsic. This relies upon the fact that overload resolution does not check
access and ambiguity for a derived-to-base conversion. This passes all
is_base_of tests in the test suite.

llvm-svn: 170662
2012-12-20 04:20:28 +00:00
Marshall Clow 36a60721ce Added static_assert to std::get<N>(std::array) calls to catch "out of bounds" calls
llvm-svn: 170435
2012-12-18 16:46:30 +00:00
Howard Hinnant 3cea78ee68 Updated CREDITS.TXT
llvm-svn: 170062
2012-12-13 00:51:59 +00:00
Howard Hinnant 16694b5df5 Zhang Xiongpang: Add definitions for const data members. Fixes http://llvm.org/bugs/show_bug.cgi?id=14585.
llvm-svn: 170026
2012-12-12 21:14:28 +00:00
Howard Hinnant 9f4328b173 Modify testit to use the local headers and lib. Thanks go to Jeffrey Yasskin.
llvm-svn: 169686
2012-12-09 00:12:14 +00:00
Michael J. Spencer 299fc29a59 [CMake] Add support for selecting which c++ abi library to use.
llvm-svn: 169036
2012-11-30 21:02:29 +00:00
Richard Smith e1f363c724 Remove 'noreturn' attribute from friend declaration. This attribute will be
inherited from the previous out-of-class declaration, and attributes on friend
function declarations are ill-formed in C++11.

llvm-svn: 168853
2012-11-29 04:30:50 +00:00
Daniel Dunbar 7c4b853e74 tests/lit: Change test default parameters to assume local build.
- Also, support overriding them with lit parameters.

llvm-svn: 168749
2012-11-27 23:56:28 +00:00
Howard Hinnant 6852b55314 Fix type-o.
llvm-svn: 168715
2012-11-27 18:52:32 +00:00
Howard Hinnant 43a1f7b045 Remove by-chapter breakdown of what is implemented. The chart is now obsolete.
llvm-svn: 168713
2012-11-27 18:35:09 +00:00
Howard Hinnant f8b24cf5f7 Dimitry Andric: When using libc++ headers on FreeBSD, in combination with -std=c++98,
-ansi or -std=c++03, the long long type is not supported.  So in this
case, several functions and types, like lldiv_t, strtoll(), are not
declared.

llvm-svn: 168610
2012-11-26 21:18:17 +00:00
Howard Hinnant dfdf5085df istreambuf_iterator increment should call sbumpc instead of snextc. Patch
by Kimball Thurston.  This fixes http://llvm.org/bugs/show_bug.cgi?id=14358.

llvm-svn: 168209
2012-11-16 22:17:23 +00:00
Howard Hinnant b5c63a2e07 Restrict optimized __pad_and_output implementation detail to desired releases.
llvm-svn: 167980
2012-11-14 21:17:15 +00:00
Marshall Clow 497d9d2671 Change C++0x references to C++11, Fixes bug #12745
llvm-svn: 167930
2012-11-14 16:31:15 +00:00
Howard Hinnant 119703f984 Dimitry Andric: Silence some miscellaneous warnings.
llvm-svn: 167493
2012-11-06 21:55:44 +00:00
Howard Hinnant 3e2740a36c Dimitry Andric: Silence some warnings in <locale>.
llvm-svn: 167492
2012-11-06 21:48:33 +00:00
Howard Hinnant a01739a03a Enable the tuple interface of pair in C++03 mode.
llvm-svn: 167491
2012-11-06 21:42:45 +00:00
Howard Hinnant 1c8358c13c Update instructions for building and using libc++ on Mac OS
llvm-svn: 167490
2012-11-06 21:31:37 +00:00
Howard Hinnant cd47cbc7a4 Provide a way to disable use of extern templates in libc++. This is intended for the clients of libc++, not the libc++ build. The dylib should always contain the extern templates. To disable the client needs to put -D'_LIBCPP_EXTERN_TEMPLATE(...)=' on the command line.
llvm-svn: 167486
2012-11-06 21:08:48 +00:00
Howard Hinnant 66e7ed959f peek should set eofbit if sgetc() returns eof.
llvm-svn: 167238
2012-11-01 17:32:07 +00:00
Howard Hinnant b304811686 Richard Smith: This fixes a problem in std::is_constructible for incomplete types, and those types with a user-defined operator,().
llvm-svn: 167233
2012-11-01 16:32:14 +00:00
Howard Hinnant 54d333a601 Rename uses of _ and __ because these are getting stepped on by macros from other system code.
llvm-svn: 167038
2012-10-30 19:06:59 +00:00
Argyrios Kyrtzidis 523623c239 Add an entry in CREDITS.TXT
llvm-svn: 165949
2012-10-15 17:34:53 +00:00
Howard Hinnant 6758190507 Use traits_type::to_int_type in basic_streambuf<_CharT, _Traits>::xsputn when calling overflow to correctly handle negative signed character types. This fixes http://llvm.org/bugs/show_bug.cgi?id=14074.
llvm-svn: 165884
2012-10-13 19:31:51 +00:00
Howard Hinnant 7ba8160360 Dimitry Andric: FreeBSD only: Add the C11 aligned_alloc to <cstdlib> and adjust the inclusion of quick_exit.
llvm-svn: 165882
2012-10-13 18:03:53 +00:00
Argyrios Kyrtzidis 88db3171dd Don't neglect to "return *this".
llvm-svn: 165860
2012-10-13 02:03:45 +00:00
Howard Hinnant f543a75be1 Holger Arnold: Correct the use and testing of __GNUC__ and __GNUC_MINOR__ in <__config>.
llvm-svn: 165151
2012-10-03 20:48:05 +00:00
Howard Hinnant 6e551ae1a3 Make vector::iterator and string::iterator more resilient against overly generic relational operators.
llvm-svn: 165033
2012-10-02 19:45:42 +00:00
Howard Hinnant 59fb5c6559 Due to a mistake on my own part, I need to burn some version numbers. This does not impact any of the implementation of libc++, and does not impact the ABI in any way.
llvm-svn: 164832
2012-09-28 17:42:25 +00:00
Howard Hinnant 324c084654 Bump _LIBCPP_VERSION to 1002
llvm-svn: 164700
2012-09-26 15:38:09 +00:00
Howard Hinnant 8e747d3671 Apply the emulated nullptr_t with constexpr. This is an unusual configuration that would take advantage of this. But it has popped up in the wild and does no harm to support it.
llvm-svn: 164575
2012-09-24 23:36:40 +00:00
Marshall Clow b07ddfcac7 Updating email address
llvm-svn: 164489
2012-09-24 14:27:10 +00:00
Bob Wilson feeec326fe Fix installheaders target to do what it did prior to r161760. rdar://12348765
llvm-svn: 164413
2012-09-21 20:49:54 +00:00
Howard Hinnant c43826f003 Add overflow check to tanh(complex) and reduce to finite answer. Fixes http://llvm.org/bugs/show_bug.cgi?id=13874
llvm-svn: 164266
2012-09-19 23:51:47 +00:00
Howard Hinnant 92b5940fbb Overloaded __pad_and_output on ostreambuf_iterator and in this overload call sputn instead of dereferencing the iterator which calls sputc. This is intended to be purely a performance optimization, especially for clients who may have overloaded the virtual function xsputn.
llvm-svn: 164241
2012-09-19 19:14:15 +00:00
Howard Hinnant a0bc10dca6 Align <atomic> with clang r163964 which disallows const _Atomic types.
llvm-svn: 164004
2012-09-16 20:33:09 +00:00
Howard Hinnant 948b8cb51b Update CREDITS.TXT
llvm-svn: 163949
2012-09-14 23:28:54 +00:00
Howard Hinnant aeb85680fb Dimitry Andric: many visibility fixes. Howard: Much appreciated. Can you send me a patch to CREDITS.TXT?
llvm-svn: 163862
2012-09-14 00:39:16 +00:00
Howard Hinnant ab303f7e47 Dimitry Andric: FreeBSD porting tweaks for PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER
llvm-svn: 163626
2012-09-11 16:10:20 +00:00
Howard Hinnant 49713b442c Some minor mingw64 porting tweaks from Glen.
llvm-svn: 163120
2012-09-03 18:13:11 +00:00
Howard Hinnant aad745a024 Change sleep_for, sleep_until, and the condition_variable timed wait
functions to protect against duration and time_point overflow.  Since
we're about to wait anyway, we can afford to spend a few more cycles on
this checking.  I purposefully did not treat the timed try_locks with
overflow checking.  This fixes
http://llvm.org/bugs/show_bug.cgi?id=13721 .  I'm unsure if the standard
needs clarification in this area, or if this is simply QOI.  The
<chrono> facilities were never intended to overflow check, but just to
not overflow if durations stayed within +/- 292 years.

llvm-svn: 162925
2012-08-30 19:14:33 +00:00
Howard Hinnant 3320c058bf Hyeon-bin Jeong: libc++ fails to create any classes inherit from basic_ios if they
provided char type other than char or wchar_t. It throw exception during
construction, so there is no chance to imbue own ctype.

This fixes http://llvm.org/bugs/show_bug.cgi?id=13698

llvm-svn: 162648
2012-08-26 18:05:35 +00:00
Howard Hinnant 2e8e1d42be Update CREDITS.TXT
llvm-svn: 162647
2012-08-26 17:46:29 +00:00
Howard Hinnant e890ab2377 Michel Morin: My previous fix for C++03 was incomplete.
It does not consider user-defined conversions that convert an rvalue
into an lvalue and works incorrectly for types with such a conversion
operator.
For example, 

    struct foo
    {
        operator int&();
    };

 returns false_type. 
Attached a patch that fixes this problem. 
http://llvm.org/bugs/show_bug.cgi?id=13601

llvm-svn: 162644
2012-08-25 15:06:50 +00:00
Howard Hinnant 7b838f53a6 Wrap throw in _LIBCPP_NO_EXCEPTIONS in debug.cpp. Calls abort if can't throw an exception. Fixes http://llvm.org/bugs/show_bug.cgi?id=13082.
llvm-svn: 162613
2012-08-24 22:15:12 +00:00
Howard Hinnant dbbdd0c1f0 Have basic_istream seekg, putback and unget first clear eofbit. Fixes http://llvm.org/bugs/show_bug.cgi?id=13089.
llvm-svn: 162608
2012-08-24 22:03:03 +00:00
Howard Hinnant bad901b362 Add Hyeon-bin Jeong to CREDITS.TXT
llvm-svn: 162604
2012-08-24 21:45:19 +00:00
Howard Hinnant bfd96e11ed Hyeon-Bin Jeong: 1. sync() should reset it’s external buffer pointers.
Remaining characters should be discarded once sync() called. If don’t, garbage
characters can be inserted to the front of external buffer in underflow().
Because underflow() copies remaining characters in external buffer to it’s
front. This results wrong characters insertion when seekpos() or seekoff() is
called.

this line should be inserted in sync() just before return:
__extbufnext_ = __extbufend_ = __extbuf_;

2. sync() should use length() rather than out() to calculate offset.
Reversing iterators and calling out() to calculate offset from behind is
working fine in stateless character encoding. However, in stateful encoding,
escape sequences could differ in length. As a result, out() could return wrong
length. 

For example, if we have internal buffer converted from this external sequence:
(capital letters mean escape sequence)
… a a a a B b b b b

out() produces this sequence. 
b b b b A a a a a

Because out() inserts escape sequence A rather than B, result sequence doesn't
match to external sequence. A and B could have different lengths, result offset
could be wrong value too.

length() method in codecvt is right for calculating offset, but it counts
offset from the beginning of buffer. So it requires another state member
variable to hold state before conversion.
Fixes http://llvm.org/bugs/show_bug.cgi?id=13667

llvm-svn: 162601
2012-08-24 21:20:56 +00:00
Howard Hinnant 49a37bbb9f Fix basic_filebuf's internal buffer is shrinking when using with some codecvt. http://llvm.org/bugs/show_bug.cgi?id=13602
llvm-svn: 162585
2012-08-24 20:37:00 +00:00
Howard Hinnant 45c03a8f8d Fixed order of calling use_facet vs setbuf in basic_filebuf default constructor.
llvm-svn: 162571
2012-08-24 18:06:47 +00:00
Howard Hinnant cc27317a62 basic_filebuf needs to delay obtaining a codecvt facet from the global locale to give the client a chance to imbue the proper locale. Fixes http://llvm.org/bugs/show_bug.cgi?id=13663.
llvm-svn: 162567
2012-08-24 16:52:47 +00:00
Marshall Clow c740e05316 Fix a typo in the docs
llvm-svn: 162335
2012-08-22 00:57:11 +00:00
Howard Hinnant a3b7a802cc In C++03 mode add an explicit conversion from int to the emulated class enum. Fixes a problem reported by C. Bergström.
llvm-svn: 162189
2012-08-19 17:14:47 +00:00
Howard Hinnant e4b2a743b8 Patch contributed by Dev Dude for mingw64 port.
llvm-svn: 162188
2012-08-19 15:13:16 +00:00
Howard Hinnant a0b42cacbf Apply patches supplied by Michel Morin in http://llvm.org/bugs/show_bug.cgi?id=13601 to correct bugs in is_convertible for the case that the intrinsic __is_convertible_to is not available.
llvm-svn: 162111
2012-08-17 17:54:11 +00:00
Howard Hinnant 7ee271360d Consistently label __bit_array as a struct, not a class.
llvm-svn: 162108
2012-08-17 17:10:18 +00:00
Howard Hinnant 700de17aea Remove obsolete do-installhdrs target (again).
llvm-svn: 161761
2012-08-13 16:32:15 +00:00
Howard Hinnant 76bd025868 Remove obsolete do-installhdrs target.
llvm-svn: 161760
2012-08-13 16:17:12 +00:00
Howard Hinnant 4179da6a6a Patch constributed by Michel Moren in http://llvm.org/bugs/show_bug.cgi?id=13592 . Fixes is_convertible<From, To> when To is an abstract type.
llvm-svn: 161755
2012-08-13 12:29:17 +00:00
Howard Hinnant d79842c2bf Change size of reference count field in __libcpp_nmstr from 32 bits to 64 bits for 64 bit targets. This is controls the data layout of all exceptions defined in <stdexcept>. This aligns the ABI with that of gcc-4.2.
llvm-svn: 161497
2012-08-08 16:17:31 +00:00
Howard Hinnant 1237dccaea std::equal operating on non-const __bit_iterators was not working. This fixes it.
llvm-svn: 161309
2012-08-05 21:43:11 +00:00
Howard Hinnant 73984be057 Andrew Morrow: The current CMake setup for libc++ incorrectly uses the variable
LLVM_ENABLE_ASSERTIONS instead of LIBCXX_ENABLE_ASSERTIONS when
figuring out what _DEBUG/NDEBUG defines to set. It also tries to test
the non-existent variable 'uppercase_CMAKE_BUILD_TYPE', which the top
level LLVM CMakeLists.txt sets up, but which the top level libc++
CMakeLists.txt currently does not. Changing the variable name tested
and creating the uppercase release name variable allows libc++ to
honor the LIBCXX_ENABLE_ASSERTIONS option correctly.

llvm-svn: 161308
2012-08-05 17:37:39 +00:00
Howard Hinnant c51171e0e9 Loosen up the timing requirements on 4 more tests.
llvm-svn: 161289
2012-08-04 00:47:42 +00:00
Howard Hinnant aca09de378 Performance tweaking rotate.
rotate is a critical algorithm because it is often used by other algorithms,
both std and non-std.  The main thrust of this optimization is a specialized
algorithm when the 'distance' to be shifted is 1 (either left or right).  To my
surprise, this 'optimization' was not effective for types like std::string.
std::string favors rotate algorithms which only use swap.  But for types like
scalars, and especially when the sequence is random access, these new
specializations are a big win.  If it is a vector<size_t> for example, the
rotate is done via a memmove and can be several times faster than the gcd
algorithm.

I'm using is_trivially_move_assignable to distinguish between types like int and
types like string.  This is obviously an ad-hoc approximation, but I haven't
found a case where it doesn't give good results.

I've used a 'static if' (with is_trivially_move_assignable) in three places. 
Testing with both -Os and -O3 showed that clang eliminated all code not be
executed by the 'static if' (including the 'static if' itself).

llvm-svn: 161247
2012-08-03 18:01:20 +00:00
Howard Hinnant 0cbea7fa90 Andrew Morrow: The attached patch updates the initialization of the 'struct tm' in
__time_get_storage<char> to match the initialization behavior in
__time_get_storage<wchar>. Without the initialization, valgrind
reports errors in the subsequent calls to strftime_l.

llvm-svn: 161196
2012-08-02 18:44:17 +00:00
Howard Hinnant fb2f0a5e01 Andrew Morrow: There are two tests under test/utilities/memory that heap allocate two
integers which remain unused and are subsequently leaked, so the test
fail when run under valgrind. Unless I'm overlooking a subtle reason
why they are needed I think they can be removed, allowing these tests
to pass under valgrind. The attached patch removes the variables. If
there is a reason for them to exist, I can change this to just delete
them at the end of the test.

llvm-svn: 161195
2012-08-02 18:39:48 +00:00
Howard Hinnant c1a45fb70f Andrew Morrow: The attached patch updates the lit.config for libc++ unit tests so
that the valgrind configuration passed to lit.py is used to run .pass
tests.

llvm-svn: 161193
2012-08-02 18:36:47 +00:00
Howard Hinnant 4df0a6adf6 Andrew Morrow: Among the various libc++ tests that currently don't pass on Linux are
localization/locale.categories/category.collate/category.ctype/locale.ctype.byname/is_1.pass.cpp
and scan_is.pass.cpp. The tests fail when the character class being
tested is compound, like ctype_base::alnum or ctype_base::graph,
because the existing series of conditionals in do_is an do_scan_is
will abort too early. For instance, if the character class being
tested is alnum, and the character is numeric, do_is will return false
because iswalpha_l will return false, 'result' becomes false, and the
'true' result from the later call to iswdigit_l ends up being ignored
. A similar problem exists in do_scan_is.

llvm-svn: 161192
2012-08-02 18:35:07 +00:00
Howard Hinnant d3673eb4e1 Andrew Morrow: The attached patch is an attempt to implement
std:🧵:hardware_concurrency for platforms that don't offer
sysctl, but do provide a POSIX sysconf and _SC_NPROCESSORS_ONLN.

llvm-svn: 161190
2012-08-02 18:17:49 +00:00
Howard Hinnant a30af5f7cd Andrew Morrow: This patch fixes
test/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
to accept '(nil)' as a valid representation for NULL so that the test
passes on Linux. The same thing is already done in some other tests,
like in /test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp.

llvm-svn: 161188
2012-08-02 18:12:06 +00:00
Howard Hinnant 8eb04fe53c Andrew Morrow: Attached is a writeup of the current state of the libc++ test suite on Linux.
There are a few tests that are listed as failing here for which I have
a patch in the works. I'll be sending those along soon. There are
others where I know what is going on but don't yet have a solution,
and I've included some notes for those. Several still need to be
investigated, mostly in localization and the regex test suite. I think
that many of these failures are due to locale implementation
variations that make the expected test results not match the actual
results. I'm not sure what the best way to make the tests accomodate
this sort of variation might be.

The failures in the unique_ptr test suite are very new and are caused
by a clang crash which I've not yet looked into.

llvm-svn: 161079
2012-07-31 21:30:28 +00:00
Howard Hinnant 088e37c77a Despite my pathological distrust of spin locks, the number just don't lie. I've put a small spin in __sp_mut::lock() on std::mutex::try_lock(), which is testing quite well. In my experience, putting in a yield for every failed iteration is also a major performance booster. This change makes one of the performance tests I was using (a highly contended one) run about 20 times faster.
llvm-svn: 160967
2012-07-30 17:13:21 +00:00
Howard Hinnant 355b660a4b Updated status
llvm-svn: 160959
2012-07-30 13:59:36 +00:00
Howard Hinnant fe9fe2dedc Updated the complete by-chapter graph
llvm-svn: 160943
2012-07-30 02:29:34 +00:00
Howard Hinnant d77851e837 Implement [util.smartptr.shared.atomic]. This is the last unimplemented
section in libc++.  This requires a recompiled dylib.  Failure to rebuild
the dylib will result in a link-time error if and only if the functions from
[util.smartptr.shared.atomic] are used.

The implementation is not lock free.  After considerable thought, I know of no
way to make the implementation lock free.  Ideas welcome along that front.  But
changing the ABI of shared_ptr is not on the table at this point.

The mutex used to lock these function is encapsulated by std::__sp_mut.  The
only thing the client knows about std::__sp_mut is that it has a void* data
member, can't be constructed, and has lock and unlock members.  Within the
binary __sp_mut is currently implemented as a pointer to a std::mutex.  That can
change in the future without disturbing the ABI (as long as sizeof(__sp_mut)
remains constant.

I specifically did not make __sp_mut a spin lock as I have a pathological
distrust of spin locks.  Testing on OS X reveals that the use of std::mutex in
this role is not a large performance penalty as long as the contention for the
mutex is low (more likely to get the lock than to have to wait).  In the future
we can still make __sp_mut a spin lock if that is what is desired (without ABI
damage).

The dylib contains 16 __sp_mut's to be chosen based on the hash of the address
of the shared_ptr.  The constant 16 is a ball-park reasonable space/time
tradeoff.

std::hash<T*> was changed to call __murmur2_or_cityhash, instead of the identity
function.  I had thought we had already done this, but I was mistaken.

All of this is under #if __has_feature(cxx_atomic) even though the
implementation is not lock free, because the signatures require access to
std::memory_order, which is currently available only under
__has_feature(cxx_atomic).

llvm-svn: 160940
2012-07-30 01:40:57 +00:00
Howard Hinnant c2e9354004 Update CREDITS.TXT
llvm-svn: 160812
2012-07-26 20:22:37 +00:00
Howard Hinnant c904ad4518 Patch by Andrew C. Morrow: shims to work around macroized getc and putc on linux. On my eglibc 2.13 based Debian system 'getc' is a macro defined in
/usr/include/stdio.h. This decision to make it a macro doesn't seem to
be guarded by any feature test macro as far as I can see.

llvm-svn: 160799
2012-07-26 20:01:13 +00:00
Howard Hinnant dce0696a36 Patch by Andrew C. Morrow: Conditionally include cxxabi.h in new.cpp and typeinfo.cpp. Both new.cpp and typeinfo.cpp have code that is conditionally compiled
based on the LIBCXXRT and _LIBCPPABI_VERSION defines, but those files
do not currently include <cxxabi.h> in the non __APPLE__ case. The
attached patch updates those files so that for non __APPLE__ builds
<cxxabi.h> is included if available or if LIBCXXRT is set. I'm
modeling this on the recent updates to exception.cpp.

llvm-svn: 160790
2012-07-26 17:42:39 +00:00
Howard Hinnant a1d07d57a7 <algorithm> no longer needs to include <cstdlib>, but can get away with just <cstddef>. This was brought to my attention by Salvatore Benedetto in his port to a bare-metal coretex-m3. This exposed two test bugs where an explicit #include <cstdlib> was needed.
llvm-svn: 160786
2012-07-26 17:09:09 +00:00
Howard Hinnant 6a03f169db locale::id really needs to be constructed at compile time.
llvm-svn: 160785
2012-07-26 16:14:37 +00:00
Richard Smith 535a86c3f8 libc++: switch from using _ATTRIBUTE(noreturn) (which conflicts with a
platform-provided macro on some systems) to _LIBCPP_NORETURN.

llvm-svn: 160773
2012-07-26 02:04:22 +00:00
Howard Hinnant 9d772d17b3 Apple LWG 2067: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3318.html#2067 . This is the only actionable change that has been made to the C++ draft since C++11. In general it has not been decided exactly how libc++ will track changes made to C++11. New features and design changes will probably be #ifdef'd, especially if they are not backwards compatible. Defects and 'dumb mistakes' are more likely to just be put in. Decisions on telling one from the other will be made on a case by case basis.
llvm-svn: 160608
2012-07-21 19:34:12 +00:00
Howard Hinnant a4820bc4d5 noexcept applied to <future>.
llvm-svn: 160607
2012-07-21 17:46:55 +00:00
Howard Hinnant 36101a5b0a noexcept applied to <thread>.
llvm-svn: 160606
2012-07-21 16:50:47 +00:00
Howard Hinnant 45c663db4e noexcept applied to <condition_variable>.
llvm-svn: 160605
2012-07-21 16:32:53 +00:00
Howard Hinnant 02e610ef34 noexcept and constexpr applied to <mutex>.
llvm-svn: 160604
2012-07-21 16:13:09 +00:00
Howard Hinnant 42be98ab54 noexcept and constexpr applied to <regex>.
llvm-svn: 160594
2012-07-21 01:31:58 +00:00
Howard Hinnant 5d926bf1b8 noexcept and constexpr applied to <ios>.
llvm-svn: 160593
2012-07-21 01:03:40 +00:00
Howard Hinnant bf882037be noexcept applied to <valarray>.
llvm-svn: 160592
2012-07-21 00:51:28 +00:00
Howard Hinnant f4e11de8e8 constexpr applied to <complex>.
llvm-svn: 160585
2012-07-20 22:18:27 +00:00
Howard Hinnant 00586de436 noexcept applied to <random>.
llvm-svn: 160579
2012-07-20 21:44:27 +00:00
Howard Hinnant 11ac39722c Relax the tolerances on some timing tests.
llvm-svn: 160566
2012-07-20 19:48:05 +00:00
Howard Hinnant 8e882dcb2e noexcept applied to <iterator>.
llvm-svn: 160565
2012-07-20 19:36:34 +00:00
Howard Hinnant 397717b7c8 constexpr applied to <array>.
llvm-svn: 160564
2012-07-20 19:20:49 +00:00
Howard Hinnant 931644bfec constexpr applied to <string>.
llvm-svn: 160563
2012-07-20 19:09:12 +00:00
Howard Hinnant 14c56f6c4a Further tweaks on relaxing complete type checking for function.
llvm-svn: 160562
2012-07-20 18:56:07 +00:00
Howard Hinnant 07ce90bb9d Jean-Daniel : clang now supports all required type_traits.
llvm-svn: 160510
2012-07-19 15:59:52 +00:00
Howard Hinnant 51eb2adb2d Jean-Daniel updates the libc++ index page to reflect not so recent changes in C++ standard status.
llvm-svn: 160509
2012-07-19 15:57:51 +00:00
Howard Hinnant 403845ba75 Relax the complete-type checks that are happening under __invokable<Fp, Args...> to only check Fp, and not Args... . This should be sufficient to give the desired high quality diagnostics under both bind and function. And this allows a test reported by Rich E on cfe-dev to pass. Tracked by <rdar://problem/11880602>.
llvm-svn: 160285
2012-07-16 16:17:34 +00:00
Howard Hinnant c033115394 Applied constexpr to <chrono>.
llvm-svn: 160184
2012-07-13 19:17:27 +00:00
Howard Hinnant 9146984e73 Fixed a bug in wstring_convert concerning zero-length inputs. Thanks to Jonathan Coxhead for reporting this bug.
llvm-svn: 160136
2012-07-12 18:07:41 +00:00
Richard Smith ceefe51364 Teach libc++ to check for libc++abi and use its features if they're available.
llvm-svn: 160038
2012-07-11 09:35:47 +00:00
Howard Hinnant 38b99b025c Add test for self-referencing emplace test.
llvm-svn: 159921
2012-07-09 02:47:43 +00:00
Howard Hinnant 598f702b04 Change emplace for vector and deque to create the temporary (when necessary) before any changes to the container are made. Nikolay Ivchenkov deserves the credit for pushing this problem and the solution for it.
llvm-svn: 159918
2012-07-08 23:23:04 +00:00
Howard Hinnant c0937e8add Appy constexpr to <memory>. Picked up a few missing noexcepts as well.
llvm-svn: 159902
2012-07-07 20:56:04 +00:00
Howard Hinnant bfa7990b5a Apply constexpr to the mutex constructor. As a conforming extension, apply constexpr to the condition_variable constructor. These are important because it enables the compiler to construct these types at compile time, even though the object will be non-const. Since they are constructed at compile time, there is no chance of a data race before they are constructed.
llvm-svn: 159901
2012-07-07 20:01:52 +00:00
Howard Hinnant eeac9fcfb7 Apply constexpr to <bitset>.
llvm-svn: 159899
2012-07-07 17:04:52 +00:00
Howard Hinnant 8a9ee14803 Apply noexcept to tuple.
llvm-svn: 159865
2012-07-06 21:53:48 +00:00
Howard Hinnant a0f4c45c38 As a conforming extension give tuple a noexcept default constructor conditionalized on its held types.
llvm-svn: 159858
2012-07-06 20:50:27 +00:00
Howard Hinnant a62ebe043e Give tuple a constexpr default constructor.
llvm-svn: 159857
2012-07-06 20:39:45 +00:00
Howard Hinnant 9f06558f86 New Windows libc++ test results provided by Ruben Van Boxem.
llvm-svn: 159852
2012-07-06 19:35:31 +00:00
Howard Hinnant 9d6d1c6860 Apply noexcept to those functions implemented in <cstdlib> as a conforming extension.
llvm-svn: 159850
2012-07-06 19:16:56 +00:00
Howard Hinnant 9c14b75a37 Apply noexcept to those functions implemented in <cmath> as a conforming extension.
llvm-svn: 159849
2012-07-06 19:13:50 +00:00
Howard Hinnant 227001d12e Add noexcept test for offsetof macro per [support.types]/p4.
llvm-svn: 159846
2012-07-06 18:39:01 +00:00
Howard Hinnant 4cb38a82a2 This commit establishes a new bucket_count policy in the unordered containers: The policy now allows a power-of-2 number of buckets to be requested (and that request honored) by the client. And if the number of buckets is set to a power of 2, then the constraint of the hash to the number of buckets uses & instead of %. If the client does not specify a number of buckets, then the policy remains unchanged: a prime number of buckets is selected. The growth policy is that the number of buckets is roughly doubled when needed. While growing, either the prime, or the power-of-2 strategy will be preserved. There is a small run time cost for putting in this switch. For very cheap hash functions, e.g. identity for int, the cost can be as high as 18%. However with more typical use cases, e.g. strings, the cost is in the noise level. I've measured cases with very cheap hash functions (int) that using a power-of-2 number of buckets can make look up about twice as fast. However I've also noted that a power-of-2 number of buckets is more susceptible to accidental catastrophic collisions. Though I've also noted that accidental catastrophic collisions are also possible when using a prime number of buckets (but seems far less likely). In short, this patch adds an extra tuning knob for those clients trying to get the last bit of performance squeezed out of their hash containers. Casual users of the hash containers will not notice the introduction of this tuning knob. Those clients who swear by power-of-2 hash containers can now opt-in to that strategy. Clients who prefer a prime number of buckets can continue as they have.
llvm-svn: 159836
2012-07-06 17:31:14 +00:00
Howard Hinnant 6b45660f14 link to Marshall's notes.
llvm-svn: 159791
2012-07-06 00:39:38 +00:00
Nuno Lopes 6317bfb26a mark operator new(std::nothrow) as noalias (aka __attribute__((malloc))
llvm-svn: 159359
2012-06-28 16:47:34 +00:00
Howard Hinnant f08ebab2ea Fixed a bug regarding result_of reported by Sven Behne. The fix is C++11 only mainly because result_of is a variadic beast and working with variadics is just such a problem in C++03 mode. This should bring result_of up to full conformance with the C++11 spec.
llvm-svn: 159211
2012-06-26 17:37:15 +00:00
Nuno Lopes d8ed7e5b03 fix help with bash
llvm-svn: 159177
2012-06-25 23:51:05 +00:00
Howard Hinnant c418654096 Revert pair constructors back to using is_convertible instead of is_constructible. This should pull things into alignment with the final draft. Fixes http://llvm.org/bugs/show_bug.cgi?id=13063#add_comment.
llvm-svn: 158280
2012-06-09 20:01:23 +00:00
Douglas Gregor 07db340438 Fix warning flags for CMake builds, from Andrew C. Morrow!
llvm-svn: 158172
2012-06-07 22:26:00 +00:00
Howard Hinnant 0bc272cf9a Fix a few testsuite bugs involving trailing null (or lack thereof) in strstream.
llvm-svn: 157832
2012-06-01 20:02:59 +00:00
Howard Hinnant 4c0de496a0 Fix dangling else clause. Bug found and fixed by Dimitry Andric.
llvm-svn: 157779
2012-05-31 23:12:03 +00:00
Howard Hinnant 78b4015c1c Fix the new _ALIGNAS_TYPE per instructions supplied by Eli Friedman.
llvm-svn: 157765
2012-05-31 20:14:00 +00:00
Howard Hinnant bf33f5b292 Protect use of alignas against older versions of clang
llvm-svn: 157764
2012-05-31 19:31:14 +00:00
Howard Hinnant 8b805c915a The rules for emplace in map, multimap, unordered_map and unordered_multimap changed a while back and I'm just now updating to these new rules. In a nutshell, you've got to know you're emplacing to a pair and use one of pair's constructors. I made one extension: If you want to emplace the key and default construct the mapped_type, you can just emplace(key), as opposed to emplace(piecewise_construct, forward_as_tuple(key), forward_as_tuple()).
llvm-svn: 157503
2012-05-25 22:04:21 +00:00
Howard Hinnant a960edd203 Fix memory corruption bug found and fixed by Andrew C. Morrow.
llvm-svn: 157476
2012-05-25 15:55:46 +00:00
Howard Hinnant 49c3b20737 Add documentation regarding -fno-rtti.
llvm-svn: 157157
2012-05-20 13:03:53 +00:00
Howard Hinnant ed81e910bd Revert fix to http://llvm.org/bugs/show_bug.cgi?id=12867 for the reason now included in the code comment.
llvm-svn: 157128
2012-05-19 20:20:49 +00:00
Douglas Gregor a336f5e645 Revert my _LIBCPP_INLINE_VISIBILITY changes, r157097 and r157107
llvm-svn: 157108
2012-05-19 07:14:17 +00:00
Douglas Gregor a1b6937dba valarray resize should not be _LIBCPP_INLINE_VISIBILITY
llvm-svn: 157107
2012-05-19 07:01:14 +00:00
Douglas Gregor 8f69b1af3d Move _LIBCPP_VISIBLE_INLINE from the out-of-line definitions of member
functions to the original declarations, so that Clang will actually
see them. Part of <rdar://problem/11489333>.

llvm-svn: 157097
2012-05-19 04:41:25 +00:00
Howard Hinnant 9042d623bf Protect __shared_weak_count::__get_deleter declaration with _LIBCPP_NO_RTTI. Fixes http://llvm.org/bugs/show_bug.cgi?id=12867
llvm-svn: 157049
2012-05-18 13:06:21 +00:00
Howard Hinnant 423a8d7733 Fix several bugs in find/count specialized for bits.
llvm-svn: 156546
2012-05-10 14:55:00 +00:00
Howard Hinnant 19d9cbfb39 Add friends __count_bool_true and __count_bool_false to __bit_iterator.
llvm-svn: 156543
2012-05-10 14:01:40 +00:00
Howard Hinnant 0ae9efeb1a SFINAE __bit_iterator such that it will only get instantiated with a container that has the nested type __storage_type. This prevents accidental instantiation such as in http://llvm.org/bugs/show_bug.cgi?id=12755. This fixes http://llvm.org/bugs/show_bug.cgi?id=12755.
llvm-svn: 156308
2012-05-07 16:50:38 +00:00
Howard Hinnant df7aad41fd Constrain __bind functor constructor such that it won't accidentally get used as a copy constructor from a non-const lvalue. Fixes <rdar://problem/11359080>.
llvm-svn: 156182
2012-05-04 17:21:02 +00:00
Howard Hinnant 9acfc3af72 Change std::abs from a template function to three overloads for float, double and long double.
llvm-svn: 156064
2012-05-03 14:58:34 +00:00
Howard Hinnant bff1bfc6be Greatly scale back ambitions of emulating move semantics in C++03 mode. It was causing more problems than it solved. This fixes http://llvm.org/bugs/show_bug.cgi?id=12704.
llvm-svn: 155918
2012-05-01 15:37:54 +00:00
Richard Smith 11ffde3d7e libc++: only #include <cxxabi.h> if it exists. This allows libc++ to build
out of the box on Linux systems. If you're building against libc++abi, you
still need to make sure it can find <cxxabi.h> so it knows not to export
symbols which libc++abi provides.

llvm-svn: 155091
2012-04-19 01:36:12 +00:00
Richard Smith 99f15d6eb7 libc++: Add some missing #includes to atomics tests. libc++ doesn't need these
at the moment, but they allow these tests to be used to test clang against
libstdc++. Add myself to the credits file, as suggested by Howard.

llvm-svn: 155085
2012-04-19 00:50:47 +00:00
Howard Hinnant d01320c200 Apply noexcept and constexpr to <atomic>.
llvm-svn: 154526
2012-04-11 20:14:21 +00:00
Richard Smith 766e8ccbfc Switch libc++ from __atomic_* builtins to __c11_atomic_* builtins.
Per discussion with Howard, we are not interested in maintaining
compatibility with older versions of clang.

All tests pass with ToT clang, except for two which assert due to
a pre-existing, unrelated bug.

llvm-svn: 154521
2012-04-11 18:55:46 +00:00
David Chisnall cd42f9446b Now that clang supports doing the right thing with regard to atomic
initialisation, do the right thing with regard to atomic initialisation.

Note: clang r154507 or later required for <atomic> to work now.
llvm-svn: 154508
2012-04-11 17:26:23 +00:00
David Chisnall 4fa71de024 Fix the remaining atomic tests, all of which were wrong for the case where a
compare-and-exchange failed (it should update the expected value to the current
value, and the tests were checking that it didn't...).

Results of the atomics part of the test suite on FreeBSD with clang trunk and
the atomic.c from compiler-rt (currently kludged into the test, not installed
properly):

****************************************************
Results for /root/libc++/test/atomics:
using clang version 3.1 (trunk 153415)
Target: x86_64-unknown-freebsd10.0
Thread model: posix
with -std=c++0x -stdlib=libc++ -pthread /tmp/atomic.o  
----------------------------------------------------
sections without tests   : 0
sections with failures   : 0
sections without failures: 14
                       +   ----
total number of sections : 14
----------------------------------------------------
number of tests failed   : 0
number of tests passed   : 52
                       +   ----
total number of tests    : 52
****************************************************

Yay!

llvm-svn: 154095
2012-04-05 13:48:16 +00:00
David Chisnall ca917f5342 Fix test cases that were trying to make atomic things that are not trivially copyable.
Now all of the test cases compile.  Some of them even run!

llvm-svn: 154094
2012-04-05 13:23:08 +00:00
David Chisnall c5d5a98815 Fix use of __atomic_is_lock_free() intrinsic.
llvm-svn: 154093
2012-04-05 13:13:24 +00:00
Howard Hinnant 7e5b4c9328 Put std::piecewise_construct_t back into the dylib for ABI stability. When clients are in C++11/constexpr mode this will be safely ignored because piecewise_construct is then declared with internal linkage.
llvm-svn: 153981
2012-04-03 23:45:46 +00:00