Commit Graph

2277 Commits

Author SHA1 Message Date
Ed Schouten cda27e8197 Don't include <sys/sysctl.h> on CloudABI.
As CloudABI does not provide sysctl(), this header is not present. Make
thread.cpp build correctly (and pass all tests) by not including the header.

llvm-svn: 231768
2015-03-10 08:01:10 +00:00
Ed Schouten c19393c758 Print log/error messages on stderr, not stdout
There are a couple of places where libc++ prints log/error messages to
stdout on its own. This may of course interfere with the output
generated with applications. Log/error messages should be directed to
stderr instead.

Differential Revision:	http://reviews.llvm.org/D8135
Reviewed by:	marshall

llvm-svn: 231767
2015-03-10 07:57:43 +00:00
Ed Schouten 17f5dbef9b Add support for arc4random() to random_device.
Nuxi CloudABI (https://github.com/NuxiNL/cloudlibc) does not allow
processes to access the global filesystem namespace. This breaks
random_device, as it attempts to use /dev/{u,}random. This change adds
support for arc4random(), which is present on CloudABI.

In my opinion it would also make sense to use arc4random() on other
operating systems, such as *BSD and Mac OS X, but I'd rather leave that
to the maintainers of the respective platforms. Switching to
arc4random() does change the ABI.

This change also attempts to make some cleanups to the code. It adds a
single #define for every random interface, instead of testing against
operating systems explicitly.

As discussed, also validate the token argument to be equal to
"/dev/urandom" on all systems that only provide pseudo-random numbers.
This should cause little to no breakage, as "/dev/urandom" is also the
default argument value.

Reviewed by: jfb
Differential Revision: http://reviews.llvm.org/D8134

llvm-svn: 231764
2015-03-10 07:46:06 +00:00
Eric Fiselier 21d7ffa233 [libcxx] Fix __RAII_IncreaseAnnotator for increases >= 1
Summary: Fix suggested by @mclow.lists on D8109. Store the size of the un-poisoned vector upon construction instead of calculating it later.

Reviewers: titus, mclow.lists, kcc, EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, cfe-commits

Differential Revision: http://reviews.llvm.org/D8172

llvm-svn: 231729
2015-03-10 00:25:20 +00:00
Dimitry Andric a3175bab88 Fix another -Wunused-local-typedef warning in include/__tree.
The _Pp typedef in __tree<_Tp, _Compare, _Allocator>::__count_multi()
isn't used anywhere, so adding _LIBCPP_UNUSED is unecessary.

Differential Revision: http://reviews.llvm.org/D8140

llvm-svn: 231705
2015-03-09 21:39:02 +00:00
Eric Fiselier 764d030840 Move test to use correct suffix
llvm-svn: 231704
2015-03-09 21:30:48 +00:00
Eric Fiselier 66e41b66ad Add TrackedValue to test/support. Thanks to Louis Dionne
llvm-svn: 231674
2015-03-09 18:02:16 +00:00
Marshall Clow f4903afd93 Fix an exception-safety bug in <deque>. Reference: PR#22650. Not closing the bug because there's more work to do here
llvm-svn: 231672
2015-03-09 17:08:51 +00:00
Ed Schouten 1d2c052e9f Add CloudABI locale names to platform_support.h.
On CloudABI we should append the timezone name to the end of the locale
(e.g., nl_NL.UTF-8@Europe/Amsterdam). By fixing the locale names we can
already let a lot of locale related tests pass.

llvm-svn: 231649
2015-03-09 12:04:16 +00:00
Dan Albert eafe55200c Oops. This arg is passed, just ignored.
We should probably be using this argument to find the data files for
the tests, but that isn't implemented yet.

llvm-svn: 231498
2015-03-06 18:51:25 +00:00
Dan Albert ebfe1fe059 Fix the PrefixExecutor.
The PrefixExecutor wasn't passing the exe_path down the chain, so the
command was overriding that, the work_dir was being passed as the
command, and so on.

I've cleaned up a few pylint issues while I was here.

llvm-svn: 231496
2015-03-06 18:35:45 +00:00
Eric Fiselier e105ea84a2 Remove unneeded python import
llvm-svn: 231453
2015-03-06 06:22:22 +00:00
Eric Fiselier 26aaa6872d Run ShTests when the executor is an instance of LocalExecutor
llvm-svn: 231404
2015-03-05 20:27:01 +00:00
Marshall Clow 10b33a2662 Rework reverse_iterator::operator[] so as not to use the base iterators operator [], which can cause constness problems. Fixes PR17883
llvm-svn: 231375
2015-03-05 16:07:37 +00:00
Marshall Clow b844b1a0ff Move the <dynarray> tests out of the std/ hierarchy, since it's not really part of the standard any more.
llvm-svn: 231311
2015-03-04 23:09:15 +00:00
Marshall Clow 7945c8a1bb Nbjoerg suggested a better name for the macro for the default rune table: _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
llvm-svn: 231255
2015-03-04 16:50:02 +00:00
Marshall Clow 66599d8ea8 Create a default rune table for libc++. Initial setting - never enabled. The expectation is that some targets (Android, cough) will enable it. Note that this is an implementation detail, not an interface change.
llvm-svn: 231252
2015-03-04 16:10:14 +00:00
Eric Fiselier b3be398c67 Allow declaration of map and multimap iterator with incomplete mapped type. Patch from eugenis
llvm-svn: 231119
2015-03-03 20:10:01 +00:00
Marshall Clow af670e4b37 Add better tests for ctype<char>::classic_table
llvm-svn: 231077
2015-03-03 16:15:26 +00:00
Eric Fiselier 0357171f1c [libcxx] Add support for linking libc++ against a static ABI library.
Summary:
This patch add the CMake option `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` which, when enabled, will link libc++ against the static version of the ABI library.


Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

Subscribers: compnerd, cfe-commits

Differential Revision: http://reviews.llvm.org/D8017

llvm-svn: 231076
2015-03-03 15:59:51 +00:00
Saleem Abdulrasool 66d4c6e78c cmath: account for MSVCRT 12.0 changes
MSVCRT 12.0 introduces better compatibility for C99. This includes a number of
math routines that were previously undefined. Use the crtversion.h header to
detect the version of MSVCRT being targeted and avoid re-declaring the
variables.

Since copysign has been introduced in MSVCRT, importing the definition via using
makes it difficult to provide overloads (due to minor differences between
throw () and noexcept. Avoid defining the overloads on newer MSVCRT
targets.

llvm-svn: 230867
2015-02-28 20:18:39 +00:00
Jonathan Roelofs 724d38e448 Add self to CREDITS.txt
llvm-svn: 230595
2015-02-26 00:48:22 +00:00
Jonathan Roelofs 49ff203ec4 Add remote testing support to the lit config.
Executors can be specified at configure time by using the -DLIBCXX_EXECUTOR=""
option. Examples include:

  $ cmake <other_flags> -DLIBCXX_EXECUTOR="TimeoutExecutor(30,LocalExecutor())"
      This runs individual tests with a maximum duration

  $ cmake <other_flags> -DLIBCXX_EXECUTOR="SSHExecutor('hostname','username')"
      This runs tests on a remote target, using scp to shuttle binaries to the
      target, and ssh to invoke commands there.

  $ cmake <other_flags> -DLIBCXX_EXECUTOR="PrefixExecutor('/path/to/run/script',LocalExecutor())"
      This assumes the script knows how to copy run the executables passed to it,
      and allows for the ultimate control. This is useful for running things
      inside emulators like Valgrind & QEMU.

TODO: This doesn't claim to support ShTest tests yet, that will take a bit more
  thought & finagling (I'm still not sure how to orchestrate copy-in for those cases.

  I've also punted on what to do about tests that read data files. The testsuite
  has several tests that need to read *.dat files placed next to them, and
  currently those aren't copied over when using, say, an SSHExecutor. The
  affected tests are:

     libc++ :: std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp
     libc++ :: std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp
     libc++ :: std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
     libc++ :: std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp

Note: One thing to watch out for when using the SSHExecutor for cross-testing is
  that you'll also want to specify a TargetInfo object (so that the host's
  features aren't used for available-features checks and flags setup).

http://reviews.llvm.org/D7380

llvm-svn: 230592
2015-02-26 00:42:17 +00:00
JF Bastien e9401f61c2 libc++: support newlib's ctype
Summary: Newlib supports ctype differently from other platforms, this patch teaches libc++ about yet another platform that does ctype differently.

Reviewers: jroelofs

Subscribers: cfe-commits, danalbert, EricWF, jvoung, jfb, mclow.lists

Differential Revision: http://reviews.llvm.org/D7888

llvm-svn: 230557
2015-02-25 22:16:46 +00:00
Marshall Clow a64f2fbc09 Add trailing return types (and noexcept specifications) to the 'diamond operators'. Fixes PR#22600.
llvm-svn: 230484
2015-02-25 12:20:52 +00:00
Marshall Clow f6d58a2a1f Make the forward declaration for array swap have the same inline/visibility attributes as the definition. Thanks to Steven Wu for the catch.
llvm-svn: 230330
2015-02-24 12:46:39 +00:00
Eric Fiselier f7d36ac5f0 Remove XFAIL on string view test for apples clang compiler. Thanks to Marshall for the fix
llvm-svn: 230322
2015-02-24 10:52:07 +00:00
JF Bastien 2ca8c6b9ca Reword ELAST warning
Summary:
GCC emits a pretty amusing warning when there are apostrophes in a #warning:
```warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]```

Reword the warning to avoid this, and be more consistent with other warnings in libc++.

Reviewers: danalbert

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D7818

llvm-svn: 230298
2015-02-24 01:59:38 +00:00
Marshall Clow 0168d34e23 Change string_view::at to make it work with gcc and VC++. Thanks to K-ballo for the bug report, and Jonathan Wakeley for the code review in the bar.
llvm-svn: 230260
2015-02-23 21:12:02 +00:00
Eric Fiselier 65500d4b29 [libc++] Try and prevent evaluation of `is_default_constructible` on tuples default constructor if it is not needed.
Summary:
Currently parts of the SFINAE on tuples default constructor always gets evaluated even when the default constructor is never called or instantiated. This can cause a hard compile error when a tuple is created with types that do not have a default constructor. Below is a self contained example using a pair like class. This code will not compile but probably should.

```

#include <type_traits>

template <class T>
struct IllFormedDefaultImp {
    IllFormedDefaultImp(T x) : value(x) {}
    constexpr IllFormedDefaultImp() {}
    T value;
};

typedef IllFormedDefaultImp<int &> IllFormedDefault;

template <class T, class U>
struct pair
{
  template <bool Dummy = true,
    class = typename std::enable_if<
         std::is_default_constructible<T>::value
      && std::is_default_constructible<U>::value
      && Dummy>::type
    >
  constexpr pair() : first(), second() {}

  pair(T const & t, U const & u) : first(t), second(u) {}

  T first;
  U second;
};

int main()
{
  int x = 1;
  IllFormedDefault v(x);
  pair<IllFormedDefault, IllFormedDefault> p(v, v);
}
```

One way to fix this is to use `Dummy` in a more involved way in the constructor SFINAE. The following patch fixes these sorts of hard compile errors for tuple.


Reviewers: mclow.lists, rsmith, K-ballo, EricWF

Reviewed By: EricWF

Subscribers: ldionne, cfe-commits

Differential Revision: http://reviews.llvm.org/D7569

llvm-svn: 230120
2015-02-21 02:30:41 +00:00
Eric Fiselier d2852b69ce [libcxx] Move to using libc++abi2.exp as the default symbol list for libc++
Summary:
libc++abi2.exp should be used whenever `cxxabi.h` defines `_LIBCPPABI_VERSION`. This macro was added to libc++abi in 2012 in r149632. For this reason we should use libc++abi2.exp as default unless otherwise specified.

Also when building against an in-tree libc++abi we definitely want to use libc++abi2.exp.

I would love to know what OSX was the last to use libc++abi.exp but I can only test on 10.9.


Reviewers: danalbert, mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: meadori, cfe-commits

Differential Revision: http://reviews.llvm.org/D7773

llvm-svn: 230119
2015-02-21 02:26:24 +00:00
Larisse Voufo da577b860a Add self to CREDITS.TXT
llvm-svn: 229969
2015-02-20 06:17:20 +00:00
Larisse Voufo e4864e0bc2 More on adding sized deallocation functions in libc++: Continuing from r229281, this adds version guards and test cases.
llvm-svn: 229968
2015-02-20 06:13:05 +00:00
Eric Fiselier c50b75c75c Fix incorrect locale mapping in config.py on OSX
llvm-svn: 229935
2015-02-19 23:57:46 +00:00
Eric Fiselier 801e71129f Move to using -fdiagnostics-color=always on both GCC and Clang
llvm-svn: 229927
2015-02-19 23:26:54 +00:00
Marshall Clow 09921a571f Make basic_streambuf::xsputn write characters in chunks whenever possible, instead of one at a time. References PR#10193
llvm-svn: 229866
2015-02-19 16:17:46 +00:00
Eric Fiselier 2d38959cd9 Mark more tuple tests as unsupported in C++98 && C++03
llvm-svn: 229810
2015-02-19 02:44:09 +00:00
Eric Fiselier 0a52cd7937 [libcxx] Mark most tuple tests UNSUPPORTED for c++03 and c++98.
Summary: No declaration for the type `tuple` is given in c++03 or c++98 modes. Mark all tests that use the actual `tuple` type as UNSUPPORTED.

Reviewers: jroelofs, mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5956

llvm-svn: 229808
2015-02-19 02:10:42 +00:00
Marshall Clow 7c78beac5d Remove several unused forward declarations. Fixes PR22605.
llvm-svn: 229728
2015-02-18 19:28:35 +00:00
Marshall Clow 3afa22a3e7 Move the default template arguments into the forward declarations for the container adapters: stack and queue. References PR#22605.
llvm-svn: 229708
2015-02-18 17:51:56 +00:00
Eric Fiselier da52c55fc3 [libcxx] Tired of colorless compile errors? Enable color diagnostics today!
Summary:
This patch adds a lit option to enable color diagnostics when either `--param=color_diagnostics` is passed to LIT or `LIBCXX_COLOR_DIAGNOSTICS` is present in the environment.

My only concern with this patch is that GCC and Clang take different flags and that only GCC 4.9 and greater support `-fdiagnostics-color=always`

Does anybody have objections to this going in?

Reviewers: jroelofs, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7729

llvm-svn: 229707
2015-02-18 17:39:45 +00:00
Marshall Clow b5d34aa419 Move the default template arguments into the forward declarations for the containers: deque, forwardlist and list. References PR#22605.
llvm-svn: 229705
2015-02-18 17:24:08 +00:00
Eric Fiselier 938d957d2e Enable testing with _LIBCPP_DEBUG and fix bad assertions in string_view.
llvm-svn: 229698
2015-02-18 17:00:31 +00:00
Eric Fiselier 9317721beb [libc++] Fix PR20084 - std::is_function<void() const> failed.
Summary:
This patch introduces some black magic to detect const and volatile qualified function types such as `void () const`.

The patch works in the following way:

We first rule out any type that satisfies on of the following. These restrictions are important so that the test below works properly.
* `is_class<_Tp>::value`
* `is_union<_Tp>::value`
* `is_void<_Tp>::value`
* `is_reference<_Tp>::value`
* `__is_nullptr_t<_Tp>::value`


If none of the above is true we perform overload resolution on `__source<_Tp>(0)` to determine the return type.
*  If `_Tp&` is well-formed we select `_Tp& __source(int)`. `_Tp&` is only ill formed for cv void types and cv/ref qualified function types.
* Otherwise we select `__dummy_type __source(...)`. Since we know `_Tp` cannot be void then it must be a function type.


let `R` be the returned from `__source<_Tp>(0)`. 
We perform overload resolution on `__test<_Tp>(R)`.
* If `R` is `__dummy_type` we call `true_type __test(__dummy_type)`.
* if `R` is `_Tp&` and `_Tp&` decays to `_Tp*` we call `true_type __test(_Tp*)`.  Only references to function types decay to a pointer of the same type.
* In all other cases we call `false_type __test(...)`. 

`__source<_Tp>(0)` will try and form `_Tp&`  in the return type. if `_Tp&` is not well formed the return type of `__source<_Tp>(0)` will be dummy type. `_Tp&` is only ill-formed for cv/ref qualified function types (and void which is dealt with elsewhere).


This fixes PR20084 - http://llvm.org/bugs/show_bug.cgi?id=20084

Reviewers: rsmith, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7573

llvm-svn: 229696
2015-02-18 16:31:46 +00:00
Eric Fiselier 959e828b51 [libcxx] Add <experimental/ratio>
Summary:
This patch is pretty simple. It just adds the _v traits from <ratio>. 

The draft can be found here.

Reviewers: jroelofs, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7351

llvm-svn: 229509
2015-02-17 16:52:03 +00:00
Larisse Voufo d36bd70059 Implement C++14's sized deallocation functions, since there are no longer implicitly defined by clang, as of r229241.
llvm-svn: 229281
2015-02-15 05:18:55 +00:00
Saleem Abdulrasool 8e5ce33193 Handle function name conflicts in _LIBCPP_MSVCRT mode
Visual Studio's SAL extension uses a macro named __deallocate. This macro is
used pervasively, and gets included through various different ways. This
conflicts with the similarly named interfaces in libc++. Introduce a undef
header similar to __undef_min_max to handle this. This fixes a number of errors
due to the macro replacing the function name.

llvm-svn: 229162
2015-02-13 22:15:32 +00:00
Saleem Abdulrasool 4ef8ac946c cctype: tweak inclusions for _LIBCPP_MSVCRT case
cctype uses ctype functions such as isblank. However, when building against
msvcrt, this is provided by the support header. Include the support header if
building for Windows to ensure that the definition is properly visible.

llvm-svn: 229161
2015-02-13 22:15:28 +00:00
Marshall Clow 9a7971131e Rooting out more undefined behavior in char_traits.
llvm-svn: 229119
2015-02-13 16:04:42 +00:00
Jonathan Roelofs 272dcdc4a5 Appease buildbots
llvm-svn: 229114
2015-02-13 15:34:01 +00:00
Jonathan Roelofs a61779e67a Modularize TargetInfo discovery in the lit config
When the remote execution patch lands, this will allow us to drop in a
replacement TargetInfo object for locale support discovery, alleviating
the assumption that host==target.

http://reviews.llvm.org/D7601

llvm-svn: 229111
2015-02-13 15:25:21 +00:00
Dan Albert 0b15b14096 Fix error checking in get_temp_file_name().
Checking errno without first checking that the call failed means that
if some other call prior to mkstemp failed with EINVAL prior to this,
the assert would fire even if mkstemp succeeded. If something failed
with EEXIST, it would go in to an infinite loop.

Change-Id: I3f140a3e15fe08664a38a8c9a950c4ed547eb481
llvm-svn: 229035
2015-02-13 03:02:28 +00:00
Marshall Clow f3e0e3acda Move the test for zero-length into the char_traits (from string_view). Add tests to char_traits specializations
llvm-svn: 228981
2015-02-12 23:34:52 +00:00
Marshall Clow 8037b8ec6e Fixed a problem that UBSAN found, where we were calling memcmp(null, p, 0) - which is undefined behavior
llvm-svn: 228952
2015-02-12 19:58:06 +00:00
Marshall Clow c08e8f81ec Remove undefined behavior from test; specifically, compare(NULL, XXX, 0)
llvm-svn: 228928
2015-02-12 15:25:54 +00:00
Marshall Clow 351dde4e03 Remove undefined behavior from test; specifically, compare(NULL, XXX, 0). Thanks to Eric for the catch
llvm-svn: 228927
2015-02-12 15:21:20 +00:00
Marshall Clow 88d21343df Change some template parameter names from _C and _N to _Cont and _Sz. No functionality change.
llvm-svn: 228843
2015-02-11 16:14:01 +00:00
Marshall Clow 5f15a8b959 Need to wrap a bit in an ifdef, since there are no initializer_lists in C++03
llvm-svn: 228840
2015-02-11 15:48:21 +00:00
Marshall Clow 002144f61d Fix PR 22541: When values are equal, minmax should return the rightmost one in the initializer_list
llvm-svn: 228839
2015-02-11 15:41:34 +00:00
Eric Fiselier fe21713e2a Update double_include.sh.cpp for new headers.
llvm-svn: 228784
2015-02-11 01:31:02 +00:00
Eric Fiselier bb185a0a9e libc++ tests: wait_until.pass test sporadically fails (bug 21998)
Summary:
Hello Howard,

While running the libc++ tests on our ARM boards, we encounter sporadic failures of the two tests:
test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
test/std/thread/futures/futures.unique_future/wait_until.pass.cpp

The worker thread might not finish yet when the main thread checks its result.
I filed the bug 21998 for this case: http://llvm.org/bugs/show_bug.cgi?id=21998

Would you be able to review this please?
Thank you.
Oleg

Reviewers: howard.hinnant, mclow.lists, danalbert, jroelofs, EricWF

Reviewed By: jroelofs, EricWF

Subscribers: EricWF, mclow.lists, aemerson, llvm-commits

Differential Revision: http://reviews.llvm.org/D6750

llvm-svn: 228783
2015-02-11 01:25:57 +00:00
Eric Fiselier 58e985c2db Make convert_to_integral.pass.cpp more platform generic.
Don't depend on the underlying types of enums and wchar_t.

llvm-svn: 228781
2015-02-11 01:18:05 +00:00
Eric Fiselier e9bfd88e4b Remove default definition for libcxx_obj_dir because it doesn't make sense
llvm-svn: 228778
2015-02-11 01:03:44 +00:00
Dan Albert 86cc60eeea Make ABI header not found a warning, not an error.
Since we've added a new header to libc++abi (__cxxabi_config.h), we
now have a case where we might not always find all the ABI headers:
building libc++ against the system's libc++abi on Darwin.

Since this isn't actually a fatal error, degrade it to a warning.

llvm-svn: 228720
2015-02-10 18:46:57 +00:00
Eric Fiselier cc2e1ab69c Add pragma system header to some experimental headers and add newlines to files.
llvm-svn: 228712
2015-02-10 17:32:49 +00:00
Eric Fiselier 861d0ea2aa Fix more issues exposed by -pedantic-errors in c++03 mode
llvm-svn: 228711
2015-02-10 17:20:18 +00:00
Eric Fiselier 8f55e62990 Remove use of zero length arrays in tests. Get tests passing with -pedantic-errors
llvm-svn: 228706
2015-02-10 16:51:29 +00:00
Eric Fiselier 54519a6be9 [libcxx] Fix PR 22468 - std::function<void()> does not accept non-void-returning functions
Summary:
The bug can be found here: http://llvm.org/bugs/show_bug.cgi?id=22468

`__invoke_void_return_wrapper` is needed to properly handle calling a function that returns a value but where the std::function return type is void. Without this '-Wsystem-headers' will cause `function::operator()(...)` to not compile. 

Reviewers: eugenis, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7444

llvm-svn: 228705
2015-02-10 16:48:45 +00:00
Eric Fiselier 51544023a9 [libcxx] Properly convert the count arguments to the *_n algorithms before use.
Summary:
The requirement on the `Size` type passed to *_n algorithms is that it is convertible to an integral type. This means we can't use a variable of type `Size` directly. Instead we need to convert it to an integral type first.  The problem is finding out what integral type to convert it to.  `__convert_to_integral` figures out what integral type to convert it to and performs the conversion, It also promotes the resulting integral type so that it is at least as big as an integer. `__convert_to_integral` also has a special case for converting enums. This should only work on non-scoped enumerations because it does not apply an explicit conversion from the enum to its underlying type.



Reviewers: chandlerc, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7449

llvm-svn: 228704
2015-02-10 16:46:42 +00:00
Eric Fiselier 85b788c9c2 Fix use of C++11 extensions in C++03 code.
llvm-svn: 228698
2015-02-10 15:17:46 +00:00
Dan Albert 271e2646e8 Add __cxxabi_config.h to libcxxabi headers.
llvm-svn: 228364
2015-02-05 23:56:33 +00:00
Eric Fiselier 6fe361c1ef Remove use of _[A-Z] identifiers and poison them to detect usage
llvm-svn: 228353
2015-02-05 23:01:40 +00:00
Eric Fiselier c281a7a19f Get tests running with warnings. Fix warnings in headers and tests
llvm-svn: 228344
2015-02-05 20:28:37 +00:00
Dimitry Andric b1e78df0fa Fix unused private field warning in stdexcept after r207695.
Add a new _LIBCPP_UNUSED define in __config, which can be used to
indicate explicitly unused items, and apply it to the __imp__ field of
__libcpp_refstring.

Somebody who knows about Microsoft C++ and IBM C++ should fill in the
unused attribute syntax appropriate for those compilers, if there is
any.

Differential Revision: http://reviews.llvm.org/D6836

llvm-svn: 228281
2015-02-05 07:40:48 +00:00
Dimitry Andric 7e187f1be9 Test commit: remove whitespace at EOL.
llvm-svn: 228280
2015-02-05 07:26:14 +00:00
Dan Albert 8645ea65e5 Fix some -Wundef issues.
llvm-svn: 228266
2015-02-05 02:34:59 +00:00
JF Bastien 7b683b43be libc++: remove unused variable in random_device::operator()()
Reviewers: jvoung

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7416

llvm-svn: 228183
2015-02-04 20:25:57 +00:00
Eric Fiselier 3d2111e43b add platform to LIT's available features
llvm-svn: 228071
2015-02-03 23:49:58 +00:00
Eric Fiselier 5b67ed496e Fix alignment in tests for readability.
llvm-svn: 228028
2015-02-03 21:00:15 +00:00
Greg Fitzgerald 2e18729bce Don't assume LIT_EXECUTABLE points to a Python script, take 2
Before this patch, the CMake build assumed LIT_EXECUTABLE pointed
to a Python script, not an executable.  If you were to pass in an
executable, such as the result of py2exe on lit.py, the build would
fall over.

With this patch, the CMake build assumes LIT_EXECUTABLE is an
executable.  You can continue setting it to lit.py, but it will
now use its shebang to find a Python interpreter.

Differential Revision: http://reviews.llvm.org/D7315

llvm-svn: 228005
2015-02-03 18:47:37 +00:00
Greg Fitzgerald 57775cd66f Revert "Don't assume LIT_EXECUTABLE points to a Python script"
This reverts r227994

llvm-svn: 227996
2015-02-03 18:16:47 +00:00
Greg Fitzgerald d9ecf1ae7c Don't assume LIT_EXECUTABLE points to a Python script
Before this patch, the CMake build assumed LIT_EXECUTABLE pointed
to a Python script, not an executable.  If you were to pass in an
executable, such as the result of py2exe on lit.py, the build would
fall over.

With this patch, the CMake build assumes LIT_EXECUTABLE is an
executable.  You can continue setting it to lit.py, but it will
now use its shebang to find a Python interpreter.

Differential Revision: http://reviews.llvm.org/D7315

llvm-svn: 227994
2015-02-03 18:02:04 +00:00
Eric Fiselier 0285fc869d Mark <experimental/system_error> as complete
llvm-svn: 227974
2015-02-03 16:04:45 +00:00
Eric Fiselier 7bffc89cb9 [libcxx] Add <experimental/system_error>
Summary:
This patch just adds the variable templates in <experimental/system_error>.

see: https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#syserror


Reviewers: jroelofs, danalbert, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: chandlerc, cfe-commits

Differential Revision: http://reviews.llvm.org/D7353

llvm-svn: 227973
2015-02-03 16:03:24 +00:00
Jonathan Roelofs 07d9d76a2d Revert: Revert r227804: Use fseek/ftell instead of fseeko/ftello when Newlib is the libc
EricWF has updated the compilers on his buildbots. Hopefully they won't crash now.

llvm-svn: 227971
2015-02-03 15:34:17 +00:00
Eric Fiselier 9ba5c11b99 Rename pow2 functions in __hash_table to reflect that they are hash specific
llvm-svn: 227866
2015-02-02 21:31:48 +00:00
Eric Fiselier a261064483 Update LFTS status page
llvm-svn: 227862
2015-02-02 21:10:21 +00:00
Eric Fiselier 2f746d4c94 [libcxx] Add <experimental/chrono>
Summary:
This patch adds <experimental/chrono> which only contains a single variable template.

See: https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#time

Reviewers: jroelofs, danalbert, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7352

llvm-svn: 227860
2015-02-02 21:05:47 +00:00
Marshall Clow b9595b79f2 Fix PR#22433. The algorithm is_partitioned was testing an item in the middle of the sequence twice.
llvm-svn: 227824
2015-02-02 18:16:35 +00:00
Marshall Clow 0b48cf9a62 Fix PR#22427. The implementation of inplace_merge had a \'small data set\' optimization; if either half of the merge was small (i.e, less than 9 items), it did an inplace merge rather than allocating a buffer and doing a faster/smarter merge. However, this failed to satisfy the complexity requirements in the standard. Remove that code. Add tests to check the complexity, and add the same tests for std::merge, since we are in that section of the test suite anyway.
llvm-svn: 227811
2015-02-02 17:35:53 +00:00
Marshall Clow 526e0929a5 Reorder a couple of operations in inplace_merge so that we can meet the complexity guidelines mandated by the standard. References PR22427
llvm-svn: 227808
2015-02-02 16:44:11 +00:00
Jonathan Roelofs ef66a6f40c Revert r227804: Use fseek/ftell instead of fseeko/ftello when Newlib is the libc
This change is causing a driver crash on libcxx-libcxxabi-x86_64-linux-ubuntu-msan

llvm-svn: 227806
2015-02-02 15:56:43 +00:00
Jonathan Roelofs 8468bbb993 Use fseek/ftell instead of fseeko/ftello when Newlib is the libc
http://reviews.llvm.org/D6626

llvm-svn: 227804
2015-02-02 15:04:29 +00:00
Dan Albert b2c9c3cfce Add myself to CREDITS.TXT.
llvm-svn: 227630
2015-01-30 22:40:31 +00:00
Dan Albert 2477bed098 Update web page to direct patches to Phabricator.
llvm-svn: 227629
2015-01-30 22:33:41 +00:00
Marshall Clow 538fec0e59 Fix for PR22061 by K-ballo
llvm-svn: 227384
2015-01-28 22:22:35 +00:00
Marshall Clow 949389c395 We had two identical files named 'MoveOnly.h' in the test suite. Move one to support/, remove the other, and update all the tests that included them. No functionality change.
llvm-svn: 227370
2015-01-28 21:22:53 +00:00
Marshall Clow c57d98ae86 Removed some tabs that snuck into the test suite. No functionality change
llvm-svn: 227363
2015-01-28 20:26:11 +00:00
Marshall Clow d5f461ca03 Fix PR22366. When move-constructing an associative container and explicitly passing an allocator that compares different, we were not calling the destructor of the elements in the moved-from container.
llvm-svn: 227359
2015-01-28 19:54:25 +00:00
Eric Fiselier b06fe2a704 Fix flag order of -xc++ in CXXCompiler.
llvm-svn: 227273
2015-01-28 00:05:48 +00:00
Eric Fiselier 9ec188db33 Fix definition of __has_feature in r227263
llvm-svn: 227264
2015-01-27 23:05:41 +00:00
Eric Fiselier 5a4ee414d8 Ensure __has_feature is defined in test/support/count_new.hpp
llvm-svn: 227263
2015-01-27 23:03:38 +00:00
Eric Fiselier 9e2b7639df Fix linking pthread in tests on FreeBSD
llvm-svn: 227240
2015-01-27 20:43:53 +00:00
Nico Weber b1e72eca0c [libcxx] Make __wrap_iter work with gcc.
he following snippet doesn't build when using gcc and libc++:

    #include <string>
    void f(const std::string& s) { s.begin(); }
    #include <vector>
    void AppendTo(const std::vector<char>& v) { v.begin(); }

The problem is that __wrap_iter has a private constructor. It lists vector<>
and basic_string<> as friends, but gcc seems to ignore this for vector<> for
some reason. Declaring vector before the friend declaration in __wrap_iter is
enough to work around this problem, so do that. With this patch, I'm able to
build chromium/android with libc++. Without it, two translation units fail to
build. (iosfwd already provides a forward declaration of basic_string.)

As far as I can tell, this is due to a gcc bug, which I filed as
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816.

Fixes PR22355.

http://reviews.llvm.org/D7201

llvm-svn: 227226
2015-01-27 19:27:39 +00:00
Eric Fiselier 8e0dec7c80 Adopt CMake policy CMP0042. Set MACOSX_RPATH on by default.
llvm-svn: 227139
2015-01-26 21:56:45 +00:00
Marshall Clow 00f792e19e Added test for incomplete type support in vector/list/forward_list. References PR#17980
llvm-svn: 227131
2015-01-26 20:06:52 +00:00
Eric Fiselier 6ffc9bf6ba Change the available features used for no-rtti and no-exceptions
llvm-svn: 227107
2015-01-26 18:11:58 +00:00
Marshall Clow 07ef8e6796 Fix PR21428. Buffer was one byte too small in octal formatting case. Add test
llvm-svn: 227097
2015-01-26 17:24:52 +00:00
Eric Fiselier fbbfd09214 Get libc++ building on Sun Solaris. Patch from C Bergstrom.
llvm-svn: 226947
2015-01-23 22:22:36 +00:00
Filipe Cabecinhas 2d4e4ff77e Add USES_TERMINAL to libcxx lit tests, if available
llvm-svn: 226900
2015-01-23 06:59:51 +00:00
Marshall Clow f15d7a5882 Fix PR#22284. Add a new overload to deque::insert to handle forward iterators. Update tests to exercise this case.
llvm-svn: 226847
2015-01-22 18:33:29 +00:00
Eric Fiselier 74e82fa4f3 [libcxx] Allow use of ShTest in libc++ tests along with other changes.
Summary:
This patch allows the use of LIT's ShTest format in the libc++ test suite. ShTests have the suffix '.sh.cpp'. It also introduces a series of other changes. These changes are:

- More functionality including parsing test metadata has been moved into LIT.
- LibcxxTestFormat now supports multi-part suffixes.
- the `CXXCompiler` functionality has been used to shrink the size of LibcxxTestFormat. 
- The recursive loading of the site config has been turned into `libcxx.test.config.loadSiteConfig` so it can be used with libc++abi.
- Temporary files are now created in the build directory of libc++. This follows how it is down in ShTest.
- `not.py` was added as a utility executable that mirrors the functionality of LLVM's `not` executable. 
- The first ShTest test was added under test/libcxx/double_include.sh.cpp


Reviewers: jroelofs, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7073

llvm-svn: 226844
2015-01-22 18:05:58 +00:00
Jonathan Roelofs 3ad99f0f2e Fix lit config typo
llvm-svn: 226749
2015-01-22 00:05:11 +00:00
Duncan P. N. Exon Smith 53afae49ee tuple: Make operator<() linear instead of exponential
Patch by Matthew Dempsky!

llvm-svn: 226641
2015-01-21 02:51:17 +00:00
Eric Fiselier 4ac5a9e92c Only use -target flag when target_triple is manually specified
llvm-svn: 226615
2015-01-20 22:37:25 +00:00
Eric Fiselier 4b8985b545 Print compiler path during configuration and pass more flags to the linker
llvm-svn: 226576
2015-01-20 16:26:48 +00:00
Eric Fiselier 747c0fda5d Address danalbert's post-commit review comments on D7019 and small fixes.
This patch addresses some comments on http://reviews.llvm.org/D7019.

- Move compiler.py to test/libcxx from test/libcxx/test.
- Make CXXCompiler.target None by default.
- Use `{}` instead of `dict()` to initialize an empty dict.
- Pass the -fsanitize options to both the compile and link commands.

llvm-svn: 226575
2015-01-20 16:14:18 +00:00
Marshall Clow eb9bfac876 Cleaning up the test suite; remove some includes of non-standard file <__config>
llvm-svn: 226411
2015-01-18 19:05:51 +00:00
Eric Fiselier 7b269d0af5 A couple small changes to get LIT working with python3
llvm-svn: 226330
2015-01-16 21:59:07 +00:00
Eric Fiselier b0478741ca [libcxx] Add compiler utility class for LIT tests
Summary:
This adds a compiler utility class that handles generating compile commands and running them. Instead of having to pass the compiler path and 3 groups of flags between the configuration and the test format this allows us to just pass the compiler object.



Reviewers: danalbert, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7019

llvm-svn: 226323
2015-01-16 21:35:08 +00:00
Eric Fiselier a745465ae4 Add 'no_default_flags' option for turning off all default test compile and link flags.
When 'no_default_flags' is true only flags passed using '--param=compile_flags'
and '--param=link_flags' will be used when compiling the tests. This option
can be used to run the test suite against libstdc++ and helps with all
unusual test suite configurations.

NOTE: sanitizer flags are still added when '--param=use_sanitizer' is used even
if '--param=no_default_flags' is given.

llvm-svn: 226322
2015-01-16 21:22:08 +00:00
Dan Albert e39fb93cf3 Remove triple detection from cmake.
This isn't actually used for anything, and is broken on Darwin
(currently causing build failures now that the triple is passed to aid
cross compiling). Rather than fix unused code, just remove it.

llvm-svn: 226243
2015-01-16 02:27:17 +00:00
Dan Albert db56013cd1 [libc++] Add support for cross compiling.
Reviewers: EricWF, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6990

llvm-svn: 226237
2015-01-16 00:55:15 +00:00
Jonathan Roelofs 0c69163a42 Print out environment in lit notes
llvm-svn: 226223
2015-01-15 23:04:37 +00:00
Dan Albert 8a894a456c Use set() instead of option() for string option.
Fixes issue in r226185.

llvm-svn: 226192
2015-01-15 18:56:45 +00:00
Dan Albert b3db76622b Add a cmake option for LIT configuration variant.
llvm-svn: 226185
2015-01-15 18:35:04 +00:00
Jonathan Roelofs 13be264db2 Refactor configure_link_flags for modularity. NFC
llvm-svn: 226174
2015-01-15 16:18:13 +00:00
Jonathan Roelofs 015cf55c71 Rename src_root -> libcxx_src_root. NFC
llvm-svn: 226063
2015-01-15 00:03:14 +00:00
Jonathan Roelofs eb7b5e74d4 Rename system_lib -> system_cxx_lib. NFC
llvm-svn: 226061
2015-01-14 23:38:12 +00:00
Jonathan Roelofs e5f997e551 Rename library_root to libcxx_library_root. NFC
llvm-svn: 226043
2015-01-14 21:56:50 +00:00
Jonathan Roelofs da5a97594a Refactor configure_compile_flags. NFC
llvm-svn: 226040
2015-01-14 21:02:14 +00:00
Jonathan Roelofs fd41e2f946 Support picking the unwinder used for testing on linux (just as libc++abi testing allows)
llvm-svn: 226024
2015-01-14 19:29:04 +00:00
Jonathan Roelofs b9d33419fb Fix a lit configuration diagnostic. NFC
llvm-svn: 225985
2015-01-14 14:48:27 +00:00
Jonathan Roelofs 9144235617 Refactor the lit config's linker flag discovery code. NFC
llvm-svn: 225920
2015-01-14 01:29:04 +00:00
Marshall Clow 9db9069cf3 Make regex::assign not clobber the regex in case of failure. Fixes PR#22213
llvm-svn: 225799
2015-01-13 16:49:52 +00:00
Eric Fiselier 4fc4864bbd Fix vexing parse in test.
llvm-svn: 225633
2015-01-12 15:56:41 +00:00
Marshall Clow 612c2c7469 One more #include request in the test suite from Walter Brown
llvm-svn: 225609
2015-01-11 18:07:06 +00:00
Marshall Clow 9317900590 Change a couple more template parameter names from 'T' to '_Tp', etc. Thanks to Ondřej Majerech for the patch, but I did a bit more.
llvm-svn: 225598
2015-01-11 06:15:59 +00:00
Jonathan Roelofs cba3e4ca21 Support Newlib as libc++'s C library [cstdio part, part 2]
Wrappers for clearerr, feof, ferror (which newlib implements as macros).

http://reviews.llvm.org/D5420

llvm-svn: 225563
2015-01-10 00:08:00 +00:00
Marshall Clow e21582e742 Walter Brown sent a list of tests which needed 'additional includes' to match what was in the standard. Added these includes to the tests. No changes to the library or test results.
llvm-svn: 225541
2015-01-09 20:25:52 +00:00
Dan Albert 2bcfc6f95e [libc++] Refactor test components into modules.
Summary:
I've moved the bulk of `lit.cfg` into `test/libcxx/testconfig.py` and
`test/libcxx/testformat.py`. All that remains in `lit.cfg` is the
logic to discover lit.site.cfg if lit.cfg was run directly, and the
logic for loading configuration variants.

The configuration variant flow has changed with this patch. Rather
than instantiating an object of type `<VARIANT>Configuration`, we now
instatiate an object of type `Configuration` that was loaded from the
module `<VARIANT>.testconfig.py`.

This has to be done on a per-project basis rather than in LIT itself
because LIT doesn't actually know where the real test directory is,
only where the site configuration is (which is usually in the output
directory). It's simple enough to do though, so it's fine to require
each project to do it themselves.

I also cleaned up all the pylint issues while I was here, which was
mostly just a matter of fixing long lines.

Reviewers: mclow.lists, jroelofs, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6881

llvm-svn: 225532
2015-01-09 18:03:29 +00:00
Marshall Clow 3e33d11b06 K-Ballo found a place where we were using 'V' as a template parameter. Replace with '_Vp' for protection against user-defined macros.
llvm-svn: 225527
2015-01-09 17:03:36 +00:00
Marshall Clow a257ab0803 In early C++11 standard drafts, std::function derived from std::unary_function or std::binary_function if there was only one (or two) parameters. Before C++11 shipped, this restiction was lifted, but libc++ still does this (which is fine). However, the tests still check for this outdated requiremnt. Change then to check for the nested typedefs instead (which are still required by the standard). No change to the library.
llvm-svn: 225430
2015-01-08 06:36:41 +00:00
Marshall Clow c51d3ecb98 Add checks to make sure the hash functor has the right typedefs
llvm-svn: 225429
2015-01-08 06:18:59 +00:00
Marshall Clow 6855c93ce9 Missed a typename
llvm-svn: 225408
2015-01-07 22:26:48 +00:00
Marshall Clow d95510ebba libc++ implements its' hash objects as deriving from std::unary_function, and the tests test for that. STL @ MS pointed out that the standard doesn't requie these objects to derive from unary_function, and so the tests should not require that either. Change the tests to check for the embedded typedefs - which ARE required. No change to the library.
llvm-svn: 225403
2015-01-07 21:53:23 +00:00
Marshall Clow 601fa8d824 In C++03, a bunch of the arithmetic/logical/comparison functors (such as negate/bit_not.pass/logical_not) were defined as deriving from unary_funtion. That restriction was removed in C++11, but the tests still check for this. Change the test to look for the embedded types first_argument/second_argument/result_type. No change to the library, just more standards-compliant tests. Thanks to STL @ Microsoft for the suggestion.
llvm-svn: 225402
2015-01-07 21:51:30 +00:00
Marshall Clow 842b4aecf8 Add tests to check the typedefs from the result of std::owner_less
llvm-svn: 225381
2015-01-07 20:54:51 +00:00
Marshall Clow 9570e7b04a Missed one comparison test in r225375
llvm-svn: 225376
2015-01-07 20:40:28 +00:00
Marshall Clow 66369c03a3 In C++03, a bunch of the arithmetic/logical/comparison functors (such as add/equal_to/logical_or) were defined as deriving from binary_funtion. That restriction was removed in C++11, but the tests still check for this. Change the test to look for the embedded types first_argument/second_argument/result_type. No change to the library, just more standards-compliant tests. Thanks to STL @ Microsoft for the suggestion.
llvm-svn: 225375
2015-01-07 20:31:06 +00:00
Dan Albert d5c19bb16d Move a test to the new tests directory.
I had written the patch that added this test before the tests were
moved into tests/std, so the test ended up in the wrong directory.

llvm-svn: 225300
2015-01-06 22:18:27 +00:00
Dan Albert 23f19e9ac4 Make a test UNSUPPORTED if libcpp-has-no-threads.
llvm-svn: 225287
2015-01-06 19:32:30 +00:00
Dan Albert 658ed010a6 Appease MSAN buildbots.
This is just a compile time test, but we have MSAN buildbots that will
fail since `exp` was uninitialized.

llvm-svn: 225286
2015-01-06 19:23:25 +00:00
Marshall Clow d632356aa3 Fix PR 22106; make std::swap work for multi-dimensional arrays. Thanks to Peter Griess for the report and suggested fix
llvm-svn: 225285
2015-01-06 19:20:49 +00:00
Dan Albert 872bad5ab7 Obey [atomics.types.operations.req]/21 for GCC.
Summary:
Excerpt from [atomics.types.operations.req]/21:

> When only one memory_order argument is supplied, the value of
> success is order, and the value of failure is order except that a
> value of memory_order_acq_rel shall be replaced by the value
> memory_order_acquire and a value of memory_order_release shall be
> replaced by the value memory_order_relaxed.

Clean up some copy pasta while I'm here (someone added a return
statement to a void function).

Reviewers: EricWF, jroelofs, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6632

llvm-svn: 225280
2015-01-06 18:39:37 +00:00
Dan Albert a76dfbd428 [libcxx] Set _LIBCPP_ELAST for mingw.
Reviewers: K-ballo, mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: jfb, jroelofs, majnemer, cfe-commits

Differential Revision: http://reviews.llvm.org/D6558

llvm-svn: 225273
2015-01-06 17:34:51 +00:00
Chandler Carruth 64be05a873 [cmake/multilib] Teach libc++'s CMake build to support multilib libdir
suffixes like 'lib64' or 'lib32'.

This support is currently very rhudimentary. We define a variable
LIBCXX_LIBDIR_SUFFIX. In a standalone build of libc++ this can be
directly set as a cached variable to control the multilib suffix used.
When building libc++ within a larger LLVM build, it is hard wired to
whatever LLVM libdir suffix has been selected. If this doesn't work for
someone, just let me know. I'm happy to change it.

This is essentially new functionality for libc++ so I don't expect it to
have any impact for folks until they start setting these variables.
However, I know libc++ is built in a diverse set of environments so just
let me know if this causes you any problems.

llvm-svn: 224926
2014-12-29 12:15:47 +00:00
Eric Fiselier 279663c1b4 Prevent ill-formed instantiation of __invoke_of<...> during the evaluation of a bind expression. Fixes PR22003.
The SFINAE on the function __mu(Fn, Args...) that evaluates nested bind
expressions always tries to deduce the return type for Fn(Args...) even when Fn
is not a nested bind expression. This can cause hard compile errors when the
instantation of Fn(Args...) is ill-formed. This patch prevents the instantation
of __invoke_of<Fn, Args...> unless Fn is actually a bind expression.

Bug reportand patch from Michel Morin.

http://llvm.org/bugs/show_bug.cgi?id=22003

llvm-svn: 224753
2014-12-23 05:54:34 +00:00
Marshall Clow 09ac1efe14 Remove non-const test to get test passing. Will come back later and (correctly) add non-const tests
llvm-svn: 224748
2014-12-23 01:30:39 +00:00
Eric Fiselier 2cbc654d93 [libcxx] Consolidate new/delete replacement in tests and disable it when using sanitizers.
Summary:
MSAN and ASAN also replace new/delete which leads to a link error in these tests. Currently they are unsupported but I think it would be useful if these tests could run with sanitizers.

This patch creates a support header that consolidates the new/delete replacement functionality and checking.
When we are using sanitizers new and delete are no longer replaced and the checks always return true.

Reviewers: mclow.lists, danalbert, jroelofs, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6562

llvm-svn: 224741
2014-12-22 22:38:59 +00:00
Eric Fiselier 19c07165d1 [libcxx] Add numerous options to libc++ LIT test suite configuration.
Summary:
In order to fully replace the testit script we need to update LIT so it provides the same functionality.
This patch adds a number of different configuration options to LIT to do that. It also adds documentation for all of the command line parameters that LIT supports.

Generic options added:
- `libcxx_headers`
- `libcxx_library`
- `compile_flags`


Generic options modified:
- `link_flags`: Changed from overriding the default args to adding extra args instead (to match compile flags)
- `use_sanitizer`: Renamed from `llvm_use_sanitizer`


Please see the added documentation for more information about the switches. As for the actual documentation I'm not sure if it should be kept in libc++ forever since it adds an undue maintenance burden, but I think it should be added for the time being while the changes are new. I'm verify unskilled with HTML so if the documentation needs any changes please let me know.

Hopefully this will kill testit.



Reviewers: jroelofs, mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: alexfh, cfe-commits

Differential Revision: http://reviews.llvm.org/D5877

llvm-svn: 224728
2014-12-22 20:49:45 +00:00
Marshall Clow 08de4b0d4e Fix PR22000. __bit_iterator::move_backwards. Also make a note that __bit_iterator
is quite underrepresented in the libc++ tests suite.

llvm-svn: 224723
2014-12-22 19:10:11 +00:00
Eric Fiselier e75e0b4095 Move unconditional test compile and link flags into their configuration functions.
llvm-svn: 224674
2014-12-20 04:14:14 +00:00
Eric Fiselier a78a26783e [libcxx] Teach libcxx's lit configuration new ways to find lit.site.cfg
Summary:
Currently to run tests in tree you need to symlink the lit.site.cfg file generated by the cmake build into the source tree, and teach your VCS to ignore it.

This allows the user to specify where to find the lit.site.cfg file two different ways:
* lit_site_config lit parameter
* LIT_SITE_CONFIG enviroment variable. 

example usage:
```
lit -sv --param=libcxx_site_config=path/to/libcxx-build/test/lit.site.cfg path/to/tests
```
Or
```
export LIBCXX_SITE_CONFIG=path/to/libcxx-build/test/lit.site.cfg
lit -sv path/to/tests
```
The command line parameter will override the environment variable. 
If neither options are present a warning is issued and the `lit.cfg` file is loaded directly. 


Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

Subscribers: ddunbar, cfe-commits

Differential Revision: http://reviews.llvm.org/D6255

llvm-svn: 224671
2014-12-20 03:16:55 +00:00
Eric Fiselier 5a83710e37 Move test into test/std subdirectory.
llvm-svn: 224658
2014-12-20 01:40:03 +00:00
Eric Fiselier 5459af15f9 [libcxx] Add <experimental/type_traits> for LFTS
Summary:
This adds the <experimental/type_traits> (minus invocation traits). Mostly just the `_v` traits.


Reviewers: K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5742

llvm-svn: 224626
2014-12-19 22:21:44 +00:00
Eric Fiselier 7d8372ea02 Remove unneeded configuration code.
llvm-svn: 224618
2014-12-19 21:42:17 +00:00
Eric Fiselier 469a4f90bb [libcxx] Allow the use of ccache when running the test suite.
Summary:
In order to get the bots running quicker I would like to be able to use ccache 
with the test suite. This patch adds support for running the test suite using 
ccache. To use ccache pass `--param=use_ccache=true` when running the test suite.

ccache will not cache any command that invokes ld, so the build step needs to be
split into two separate compile commands. The cost of splitting the build step
into two parts when not using ccache seems to be minimal. On my machine I saw a
difference of ~5 seconds on a 5 minute test suite run.

A full test suite run with ccache generates about 250MB of cached data.

I recorded the following times for running the test suite in the following configurations:
- no ccache: 340s
- initial ccache run: 380s
- rerun with ccache (no changes): 53s.
- rerun with ccache (<string> changed): 80s
- rerun with ccache (<cmath> changed): 169s
- rerun with ccache (<valarray> changed): 69s





Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: jroelofs

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6647

llvm-svn: 224603
2014-12-19 19:27:32 +00:00
Marshall Clow d60fe11919 Re-commit the test for regex that I busted last night - now passes under ASAN
llvm-svn: 224342
2014-12-16 16:22:43 +00:00
Justin Bogner 1e8019f5b9 Revert "Fix installheaders target's permissions"
The install of headers excludes the support directory, so these chmod
calls fail on non-existent directories, as seen on this bot:

http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_build/2801/console

This reverts commit r224300.

llvm-svn: 224317
2014-12-16 05:28:07 +00:00
Jonathan Roelofs ab534366fe Appease the c++14 buildbots
llvm-svn: 224304
2014-12-16 01:18:11 +00:00
Marshall Clow e8a651b02d Comment out the breaking tests until I figure out what's going on here.
llvm-svn: 224301
2014-12-16 00:59:59 +00:00
Jonathan Roelofs 075406fdc9 Fix installheaders target's permissions
llvm-svn: 224300
2014-12-16 00:48:13 +00:00
Marshall Clow b58f003e86 Once more w/o the typo.
llvm-svn: 224298
2014-12-16 00:46:23 +00:00
Marshall Clow 8a389a5786 Fix the literal string that I said would be six elements long to actually be six elements long. Octal. Sheesh.
llvm-svn: 224297
2014-12-16 00:45:47 +00:00
Marshall Clow 470a231b7c Add test to ensure that iterator_traits<NotAnIterator> doesn't have a value type
llvm-svn: 224295
2014-12-16 00:30:07 +00:00
Marshall Clow b04058e8c1 Implement LWG 2217 - operator==(sub_match, string) slices on embedded '\0's
llvm-svn: 224292
2014-12-15 23:57:56 +00:00
Eric Fiselier bfd53cd2af Add option to turn off installation of headers.
llvm-svn: 224162
2014-12-12 22:52:58 +00:00
Sergey Dmitrouk 9e3a60769f Include newlib-specific locales in __locale
llvm-svn: 224111
2014-12-12 08:36:16 +00:00
Eric Fiselier 0e8f0d9198 Add support for building libc++ as a 32 bit library
llvm-svn: 224096
2014-12-12 03:12:18 +00:00
Eric Fiselier 7a68749f7f Fix building and running tests when LIBCXX_ENABLE_EXCEPTIONS or LIBCXX_ENABLE_RTTI are turned off.
llvm-svn: 224095
2014-12-12 02:36:23 +00:00
Jonathan Roelofs ebb54954a5 Add 'REQUIRES: long_tests' to one more long test
llvm-svn: 224069
2014-12-11 22:27:49 +00:00
Jonathan Roelofs 7c2f55c3b9 Add 'REQUIERS: long_tests' to a few more long tests
llvm-svn: 224064
2014-12-11 22:05:18 +00:00
Jonathan Roelofs 963bdd7c0a Fix platform_support.h's get_temp_file_name() on Newlib under __STRICT_ANSI__
llvm-svn: 224057
2014-12-11 20:56:40 +00:00
Jonathan Roelofs cf81121877 Add an XFAIL for Newlib's missing uchar.h
llvm-svn: 224037
2014-12-11 19:11:39 +00:00
Jonathan Roelofs 256ecc3c2a Mark a bunch of long running tests as 'REQUIRES: long_tests'
This lets us skip them as UNSUPPORTED on slow systems like QEMU

llvm-svn: 224032
2014-12-11 18:35:36 +00:00
Jonathan Roelofs 2f63b50761 Mark some more fenv tests as UNSUPPORTED by newlib
llvm-svn: 224024
2014-12-11 16:17:26 +00:00
Jonathan Roelofs 9df08f027d Add an XFAIL for Newlib's missing fenv.h
llvm-svn: 224021
2014-12-11 15:37:22 +00:00
Eric Fiselier f60e441080 Update information on where to find buildbots. Remove dead buildbot links.
llvm-svn: 223848
2014-12-09 22:53:21 +00:00
Marshall Clow 8ad78e905f Move the optional tests into test/experimental. They were put into test/utilities because optional was going to be part of C++14, and then was pulled and put into the Library Fundamentals TS instead. No funcitonality change here; just moving files around.
llvm-svn: 223778
2014-12-09 15:07:42 +00:00
Marshall Clow e61fba3b70 Add all the relational operators to std::experimental::optional. Also update bad_optional_access to match the Library Fundamentals draft standard. This is not all of the upcoming changes to optional, though.
llvm-svn: 223775
2014-12-09 14:49:17 +00:00
Sergey Dmitrouk 4cc3a2d82c Explicitly include <sched.h> for sched_yield()
It might be implicitly included by <pthread.h> (and that's why it worked
so far), but it's not guaranteed (for example, this is not the case with
newlib).

llvm-svn: 223661
2014-12-08 14:50:21 +00:00
Eric Fiselier 9cfa8b762f Give lit.cfg's threading options default values when not defined.
llvm-svn: 223601
2014-12-07 08:52:19 +00:00
Eric Fiselier 0dc119be17 Mark a couple of tests as XFAIL with older compilers.
llvm-svn: 223600
2014-12-07 05:31:17 +00:00
Eric Fiselier 67945b6a44 Consolidate error reporting in lit.cfg
llvm-svn: 223599
2014-12-07 04:28:50 +00:00
Eric Fiselier b967e3238e Revert parts of r223594. Use DYLD_LIBRARY_PATH on OSX when running tests.
llvm-svn: 223598
2014-12-07 00:34:23 +00:00
Eric Fiselier 9db4635146 Fix apple clang detection in lit.cfg
llvm-svn: 223597
2014-12-06 22:49:38 +00:00
Eric Fiselier a1c73a6d6d Unify and cleanup rpath handling in tests.
llvm-svn: 223594
2014-12-06 22:08:51 +00:00
Eric Fiselier b92da3f217 [libcxx] Add logic to probe compiler in tests.
Summary:
This patch probes the cxx compiler used during testing by getting it to dump its predefined macros. Based on the value of these macros the compiler name and compiler name + version are added to the available features.

There are three compiler names:
- `clang`
- `apple-clang`
- `gcc`.

The available features added are equivalent to:
- `'%s' % compiler_name`
- `'%s-%s.%s' % compiler_name, major_version, minor_version`

This information can be used to XFAIL tests on different compilers / versions.



Reviewers: mclow.lists, danalbert, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6399

llvm-svn: 223593
2014-12-06 21:13:15 +00:00
Eric Fiselier b9f99739bc Add support for building and testing libc++ without threads to CMake.
Currently hacks must be used in to configure and build libc++ without threads
when using CMake. This patch adds CMake options to enable/disable building with
threads and a monotonic clock.

This patch also propagates the configuration information to lit so the tests
are properly configured as well.

llvm-svn: 223591
2014-12-06 21:02:58 +00:00
Eric Fiselier 2050bedf03 Improve error message when _LIBCPP_HAS_NO_MONOTONIC_CLOCK is used improperly
llvm-svn: 223590
2014-12-06 20:09:11 +00:00
JF Bastien b1ba015b9f libc++: support NaCl when building thread.cpp
Summary: NaCl shouldn't include sysctl.h when trying to determine std:🧵:hardware_concurrency, it should instead use sysconf(_SC_NPROCESSORS_ONLN) through unistd.h. No test needs to be changed, since hardware_concurrency.pass.cpp already tests that std:🧵:hardware_concurrency > 0.

Test Plan: make check-libcxx

Reviewers: dschuff, danalbert

Subscribers: jfb, cfe-commits

Differential Revision: http://reviews.llvm.org/D6470

llvm-svn: 223128
2014-12-02 17:30:19 +00:00
JF Bastien 57148cbcbd libc++: add NaCl and PNaCl support for std::random_device
Summary:
The NaCl sandbox doesn't allow opening files under /dev, but it offers an API which provides the same capabilities. This is the same random device emulation that nacl_io performs for POSIX support, but nacl_io is an optional library so libc++ can't assume that device emulation will be performed. Note that NaCl only supports /dev/urandom, not /dev/random.

This patch also cleans up some of the preprocessor #endif, and fixes the test for Win32 (it accepts any token, and would therefore never throw regardless of the token provided).

Test Plan: ninja check-libcxx

Reviewers: dschuff, mclow.lists, danalbert

Subscribers: jfb, cfe-commits

Differential Revision: http://reviews.llvm.org/D6442

llvm-svn: 223068
2014-12-01 19:19:55 +00:00
JF Bastien adec3407b8 libc++: integral types trap on PNaCl
Reviewers: dschuff, danalbert

    Subscribers: jfb, cfe-commits

    Differential Revision: http://reviews.llvm.org/D6411

llvm-svn: 222842
2014-11-26 17:51:58 +00:00
Eric Fiselier 53deb607d9 Fixes to get libc++ building on sun solaris. Patch from C Bergstrom.
llvm-svn: 222794
2014-11-25 21:57:41 +00:00
Eric Fiselier e620b5eaa6 Use lit.util.executeCommand instead of our own version
llvm-svn: 222717
2014-11-25 03:03:32 +00:00
Eric Fiselier cf82c1e904 Print lit configuration information after all configuration is done.
llvm-svn: 222711
2014-11-24 23:46:42 +00:00
Dan Albert 86b75a4057 Add better support for custom test runners.
Summary:
I finally got around to merging the many, many changes to lit.cfg into
Android's libc++. This patch makes it simpler to actually use a custom
configuration and test format.

First, I've factored out _build, _run, and _clean methods from
_execute_test, since these are the likely parts that will need to be
overridden. This is likely a first step in the work jroelofs has been
doing with improving cross-compiling test execution.

Second, I've added a `configuration_variant` to the config. This
entry, if present, is a string that forms the prefix of the class that
is to be used to configure the test runner. For example, Android sets
`config.configuration_variant = 'Android'`, and this causes an object
of type `AndroidConfiguration` to be constructed.

As an example of how this will be used, see:
https://android-review.googlesource.com/#/c/116022/

Reviewers: jroelofs, mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6373

llvm-svn: 222698
2014-11-24 22:24:06 +00:00
Eric Fiselier a77ccfec24 Handle extra whitespace in linux distribution name.
llvm-svn: 222514
2014-11-21 08:54:35 +00:00
Eric Fiselier 5484151754 Mark some locale tests as XFAIL on debian and opensuse.
llvm-svn: 222513
2014-11-21 08:02:38 +00:00
Dan Albert 9ce6beaf07 Add more REQUIRES: LOCALE.* to tests.
llvm-svn: 222492
2014-11-21 01:23:04 +00:00
Eric Fiselier d50a62e9e8 Remove xfail tag for darwin from quick_exit test
llvm-svn: 222406
2014-11-20 03:40:32 +00:00
Eric Fiselier 3b0a6ce96c Remove tests that va_copy is not defined when C++ < 11.
llvm-svn: 222405
2014-11-20 03:39:25 +00:00
Eric Fiselier 4fb4ab50fc Change contradictory wording in va_copy test error message.
llvm-svn: 222383
2014-11-19 20:01:26 +00:00
Marshall Clow ad75510453 Implement N4280 - 'Non-member size() and more'
llvm-svn: 222378
2014-11-19 19:43:23 +00:00
Marshall Clow e8584ca3ad Added entries for bugs 2118 and 2306, which were closed in Urbana
llvm-svn: 222361
2014-11-19 15:59:16 +00:00
Eric Fiselier 1eb8220aff Overhaul and separate nullptr_t tests to pass with C++03.
The standard requires that nullptr_t can be reinterpret_cast to an integral type
at least the size of nullptr_t. There is no way to emulate this conversion in
the C++03 nullptr_t implementation. The test for this conversion has been moved
to a new test and marked XFAIL with c++03.

This recommits what was originally r222296.

llvm-svn: 222318
2014-11-19 05:49:03 +00:00
Eric Fiselier 77c1ae8364 Revert r222296 to fix bad commit message
llvm-svn: 222316
2014-11-19 05:41:29 +00:00
Eric Fiselier 13d123ccf7 Cleanup quick_exit tests and get them passing in C++03.
Wrap the original test in _LIBCPP_HAS_QUICK_EXIT so it only runs when we have
quick_exit and add two new tests that check that when _LIBCPP_HAS_QUICK_EXIT
is not defined then no definition of std::at_quick_exit or std::quick_exit are
available.

llvm-svn: 222298
2014-11-19 01:45:12 +00:00
Eric Fiselier a3857d336e diff --git a/test/language.support/support.types/nullptr_t.pass.cpp b/test/language.support/support.types/nullptr_t.pass.cpp
index 6c15fef..4d7c8b0 100644
--- a/test/language.support/support.types/nullptr_t.pass.cpp
+++ b/test/language.support/support.types/nullptr_t.pass.cpp
@@ -18,42 +18,62 @@ struct A
     A(std::nullptr_t) {}
 };
 
+template <class T>
+void test_conversions()
+{
+    {
+        T p = 0;
+        assert(p == nullptr);
+    }
+    {
+        T p = nullptr;
+        assert(p == nullptr);
+        assert(nullptr == p);
+        assert(!(p != nullptr));
+        assert(!(nullptr != p));
+    }
+}
+
+template <class T>
+void test_comparisons()
+{
+    T p = nullptr;
+    assert(p == nullptr);
+    assert(p <= nullptr);
+    assert(p >= nullptr);
+    assert(!(p != nullptr));
+    assert(!(p < nullptr));
+    assert(!(p > nullptr));
+    assert(nullptr == p);
+    assert(nullptr <= p);
+    assert(nullptr >= p);
+    assert(!(nullptr != p));
+    assert(!(nullptr < p));
+    assert(!(nullptr > p));
+}
+
+
 int main()
 {
     static_assert(sizeof(std::nullptr_t) == sizeof(void*),
                   "sizeof(std::nullptr_t) == sizeof(void*)");
-    A* p = 0;
-    assert(p == nullptr);
-    void (A::*pmf)() = 0;
-#ifdef __clang__
-    // GCC 4.2 can't handle this
-    assert(pmf == nullptr);
-#endif
-    int A::*pmd = 0;
-    assert(pmd == nullptr);
-    A a1(nullptr);
-    A a2(0);
-    bool b = nullptr;
-    assert(!b);
-    assert(nullptr == nullptr);
-    assert(nullptr <= nullptr);
-    assert(nullptr >= nullptr);
-    assert(!(nullptr != nullptr));
-    assert(!(nullptr < nullptr));
-    assert(!(nullptr > nullptr));
-    A* a = nullptr;
-    assert(a == nullptr);
-    assert(a <= nullptr);
-    assert(a >= nullptr);
-    assert(!(a != nullptr));
-    assert(!(a < nullptr));
-    assert(!(a > nullptr));
-    assert(nullptr == a);
-    assert(nullptr <= a);
-    assert(nullptr >= a);
-    assert(!(nullptr != a));
-    assert(!(nullptr < a));
-    assert(!(nullptr > a));
-    std::ptrdiff_t i = reinterpret_cast<std::ptrdiff_t>(nullptr);
-    assert(i == 0);
+
+    {
+        test_conversions<std::nullptr_t>();
+        test_conversions<void*>();
+        test_conversions<A*>();
+        test_conversions<void(*)()>();
+        test_conversions<void(A::*)()>();
+        test_conversions<int A::*>();
+    }
+    {
+        test_comparisons<std::nullptr_t>();
+        test_comparisons<void*>();
+        test_comparisons<A*>();
+        test_comparisons<void(*)()>();
+    }
+    {
+        bool b = nullptr;
+        assert(!b);
+    }
 }
diff --git a/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp b/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp
new file mode 100644
index 0000000..92bd879
--- /dev/null
+++ b/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp
@@ -0,0 +1,17 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// typedef decltype(nullptr) nullptr_t;
+
+#include <cstddef>
+
+int main()
+{
+    std::ptrdiff_t i = static_cast<std::ptrdiff_t>(nullptr);
+}
diff --git a/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp b/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp
new file mode 100644
index 0000000..34c7a93
--- /dev/null
+++ b/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// NOTE: nullptr_t emulation cannot handle a reinterpret_cast to an
+// integral type
+// XFAIL: c++98, c++03
+
+// typedef decltype(nullptr) nullptr_t;
+
+
+#include <cstddef>
+#include <cassert>
+
+int main()
+{
+    std::ptrdiff_t i = reinterpret_cast<std::ptrdiff_t>(nullptr);
+    assert(i == 0);
+}

llvm-svn: 222296
2014-11-19 01:31:56 +00:00
Eric Fiselier e15f86cb12 Modify tests to check that va_copy is only defined in C++11 and beyond.
llvm-svn: 222282
2014-11-18 23:46:18 +00:00
Eric Fiselier a4884fdefd Flush out test cases for tuples constructor SFINAE
llvm-svn: 222278
2014-11-18 23:01:57 +00:00
Eric Fiselier 9b681f61b6 Add support for LLVM_USE_SANITIZER=Thread
llvm-svn: 222259
2014-11-18 21:26:45 +00:00
Marshall Clow 90ba6230a3 Marked LWG 2399 as complete. I committed a test for this earlier today.
llvm-svn: 222251
2014-11-18 20:37:47 +00:00
Marshall Clow e1a075d5ce Add a test for LWG issue #2399. We already implement this, but now we have a test as well.
llvm-svn: 222242
2014-11-18 18:14:53 +00:00
Marshall Clow f127a2d77f Update status of LWG issues 2340, 2396 and 2401. In all three cases, these are things that we already do.
llvm-svn: 222240
2014-11-18 17:35:16 +00:00
Marshall Clow e9ad58a76e Since Eric poisoned the comma operator on all our test iterators, we no longer need 'comma_iterator'. Remove it from the test suite.
llvm-svn: 222238
2014-11-18 16:15:00 +00:00
Marshall Clow e2c1750a2f Fix the tests I broke with the last commit. Sorry for the noise
llvm-svn: 222165
2014-11-17 19:16:57 +00:00
Marshall Clow 278ddec22c Implement LWG2400 - 'shared_ptr's get_deleter() should use addressof()', and add tests. Mark LWG2400 and LWG2404 as complete
llvm-svn: 222161
2014-11-17 19:05:50 +00:00
Marshall Clow 85a429a67a Reworked mismatch tests to count the number of comparisons, and make sure we are conforming with LWG2404. We are
llvm-svn: 222159
2014-11-17 18:52:25 +00:00
Marshall Clow 4bc58540c9 Fix a warning in the test; no functionality change
llvm-svn: 222143
2014-11-17 16:34:44 +00:00
Marshall Clow 3687d3c2e9 Implement void_t from N3911. Add a private version for use in the library before C++1z. Update the 1z status page, marking a bunch of issues that don't require library changes as complete (2129, 2212, 2230, 2233, 2325, 2365, 2376)
llvm-svn: 222138
2014-11-17 15:50:08 +00:00
Marshall Clow 5a8c46653f Add tests to ensure that reference_wrapper<T> is trivially copyable. This was added to C++1z with the adoption of N4277, but libc++ already implemented it as a conforming extension. No code changes were needed, just more tests.
llvm-svn: 222132
2014-11-17 15:04:46 +00:00
Eric Fiselier 382338d988 Fix build regression caused by not defining ABI library macros
llvm-svn: 222085
2014-11-15 17:25:23 +00:00
Eric Fiselier 5aedca96d5 [libcxx] Refactor CMakeLists.txt handling of compile and link flags to suppress warnings.
Summary:
Currently we have 5 variables that are used to specify options for building libcxx
1. `LIBCXX_CXX_FEATURE_FLAGS`
2. `LIBCXX_CXX_WARNING_FLAGS`
3. `LIBCXX_CXX_REQUIRED_FLAGS`
4. `compile_flags` (in libcxx/lib)
5. `link_flags` (in libcxx/lib)

The first three all get put into `CMAKE_CXX_FLAGS`. 
This changes the way flags are handled by only using 3 different options:

1. `LIBCXX_CXX_FLAGS` - general compile and link flags.
2. `LIBCXX_COMPILE_FLAGS` - compile only flags.
3. `LIBCXX_LINK_FLAGS` - link only flags.

This patch also removes the warning about `-nostdinc++` being unused during linking.



Reviewers: mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6277

llvm-svn: 222080
2014-11-15 06:26:30 +00:00
Eric Fiselier 3fe611e508 Split thread test into two parts. Mark one as XFAIL with ASAN.
The second part of the test checks that std::terminate is called when a running
thread is move assigned to. Calling std::terminate prevents some of the destructors
to be called and ASAN fires on this.

llvm-svn: 222076
2014-11-15 01:58:45 +00:00
Eric Fiselier d6bd7bf6ba Initialize pointer in string conversion helpers to prevent MSAN diagnostic.
Since the initialization of the pointer happens across the libc library boundry
MSAN will not know the pointer was initialized. This fixes MSAN failures in
test/strings/string.conversions.

llvm-svn: 222052
2014-11-14 22:23:57 +00:00
Eric Fiselier 0425c7c726 add debug info when compiling sanitizer tests
llvm-svn: 222051
2014-11-14 22:18:03 +00:00
Eric Fiselier 71380b8391 Add -gline-tables-only when compiling w/ sanitizers in RELEASE
llvm-svn: 222035
2014-11-14 20:38:07 +00:00
Eric Fiselier 93f65c4d08 [libcxx] Fix memory leak in strstream tests.
Summary: The strstream function `str()` sets `freeze(true)`. When `freeze` is true the destructor is not allowed to free any dynamically allocated memory. The memory leak causes ASAN to fail on these tests. To ensure memory is deallocated `strstream.freeze(false)` is called at the end of the tests.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6261

llvm-svn: 222025
2014-11-14 19:10:43 +00:00
Eric Fiselier b9987293e6 [libcxx] Fix vector annotator size increase in `vector::insert(pos, count, value)`
Summary:
The size of the vector is being increased by `__n` during the call to `__move_range` and not by 1.
This fixes a test failure in `containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp` when using ASAN.

Reviewers: danalbert, kcc, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6264

llvm-svn: 222014
2014-11-14 18:28:36 +00:00
Eric Fiselier 950a166710 Split string capacity test into two parts and mark one part as UNSUPPORTED when using sanitizers.
The test is split such that:
- max_size.pass.cpp tests that string::resize() fails to allocator for max_size
  and max_size -1
- over_max_size.pass.cpp tests that string::resize() throws a length error for
  max_size + 1

The test was split into two because max_size.pass.cpp cannot pass with 
sanitizers but over_max_size.pass.cpp can.

llvm-svn: 221969
2014-11-14 03:16:12 +00:00
Eric Fiselier eb2378b70c Mark more tests as UNSUPPORTED with ASAN and MSAN.
These tests fail for 2 reasons when using ASAN and MSAN.
1. If allocator_may_return_null=0 they will fail because null is returned
   or an exception is thrown.
2. When allocator_may_return_null=1 the new_handler is still not called. This
   results in an assertion failures.

llvm-svn: 221967
2014-11-14 02:55:16 +00:00
Eric Fiselier b941b50b16 Setup llvm-symbolizer when running the tests with sanitizers
llvm-svn: 221966
2014-11-14 02:47:08 +00:00
Eric Fiselier bc2d632964 Add -O3 when testing with UBSAN. This triggers far undefined behaviour
llvm-svn: 221964
2014-11-14 02:07:52 +00:00
Eric Fiselier a0c1b09c6a Mark more locale tests as unsupported with ASAN and MSAN
llvm-svn: 221937
2014-11-13 22:45:23 +00:00
Marshall Clow eb63c5e28c Replaced checking in string_view::remove_suffix/remove_prefix by _LIBCPP_ASSERT, since this is technically undefined behavior. Fixes PR#21496
llvm-svn: 221717
2014-11-11 22:07:10 +00:00
Marshall Clow 981f31ac51 Fix typo in allocator_traits::construct. This fixes PR14175, which shows up if an allocator has a no-args construct method
llvm-svn: 221697
2014-11-11 19:22:33 +00:00
Marshall Clow f1ce9c177f Fixed a typo in a paper name: 4190 --> N4190
llvm-svn: 221690
2014-11-11 16:45:50 +00:00
Marshall Clow 862af58793 Added vector<T>::insert tests suggested by code coverage results
llvm-svn: 221689
2014-11-11 16:44:05 +00:00
Marshall Clow a773ab1d8d EricQWF's code coverage work showed that none of the libc++ tests were exercising some code in vector<bool>. Add more tests in an attempt to get better coverage
llvm-svn: 221644
2014-11-11 00:16:30 +00:00
Marshall Clow 68640684e8 Update status pages for C++1z
llvm-svn: 221601
2014-11-10 15:43:20 +00:00
Eric Fiselier d4bc0bf3a3 Fix rvalue bug in __has_operator_addressof
llvm-svn: 221398
2014-11-05 21:20:10 +00:00
Eric Fiselier c7e48bec0e Fix operator & detection trait to check for free function overloads as well
llvm-svn: 221395
2014-11-05 20:59:18 +00:00
Eric Fiselier 193bd50fe4 Mark another test as UNSUPPORTED with ASAN and MSAN
llvm-svn: 221275
2014-11-04 17:03:47 +00:00
Eric Fiselier 652a3f3257 Actually mark the tests an unsupported with MSAN (not just ASAN)
llvm-svn: 221240
2014-11-04 05:36:15 +00:00
Eric Fiselier 446e4b6be1 Mark tests that replace operator new/delete as UNSUPPORTED with ASAN and MSAN.
tests that replace operator new/delete won't link when using ASAN and MSAN 
because these sanitizers also replace new/delete.

llvm-svn: 221236
2014-11-04 05:11:41 +00:00
Eric Fiselier 49c541a754 Add test for type properties of std::reference_wrapper
llvm-svn: 221224
2014-11-04 01:54:44 +00:00
Marshall Clow 8ba95b7b4d Mark string_view::to_string as const. Fixes PR21428
llvm-svn: 221101
2014-11-02 15:35:32 +00:00
Eric Fiselier 22b131ffdd Partial fix for building w/ libcxxrt on OSX. Patch from C Bergstrom.
llvm-svn: 221029
2014-11-01 00:41:42 +00:00
Eric Fiselier 1d558b84ef libcxxrt defines bad_array_new_length::what() so move that into a conditional compilation block
llvm-svn: 221025
2014-11-01 00:11:25 +00:00
Eric Fiselier fd465fe5b5 libcxxrt now implements bad_array_new_length and need to gaurd against multiple defines. Patch from Baptiste Daroussin.
llvm-svn: 220882
2014-10-29 23:14:53 +00:00
Eric Fiselier d6b46b46b6 Fix example in documentation of target triple sanitization.
llvm-svn: 220804
2014-10-28 18:03:38 +00:00
Eric Fiselier 295bce1130 [libcxx] Delay evaluation of __make_tuple_types to prevent blowing the max template instantiation depth. Fixes Bug #18345
Summary:
http://llvm.org/bugs/show_bug.cgi?id=18345

Tuple's constructor and assignment operators for "tuple-like" types evaluates __make_tuple_types unnecessarily. In the case of a large array this can blow the template instantiation depth.

Ex:
```
#include <array>
#include <tuple>
#include <memory>
 
typedef std::array<int, 1256> array_t;
typedef std::tuple<array_t> tuple_t;

int main() {
  array_t a;
  tuple_t t(a); // broken
  t = a; // broken

  // make_shared uses tuple behind the scenes. This bug breaks this code.
  std::make_shared<array_t>(a);
}
```

To prevent this from happening we delay the instantiation of `__make_tuple_types` until after we perform the length check. Currently `__make_tuple_types` is instantiated at the same time that the length check .


Test Plan: Two tests have been added. One for the "tuple-like" constructors and another for the "tuple-like" assignment operator. 

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: K-ballo, cfe-commits

Differential Revision: http://reviews.llvm.org/D4467

llvm-svn: 220769
2014-10-28 06:31:22 +00:00
Jonathan Roelofs 33c2c02e25 Test that the single-threaded lit feature is available iff the corresponding guard is #defined
http://reviews.llvm.org/D6006

llvm-svn: 220729
2014-10-27 22:39:19 +00:00
Eric Fiselier bb19141779 Add special case handling of linux target triples that do not contain `-gnu`.
For targets that end it `redhat-linux` and `suse-linux` manually add the `-gnu`
section of the target since `linux-gnu` is needed in the testsuite.

This patch also moves the removal of minor and patchlevel numbers from OSX
triples to be handled when deducing the triple instead of when adding available
features.

llvm-svn: 220724
2014-10-27 22:14:25 +00:00
Eric Fiselier b2a6048b18 Add test to ensure including <atomic> fails when _LIBCPP_HAS_NO_THREADS is defined.
llvm-svn: 220722
2014-10-27 21:38:23 +00:00
Eric Fiselier b494e5d198 [libcxx] use clang's __char16_t and __char32_t definitions on Linux in C++03 mode.
Summary: This fixes ODR violations in C++03 mode in test/localization/locale.stdcvt. The special case for linux was introduced in 2010 before clang always defined __char16_t and __char32_t.

Reviewers: mclow.lists, danalbert, jroelofs, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5930

llvm-svn: 220716
2014-10-27 20:29:05 +00:00
Eric Fiselier 847ee13171 Fix use of operator comma in is_permutation and delete comma operator for test iterators.
The comma operators in the test iterators give better error messages when they
are deleted as opposed to not defined. Delete these functions when possible.

llvm-svn: 220715
2014-10-27 20:26:25 +00:00
Eric Fiselier aae76493f0 [libcxx] Remove use of uniform initialization from regex tests so that they compile in C++03.
Reviewers: danalbert, jroelofs, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5957

llvm-svn: 220707
2014-10-27 19:29:32 +00:00
Eric Fiselier 910285b238 [libcxx] Fix use of operator comma where the types can be user defined
Summary:
An evil user might overload operator comma. Use a void cast to make sure any user overload is not selected.
Modify all the test iterators to define operator comma. 

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5929

llvm-svn: 220706
2014-10-27 19:28:20 +00:00
Marshall Clow a5027324ec PR #21321 talked about implementation-defined behavior of realloc. I poo-poohed it, and was wrong. Fix the call in <locale>. Review the others, refactored some duplicated code, and found overflow bugs (and __event_cap_ was never getting updated, either).
llvm-svn: 220702
2014-10-27 19:08:10 +00:00
Marshall Clow aedfb87089 Change the comment on the closing #endif to match the condition on the corresponding #ifdef. Thanks to K-ballo for the catch. No functionality change.
llvm-svn: 220647
2014-10-26 20:29:38 +00:00
Eric Fiselier 460b224ef9 Change uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')
Although the current method is valid up till python 3.3 (which is not supported)
this seems to be a clearer way of checking for linux and moves the tests towards
python 3 compatibility.

llvm-svn: 220534
2014-10-23 22:57:56 +00:00
Eric Fiselier e608aed22b [libcxx] XFAIL all currently failing libc++ tests for linux.
Summary:
Pretty please? We now have a significant number of builders that test libc++. I really want those builders to be green.
Most of these failures are due to differences in locale data, including those in regex. I will continue working on fixing the locale and regex tests but there is no consensus on what the correct direction to go. 

Since the builders display a list of XFAIL tests they are by no means hidden. It just means they are expected failures. Now unexpected failures won't get mixed in with well known and expected failures.

Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5941

llvm-svn: 220512
2014-10-23 21:17:36 +00:00
Eric Fiselier dfbb5cddb4 Only link tests against -ldl on linux
llvm-svn: 220510
2014-10-23 20:45:37 +00:00
Justin Bogner acb64e8875 Make headers available in the build directory
This essentially re-does r194825 and makes it possible to run clang
with libc++ without having to install it, even if you don't have any
version of libc++ installed in /usr/.

This behaviour broke in r210577/r211629, which fixed pr18681.

llvm-svn: 220489
2014-10-23 16:51:12 +00:00
Eric Fiselier 83fb578e4e Add support for "fancy" pointers to promise and packaged_task.
Summary:
This patch is very closely related to D4859. Please see http://reviews.llvm.org/D4859 for more information.

This patch adds support for "fancy" pointers and allocators to promise and packaged_task. The changes made to support this are exactly the same as in D4859.



Test Plan: "fancy" pointer tests were added to each constructor affected by the change.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4862

llvm-svn: 220471
2014-10-23 06:24:45 +00:00
Eric Fiselier 319be72220 Add support for "fancy" pointers to shared_ptr. Fixes PR20616
Summary:
This patch add support for "fancy pointers/allocators" as well as fixing support for shared_pointer and "minimal" allocators.

Fancy pointers are class types that meet the NullablePointer requirements. In our case they are created by fancy allocators. `support/min_allocator.h` is an archetype for these types.

There are three types of changes made in this patch:
1. `_Alloc::template rebind<T>::other` -> `__allocator_traits_rebind<_Alloc, T>::type`. This change was made because allocators don't need a rebind template. `__allocator_traits_rebind` is used instead of `allocator_traits::rebind` because use of `allocator_traits::rebind` requires a workaround for when template aliases are unavailable.
2. `a.deallocate(this, 1)` -> `a.deallocate(pointer_traits<self>::pointer_to(*this), 1)`. This change change is made because fancy pointers aren't always constructible from raw pointers. 
3. `p.get()` -> `addressof(*p.get())`. Fancy pointers aren't actually a pointer. When we need a "real" pointer we take the address of dereferencing the fancy pointer. This should give us the actual raw pointer.

Test Plan: Tests were added using `support/min_allocator.h` to each affected shared_ptr overload and creation function. These tests can only be executed in C++11 or greater since min_allocator is only available then. A extra test was added for the non-variadic versions of allocate_shared. 

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4859

llvm-svn: 220469
2014-10-23 04:12:28 +00:00
Marshall Clow 3d541d12ed Fix a couple of failing tests for C++03 by checking for rvalue reference support first.
llvm-svn: 220465
2014-10-23 03:57:52 +00:00
Eric Fiselier 062e6ee121 Add -ldl to libc++ tests when sanitizers are used.
Clang 3.6 no longer links the sanitizer runtime library dependancies when
-nodefaultlibs is used. This patch manually links in a missing dependancy.

llvm-svn: 220463
2014-10-23 02:54:15 +00:00
Marshall Clow 79e23cb972 Some tests used __typeof__ instead of decltype. Replace these usages.
llvm-svn: 220296
2014-10-21 15:07:09 +00:00
Marshall Clow 450d430f55 LWG #2212 (not yet adopted) mandates that tuple_size/tuple_element are available if <array> or <utility> are included (not just <tuple>). We already do this. Add some tests to make sure that this remains true.
llvm-svn: 220295
2014-10-21 15:05:31 +00:00
Eric Fiselier d5a55037e1 Remove dead buildbot link
llvm-svn: 220260
2014-10-21 02:46:31 +00:00
Eric Fiselier a63c149ceb [libcxx] Redo adding support for building and testing with an ABI library not along linker paths
Summary:
This is the second attempt at allowing for the use of libraries that the linker cannot find. The first attempt used `CMAKE_LIBRARY_PATH` and `find_library` to select which ABI library should be used. There were a number of problems with this approach:

- `find_library` didn't work with cmake targets (ie in-tree libcxxabi build)
- It wasn't always possible to determine where `find_library` actually found your library.
- `target_link_libraries` inserted the path of the ABI library into libc++'s RPATH when `find_library` was used.
- Linking libc++ and it's ABI library is a special case. It's a lot easier to keep it simple. 

After discussion with @cbergstrum a new approach was decided upon.
This patch achieve the same ends by simply using `LIBCXX_CXX_ABI_LIBRARY_PATH` to specify where to find the library (if the linker won't find it). When this variable is defined it is simply added as a library search path when linking libc++. It is a lot easier to duplicate this behavior in LIT. It also prevents libc++ from being linked with an RPATH.






Reviewers: mclow.lists, cbergstrom, chandlerc, danalbert

Reviewed By: chandlerc, danalbert

Subscribers: chandlerc, cfe-commits

Differential Revision: http://reviews.llvm.org/D5860

llvm-svn: 220157
2014-10-19 00:42:41 +00:00
Eric Fiselier ac97f7ce7c Fix unused variables in tests to placate scan-build. Patch from Steve MacKenzie.
llvm-svn: 220154
2014-10-19 00:10:15 +00:00
Marshall Clow c8528b5001 Whitespace maintenance. Remove a bunch of tabs that snuck in. No functionality change
llvm-svn: 220142
2014-10-18 11:03:33 +00:00
Eric Fiselier a38dd8aad2 Add special case for finding the in-tree ABI library.
When libcxx is built in-tree with libcxxabi it links against libcxxabi using
the name of the cmake target and not the actual library name. The cmake target
will not work with `find_library()`, so it needs special case handling.

llvm-svn: 220121
2014-10-18 02:19:28 +00:00
Eric Fiselier 6f9da55c0f [libcxx] Add support for building and testing with an ABI library not along linker paths
Summary:
This patch adds support for building/testing libc++ with an ABI library that the linker would not normally find.

- `CMAKE_LIBRARY_PATH` is used to specify the list of search directories.
- The ABI library is now found using `find_library` instead of assuming its along the linker's search path.
- `CMAKE_LIBRARY_PATH` is passed to our LIT config as `library_paths`.
- For each path in `library_paths` the following flags are added `-L<path> -Wl,-rpath -Wl,<path>`

Some changes in existing behavior were also added:
- `target_link_libraries` is now passed the ABI library file instead of the library name. Ex `target_link_libraries(cxx "/usr/lib/libc++abi.so")` vs `target_link_libraries(cxx "c++abi")`.
- `-Wl,-rpath -Wl,<path>` is now used on OSX to link to libc++ instead of env['DYLD_LIBRARY_PATH'] if `use_system_lib=False`.




Reviewers: mclow.lists, danalbert, EricWF

Reviewed By: EricWF

Subscribers: emaste, cfe-commits

Differential Revision: http://reviews.llvm.org/D5038

llvm-svn: 220118
2014-10-18 01:15:17 +00:00
Eric Fiselier 07df631129 [libcxx] Fix SFINAE in <cmath>. Patch from K-Ballo.
Delay instantiation of `__numeric_type` within <cmath>, 
don't instantiate it when the `is_arithmetic` conditions do not hold as it causes
errors with user-defined types with ambiguous conversions. Fixes PR21083.

llvm-svn: 219998
2014-10-17 00:31:47 +00:00
Eric Fiselier 04c1b74cb8 [libcxx] Add support for LLVM_USE_SANITIZER=Undefined
LLVM_USE_SANITIZER=Undefined support was added to the LLVM CMake configuration.
Update libc++'s handling of LLVM_USE_SANITIZER to support this as well.

llvm-svn: 219987
2014-10-16 23:21:59 +00:00
Eric Fiselier ce842e8c4a Fix bad link in documentation. Thanks to rsmith
llvm-svn: 219898
2014-10-16 03:15:31 +00:00
Eric Fiselier 8c5bc1cb5f Add my buildbot to list of libc++ buildbots in documentation
llvm-svn: 219894
2014-10-16 02:48:59 +00:00
Marshall Clow 14c5ec5194 Fixes PR21157 'tuple: non-default constructible tuple hard failure' Thanks to Louis Dionne for the bug report and the patch.
llvm-svn: 219785
2014-10-15 10:33:02 +00:00
Marshall Clow a2a481e0e3 Fix for PR 19616: 'tuple_cat of nested tuples fails in noexcept specification'. Thanks to Louis Dionne for the fix.
llvm-svn: 219243
2014-10-07 21:42:12 +00:00
Dan Albert cfc9229966 Fix win32 support header for mingw32.
These functions are defined as static in the mingw32 headers.

llvm-svn: 219140
2014-10-06 20:06:33 +00:00
Nico Weber 28d692d30e Mark module atomic as cplusplus11.
With clang, the header atomic requires __has_feature(cxx_atomic), which is only
true in c++11 mode. Because of this, when using modules in c++98 with libc++
compilation of the std module would fail without this change, PR21002.

(With gcc, only gcc4.7+ is needed, no c++11. But gcc doesn't have modules yet,
and the module.modulemap language can't express things like "this is only
required if the compiler is clang". If gcc gets module support, we'd probably
have a module.modulemap file for each compiler that libc++ supports?)

llvm-svn: 218372
2014-09-24 04:44:54 +00:00
Eric Fiselier 2b232cf06c [libcxx] Fix installation of ABI headers. Fixes PR20936
Summary:
I changed the build so that each ABI header gets its own install rule. This gives us the flexibility to install different headers in different directories. 
This also fixes the problem where libstdc++ bits/<header>'s were not being installed under a bits directory.

Test Plan: I tested this patch on linux against libstdc++ and libcxxabi.

Reviewers: danalbert, mclow.lists, jroelofs

Reviewed By: jroelofs

Subscribers: jhunold, cfe-commits

Differential Revision: http://reviews.llvm.org/D5454

llvm-svn: 218309
2014-09-23 14:42:28 +00:00
Marshall Clow 0f79772ecc Fix some type-traits (is_assignable, etc) dealing with classes that take non-const references as 'right hand side'. Add tests. Fixes PR# 20836
llvm-svn: 218286
2014-09-22 23:58:00 +00:00
Jonathan Roelofs 4f1561a5dd Support newlib as libc++'s C library [locale part]
http://reviews.llvm.org/D5385

llvm-svn: 218144
2014-09-19 20:09:12 +00:00
Marshall Clow 3c71bff667 Fix PR#20843: binomial_distribution<unsigned> is broken. Add test to ensure that signed and unsigned verstions produce the same sequence.
llvm-svn: 217976
2014-09-17 18:33:58 +00:00
Dan Albert 353f358d24 Fix char_traits functions for GCC compatibility.
GCC 4.9 fails to inline these functions at -O1 because they are used
indirectly. Declare them as inline instead of always_inline. Discussion
in GCC bugreport: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63220

llvm-svn: 217961
2014-09-17 16:34:29 +00:00
Marshall Clow 29298664d9 Add include of <cassert> for the operator comma
llvm-svn: 217938
2014-09-17 04:09:35 +00:00
Marshall Clow 85d5e6f25b K-ballo pointed out *another* mistype in my change
llvm-svn: 217936
2014-09-17 01:58:15 +00:00
Marshall Clow bd7c7b5551 Fix for mismatch to handle evil iterators which overload operator comma
llvm-svn: 217903
2014-09-16 20:40:05 +00:00
Marshall Clow f1e473bad9 Create a 'comma_iterator' class that overloads operator, and asserts when it's called. Add tests to mismatch to make sure it can't be blindsided by such an evil iterator. More tests for other algorithms forthcoming. Thanks to STL for pointing this out at CppCon and Yakov Galka for opening LWG issue #2133
llvm-svn: 217902
2014-09-16 20:38:11 +00:00
Marshall Clow d1b5078579 Fix a bug in the move-assigment operator for basic_stringbuf. Thanks to Johnathan Wakeley for the bug report
llvm-svn: 217894
2014-09-16 18:57:52 +00:00
Marshall Clow 10a65e2ee1 Thanks to K-ballo for noting a second incorrect noexcept clause in tuple - and suggesting a more correct way to write the first
llvm-svn: 217884
2014-09-16 17:08:21 +00:00
Marshall Clow 3175f49d33 Fix a bad noexcept clause in tuple's move constructor
llvm-svn: 217878
2014-09-16 15:36:14 +00:00
Marshall Clow 30d0c1ab5f Forgot 'const' on my last checkin
llvm-svn: 217877
2014-09-16 15:33:53 +00:00
Marshall Clow f45b237c51 Some of the synopsis was left out of these headers, and the copy construction/assignment should have been marked as deleted. Done. No functionality change, because the base class (base_ios) was marked as non-copyable already.
llvm-svn: 217876
2014-09-16 15:27:01 +00:00
Dan Albert 0bb696800f PR20546: Fix tests for compare_exchange_weak.
These calls are allowed to fail spuriously.

29.6.5.25:

    Remark: A weak compare-and-exchange operation may fail spuriously.
    That is, even when the contents of memory referred to by expected
    and object are equal, it may return false and store back to expected
    the same memory contents that were originally there. [ Note: This
    spurious failure enables implementation of compare and-exchange on a
    broader class of machines, e.g., load-locked store-conditional
    machines. A consequence of spurious failure is that nearly all uses
    of weak compare-and-exchange will be in a loop.

To fix this, we replace any assert() that expects
std::atomic::compare_exchange_weak() to return true with a loop. If the
call does not return true within N runs (with N currently equal to 10),
then the test fails.

http://llvm.org/bugs/show_bug.cgi?id=20546

llvm-svn: 217319
2014-09-06 20:38:25 +00:00
Jonathan Roelofs afe6794bc2 Address some post-commit review comments on r217261
llvm-svn: 217276
2014-09-05 20:28:44 +00:00
Jonathan Roelofs b3fcc67f8f Allow libc++ to be built on systems without POSIX threads
If you're crazy enough to want this sort of thing, then add
-D_LIBCPP_HAS_NO_THREADS to your CXXFLAGS and
--param=additiona_features=libcpp-has-no-threads to your lit commnad line.

http://reviews.llvm.org/D3969

llvm-svn: 217271
2014-09-05 19:45:05 +00:00
Jonathan Roelofs b352db7f57 Bugfix: allow additional_features to be empty
llvm-svn: 217268
2014-09-05 19:03:46 +00:00
Jonathan Roelofs 3547c5441e Set -D_LIBCPP_HAS_NO_THREADS and -D_LIBCPP_HAS_NO_MONOTONIC_CLOCK based on available_features
http://reviews.llvm.org/D5214

llvm-svn: 217261
2014-09-05 17:21:57 +00:00
Viktor Kutuzov d3b10d9daf Define ELAST in libcxx's config header on FreeBSD
Differential Revision: http://reviews.llvm.org/D5165

llvm-svn: 217146
2014-09-04 13:25:46 +00:00
Marshall Clow b67bc4ea0d Make the ASAN RAII object a nop when building w/o ASAN
llvm-svn: 217082
2014-09-03 21:37:43 +00:00
Jonathan Roelofs 3bb7b558df Detection for _LIBCPP_HAS_NO_MONOTONIC_CLOCK caused several more build breakages
Remove it for now. This flag can be set in build scripts instead.

llvm-svn: 217061
2014-09-03 18:48:28 +00:00
Alexey Volkov e46ca71f0b Allow libc++ to be built with GCC 5.0 compiler
Differential Revision: http://reviews.llvm.org/D5169

llvm-svn: 217038
2014-09-03 14:30:39 +00:00
Justin Bogner 2cfd1fed21 test: Make it possible to opt in to use_clang_verify per test
This modifies the use_clang_verify parameter I added in r217009 to
only apply to tests that specifically ask for it via // USE_VERIFY.
This allows us to incrementally convert tests, but start enjoying the
benefits right away.

Suggested by Eric Fiselier in code review.

llvm-svn: 217017
2014-09-03 06:01:52 +00:00
Eric Fiselier 99ff9c7bb2 Fix buffer overflow issue in valarray test
llvm-svn: 217012
2014-09-03 05:47:35 +00:00
Justin Bogner 33a2a2ed1a test: Allow using clang -verify for failures rather than exit 1
Currently, failure tests work by checking that compilation exits 1.
This can lead to tests that fail for the wrong reason, so it'd be
preferable to convert them to check for specific errors.

This adds use_clang_verify parameter that runs failure tests using
clang's -verify flag. I'll convert some tests in subsequent commits,
and once all of the tests are converted we should key this on whether
cxx_under_test is clang.

I've also converted one of the unique.ptr tests, since it's the one
that motivated the idea of using clang -verify when possible in the
review of r216317.

llvm-svn: 217009
2014-09-03 04:32:08 +00:00
Jonathan Roelofs 112237b476 Fix yet another aspect of the build breakage caused by r216949
llvm-svn: 217001
2014-09-03 00:29:02 +00:00
Jonathan Roelofs ffa0895c3b Fix comment that was obsoleted by r216949
llvm-svn: 216999
2014-09-02 23:52:46 +00:00
Jonathan Roelofs bb8fd4ccdb Fix build breakage introduced in r216949
The bug shows up on systems that `#define _POSIX_CLOCK_MONOTONIC 0` to indicate
that users of CLOCK_MONOTONIC must check sysconf at runtime.

See: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html
llvm-svn: 216997
2014-09-02 23:49:15 +00:00
Kostya Serebryany 3f0e834842 [asan] Make vector asan annotations exception-friendly
Fix vector asan annotations with RAII.
Add a test.
Also, remove one dead function.
Review: http://reviews.llvm.org/D4170

llvm-svn: 216995
2014-09-02 23:43:38 +00:00
Jonathan Roelofs 6ca513c913 Silence _LIBCPP_ELAST porting warning on __APPLE__
This fixes a warning accidentally introduced in r216943.

llvm-svn: 216977
2014-09-02 22:09:50 +00:00
Jonathan Roelofs f4bc679cad Don't #define _LIBCPP_HAS_NO_MONOTONIC_CLOCK on __APPLE__
This fixes PR20839, which was a bug in r216949.

llvm-svn: 216975
2014-09-02 21:56:01 +00:00
Jonathan Roelofs c59e585126 Partially address a FIXME in steady_clock::now()
http://reviews.llvm.org/D4045

llvm-svn: 216949
2014-09-02 21:14:38 +00:00
Jonathan Roelofs a409d59cf5 Newlib names ELAST differently than linux
llvm-svn: 216943
2014-09-02 20:34:23 +00:00
Marshall Clow bbb3a7f51c Fix PR#20834 - 'is_trivially_destructible yeilds wrong answer for arrays of unknown bound' Thanks to K-ballo for the bug report. Update a few of the other tests while we're here, and fix a typo in a test name.
llvm-svn: 216909
2014-09-02 16:19:38 +00:00
Eric Fiselier 7d1c2d8878 Mark test types for <atomic> nothrow default constructible. Patch from Steve MacKenzie.
The way the standard currently specifies the default constructor for atomic<T>
requires T to be nothrow default constructible. This patch makes our test types
meet this requirement.

Note: The nothrow default constructible requirment is subject to the outcome of
LWG issue 1265.

llvm-svn: 216561
2014-08-27 17:00:11 +00:00
Jonathan Roelofs 5bf9c8a2e8 Rename arguments in include/cmath to work around Newlib macro implementation using these particular names
http://reviews.llvm.org/D5080

llvm-svn: 216548
2014-08-27 14:05:20 +00:00
Jonathan Roelofs 16bb38907c Revert r216497: "[libcxx] Fix ctype_byname<wchar_t>::do_is() mask checking."
After discussing implementing more tests for this with @danalbert & @mclow, I
realized this change is not correct.

The C++ standard requires do_is() to behave as if it were a loop that checked
is(). Furthermore, it requires is() to check "The first form returns the result
of the expression (M & m) != 0; i.e., true if the character has the
characteristics specified"... which the reverted patch definitely does not
conform to. Even further, furthermore, this requires that ctype's mask be an
actual bitmask, unlike what android and newlib provide for _ctype_.

Fixing the original bug that instigated this patch remains TBD.

llvm-svn: 216508
2014-08-27 00:39:47 +00:00
Jonathan Roelofs 67d629889e [libcxx] Fix ctype_byname<wchar_t>::do_is() mask checking.
This patch: http://reviews.llvm.org/D5081
Original patch: http://reviews.llvm.org/D5071 (from @danalbert)

llvm-svn: 216497
2014-08-26 22:29:00 +00:00
Marshall Clow d08f0d9c05 Replace 'noexcept' with '_NOEXCEPT' in <shared_mutex>. This allows us to build the dylib with MSVC, which doesn't support noexcept (sheesh\!). Thanks to K-ballo for the report.
llvm-svn: 216384
2014-08-25 14:53:16 +00:00
Marshall Clow 0aacbc92df Fix bug 20740 - std::set/std::map don't support heterogeneous lookup for count(). Thanks to Jim Porter for the bug report
llvm-svn: 216353
2014-08-24 23:54:16 +00:00
Eric Fiselier 1f7bd5f24d Fix assignments that should be comparisons x3
llvm-svn: 216318
2014-08-23 07:55:29 +00:00
Eric Fiselier 67c94867ba Add return statement to a test class's assignment operator. Defect found by Coverity Scan.
llvm-svn: 216317
2014-08-23 06:36:11 +00:00
Eric Fiselier 916223b61f [libcxx] Add --show-unsupported and --show-xfail to check-libcxx's default LIT args.
Summary:
In order to gather more information about testsuite results these flags should be added to LIT's default args.
These new switches were recently added to LIT. It been more than two weeks since both switches were added.
I think its time we add these to our LIT flags.


Reviewers: mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5037

llvm-svn: 216315
2014-08-23 04:33:20 +00:00
Eric Fiselier 561dfb57fc Fix handling of format strings to work with python 2.6
llvm-svn: 216314
2014-08-23 04:02:21 +00:00
Dan Albert ae2526b4cd Refactor lit.cfg.
The purely imperative format of the configuration performed in lit.cfg
was making merge conflicts with changes I have for Android an
unbelievable pain in the ass. I've moved all of the configuration into a
Configuration class, with each piece of configuration happening in a
different method. This way I can avoid merge conflicts, and any new
features that get added (as have been done with the sanitizers, the -std
flag, etc.) can be easily applied to Android as well.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Differential Revision: http://reviews.llvm.org/D4952

llvm-svn: 216196
2014-08-21 17:30:44 +00:00
Eric Fiselier 700c58b1c5 Add self to credits
llvm-svn: 216154
2014-08-21 04:21:43 +00:00
Eric Fiselier 43e866a136 Mark some localization time tests as XFAIL on linux.
This marks some of the localization test XFAIL on linux.
There has been some discussion on D4861 about doing this.
Please let me know if any of these tests for you on linux.

llvm-svn: 216151
2014-08-21 02:38:21 +00:00
Eric Fiselier df5efb9a51 Mark some localization monetary tests as XFAIL on linux.
This marks some of the localization test XFAIL on linux.
There has been some discussion on D4861 about doing this.
Please let me know if any of these tests for you on linux.

llvm-svn: 216150
2014-08-21 02:22:54 +00:00
Eric Fiselier 65b31a903b Mark localization ctype tests as XFAIL on linux.
This marks some of the localization test XFAIL on linux.
There has been some discussion on D4861 about doing this.
Please let me know if any of these tests for you on linux.

llvm-svn: 216148
2014-08-21 02:03:01 +00:00
Eric Fiselier ab79a7a98b fix missing include for ::close in platform_support.h
llvm-svn: 215998
2014-08-19 17:52:40 +00:00
Eric Fiselier ca39572270 Add extra test case for PR20345. Should have been commited with r215984
llvm-svn: 215985
2014-08-19 16:33:05 +00:00
Eric Fiselier 0acf0d2701 Fix is_member_function_pointer does not account for ellipsis. PR20345. Patch from Agustin Berge.
I reviewed the patch and added the test cases.

llvm-svn: 215984
2014-08-19 16:31:47 +00:00
Jonathan Roelofs 1542a60c0b Give libcxx tests temporary filenames that are actually unique.
This fixes a race condition on temp file name creation.

http://reviews.llvm.org/D4962

llvm-svn: 215977
2014-08-19 13:56:56 +00:00
Eric Fiselier 59174710d5 Add standard version to lit.cfg's available features
llvm-svn: 215885
2014-08-18 07:05:40 +00:00
Eric Fiselier 8f2a62ed6b Update linux test results
llvm-svn: 215884
2014-08-18 06:53:30 +00:00
Eric Fiselier 339bdc3be9 [libcxx] Add UNSUPPORTED tag to lit. It mirrors REQUIRES.
Summary:
This patch adds support for // UNSUPPORTED: feature. If an excluded feature is found in the list of available features then the test is marked unsupported.

I hope to use this to mark test unsupported if the fail with msan on asan. As well as tests that fail in particular standard modes.


Reviewers: mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4950

llvm-svn: 215883
2014-08-18 06:43:06 +00:00
Eric Fiselier cd6ac3a3a7 [libcxx] Add list of currently known buildbots to libc++ homepage
Summary:
Instead of having to update test results for different platforms it would be helpful to just supply links to buildbots that build+test libcxx.
For the FreeBSD bots Pawel Worach gave me the OK to link to them.

Reviewers: mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4947

llvm-svn: 215882
2014-08-18 05:25:04 +00:00
Eric Fiselier 3faba8d464 Mark cuchar tests as always xfail since we don't provide the header'
llvm-svn: 215873
2014-08-18 05:09:51 +00:00
Eric Fiselier 0058c80cc7 [libcxx] Add support for LLVM_USE_SANITIZER to libcxx when being built standalone and in-tree
Summary:
This patch adds support for LLVM_USE_SANITIZER when being built in-tree and standalone. 

This patch does the following things:
1. define the LLVM_USE_SANITIZER option to "" when being built standalone. This also helps show we support it.
2. Translate LLVM_USE_SANITIZER when standalone in a very similar way done in llvm/cmake/HandleLLVMOptions.cmake.
3. Add config.llvm_use_sanitizer to lit.site.cfg.in
4. Add code to translate config.llvm_use_sanitizer's value into the needed compile flags in lit.cfg.

Currently lit.cfg assumes that that the compiler supports '-fno-omit-frame-pointer' while CMakeLists.txt actually checks to see if its supported. We could pass this information to lit but I'm not sure its needed. 

Reviewers: mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4949

llvm-svn: 215872
2014-08-18 05:03:46 +00:00
Eric Fiselier 1b44db22c6 [libcxx] Update the way the -std= flag is chosen by CMake and LibcxxTestFormat
Summary:
This patch does two things:
CMake Update:
  - Add compiler flag checks for -std=c++11 and -std=c++1y and remove check for -std=c++0x.
  - Add configuration option LIBCXX_ENABLE_CXX1Y to prevent/allow -std=c++1y from being chosen as the std version. LIBCXX_ENABLE_CXX1Y is set to OFF by default.
  - if LIBCXX_ENABLE_CXX1Y is enabled then set LIBCXX_STD_VERSION to c++1y and fail if the compiler does not support -std=c++1y
  - If c++1y is not enabled then use c++11 and fail if the compiler does not support c++11.

Lit Update:
  - Update lit.site.cfg.in to capture LIBCXX_STD_VERSION information as config.std.
  - Remove mentions of has_cxx0X configuration option.
  - Check for `--param std=X' passed to lit on the command line.
  - Choose the std for the tests either from command line parameter or (if it doesn't exist) the lit.site.cfg.



Reviewers: mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: emaste, rnk, ajwong, danalbert, cfe-commits

Differential Revision: http://reviews.llvm.org/D4329

llvm-svn: 215802
2014-08-16 01:35:36 +00:00
Eric Fiselier 983484fb11 Readding FreeBSD support to lit.cfg. Patch from Pawel Worach.
Pawel has been using this patch on his buildbots for a while. This should
allow the testsuite to run on FreeBSD with libcxxrt.

llvm-svn: 215787
2014-08-15 23:24:00 +00:00
Jonathan Roelofs f11170406e Tame a few enum size tests when using -fshort-enums on ARM.
llvm-svn: 215769
2014-08-15 21:34:52 +00:00
Eric Fiselier db36dc23e4 Revert get testsuite running on FreeBSD.
There is a similar patch up for review. I'll submit my changes via that.

llvm-svn: 215750
2014-08-15 18:49:28 +00:00
Eric Fiselier 1a0b735340 Get testsuite running on FreeBSD.
Add initial support for using LIT to run the tests on FreeBSD. 
More work may need to be done to add support for FreeBSD but this is a
good initial step.

llvm-svn: 215742
2014-08-15 18:00:47 +00:00
Justin Bogner d2308ea5fd Revert "Turn off extern templates for most uses."
Turning off explicit template instantiation leads to a pretty
significant build time and code size cost. We're better off dealing
with ABI incompatibility issues that come up in a less heavy handed
way.

This reverts commit r189610.

llvm-svn: 215740
2014-08-15 17:58:56 +00:00
Eric Fiselier d237ac80f9 Fix incorrect locale requirements in tests
llvm-svn: 215694
2014-08-15 05:02:05 +00:00
Eric Fiselier e3981b8fac Add bare_allocator archetype that implements the minimal possible allocator interface.
llvm-svn: 215691
2014-08-15 04:15:41 +00:00
Hans Wennborg 4714826262 [libc++] Fix the CMake build on Mac when setting MACOSX_DEPLOYMENT_TARGET=10.6
The build file was trying to use LIBCXX_VERSION, which isn't set
anywhere, and also forgot to split the 'compile_flags' list.

Differential Revision: http://reviews.llvm.org/D4860

llvm-svn: 215463
2014-08-12 17:32:07 +00:00
Eric Fiselier 90e0867742 Change two tests to be less dependant on locales.
This patch removes the use of the "%c" specifier for getting/setting times.
The semantics of this specifier differ between linux and Mac. I don't believe
the use of this specifier was important to the test.

The following tests now pass on linux.
test/input.output/iostream.format/ext.manip/get_time.pass.cpp
test/input.output/iostream.format/ext.manip/put_time.pass.cpp

llvm-svn: 215417
2014-08-12 00:48:56 +00:00
Eric Fiselier 981a64c380 Add return statement to slice_array and mask_array assignment. Closes PR20614.
This patch just adds the required return statements to slice_array::operator=
and mask_array::operator=.

Tests were added to check that the return value is the same as the object assigned
to.

llvm-svn: 215414
2014-08-12 00:06:58 +00:00
Dan Albert ec4de787e2 Update libc++ docs to include instructions for LIT.
Okay, so this actually does more than just that. I've rearranged most of
the information on the page to try to make it more helpful and flow
better.  Essentially, the differences between Mac and Linux, the various
ABI libraries, and in-tree versus out-of-tree builds were cluttering
things. To clean up, I've done the following:

 * Only describe the cmake process. buildit doesn't work out of the box
   on Linux, and we need to stop having duplicates for every process.
 * Use libc++abi for the default instructions. This works on the major
   platforms.
 * Describe both in-tree and out-of-tree builds. Previously it wasn't
   clear that in-tree builds were even possible for libc++.
 * Separate the documentation about using libc++ from that about
   building and testing libc++.

llvm-svn: 215358
2014-08-11 15:12:46 +00:00
Eric Fiselier c1bd9197eb NFC. Move definition of _LIBCPP_ASSERT into __debug header and remove external include guards.
Things done in this patch:

1. Make __debug include __config since it uses macros from it.

2. The current method of defining _LIBCPP_ASSERT is prone to redefinitions. Move
the null _LIBCPP_ASSERT definition into the __debug header to prevent this.

3. Remove external <__debug> include gaurds. <__debug> guards almost all of its
contents internally. There is no reason to be doing it externally.

This patch should not change any functionality.

llvm-svn: 215332
2014-08-10 23:53:08 +00:00
Eric Fiselier 399e99ae75 fix stdio.h test to reflect removal of ::gets in c++14
llvm-svn: 215329
2014-08-10 22:39:11 +00:00
Eric Fiselier 04c39ece80 NFC. Remove trailing whitespace and tabs.
llvm-svn: 215326
2014-08-10 20:56:31 +00:00
Dan Albert 502dca7bb0 Emulate clang atomic built-ins on gcc > 4.7
gcc 4.7 and above has atomic built-ins which slightly different APIs
from those provided by clang. Add proxy functions that wrap the gcc
built-ins to produce a symbol that is API equivalent to the clang
built-ins. This allows libc++'s atomic library to be used with gcc-4.7
and newer.

Patch contributed by Albert Wong.

llvm-svn: 215305
2014-08-09 23:51:51 +00:00
David Blaikie c6dbc22b9b Revert "Add some extra checks to the MoveOnly test class to ensure it is not constructed or assigned from in a moved-from state."
Premature commit due to misreading CR feedback.

This reverts commit r215301.

llvm-svn: 215302
2014-08-09 22:42:19 +00:00
David Blaikie f63d5fa236 Add some extra checks to the MoveOnly test class to ensure it is not constructed or assigned from in a moved-from state.
Some tests were constructing it with 0, so use -1 as the invalid state
instead.

Reviewers: Marshall Clow

Differential Revision: http://reviews.llvm.org/D4095

llvm-svn: 215301
2014-08-09 22:35:47 +00:00
Eric Fiselier f5f5862a27 fix copy and pasted comment in test
llvm-svn: 215276
2014-08-09 02:43:16 +00:00
Eric Fiselier 95b0d0f888 Mark math.h and cmath tests as xfail on linux.
These tests were marked as failing because the libc implementation does not
use the proper return type on certain math functions. There is other weirdness
that prevents us from defining our own version of these functions.

The failing tests in cmake were separated into their own files so that the rest
failures in the rest of the cmath tests were not hidden.

This was not done for the math.h test since we don't actually supply math.h

llvm-svn: 215275
2014-08-09 02:39:03 +00:00
Marshall Clow 99d2df956d Apply a similar fix to <forward_list> as I did for <list> in r215210. Again, thanks to Ion Gaztañaga for noticing this problem w.r.t LWG#526
llvm-svn: 215213
2014-08-08 15:58:00 +00:00
Marshall Clow ced70066c2 While reading LWG#526, Ion Gaztañaga noticed that libc++ didn't correctly handle list::remove(const value_type &x), if x was an element of the list. Added a test for this, and a fix. Thanks to Ion for the report.
llvm-svn: 215210
2014-08-08 15:35:52 +00:00
Viktor Kutuzov 88d6dc962a Fix re-building in-tree libc++ against in-tree libc++abi
Differential Revision: http://reviews.llvm.org/D4805

llvm-svn: 215186
2014-08-08 06:53:30 +00:00
Marshall Clow 28d65da618 dit pointed out on IRC that '__i = _VSTD::next(__i)' was a very long-winded way of writing '++__i'. Since I hate being thought of as long-winded (this checkin comment notwithstanding), I fixed it. No functionality change.
llvm-svn: 214834
2014-08-05 01:34:12 +00:00
Dan Albert 48e28e09bb Fix typo.
llvm-svn: 214768
2014-08-04 20:27:45 +00:00
Marshall Clow 89872e99a5 Fix a problem with reference_wrapper in C++03 that was causing counting predicates to fail. Add a test to make sure it works. However, most of the reference_wrapper tests still fail in C++03 mode, due to a lack of decltype. No change there.
llvm-svn: 214760
2014-08-04 19:20:17 +00:00
Dan Albert a85b27f6f7 Add locales to available_features for tests.
Linux has a lot of failures caused by not having support for certain
locales. Since these come out as a lot of noise in the test results,
have lit.cfg detect the presence of the various locales used in the
tests and add them to config.available_features as locale.LOCALE_NAME.

This patch also adds REQUIRES: locale.REQUIRED_LOCALE to every test that
I saw failing in this manner. We probably need to add more for all the
tests requiring en_US.UTF-8, but we can do that on an as-needed basis.

One thing that concerns me is how many tests get skipped because of
missing locales (especially in regex/). We should make a point of
splitting up any tests that test default behavior _and_ behavior under a
given locale so that we aren't losing coverage for default behavior.

llvm-svn: 214753
2014-08-04 18:44:48 +00:00
Marshall Clow 90ba0533cd Fix PR#202520 - predicate called too many times in list::remove_if. Add tests for list, forward_list, and the std::remove_if algorithm
llvm-svn: 214736
2014-08-04 17:32:25 +00:00
Dan Albert b9dbbba6cb Obey LLVM_LIBDIR_SUFFIX.
llvm-svn: 214726
2014-08-04 16:13:32 +00:00
Eric Fiselier 58fab766e6 Adding ABI information to linux test results
llvm-svn: 214484
2014-08-01 06:30:18 +00:00
Eric Fiselier ae9acb8273 Update information about compiler used during linux tests and reformat run information.
llvm-svn: 214483
2014-08-01 06:27:40 +00:00
Eric Fiselier 9cd8ed4e23 Update linux test results file
llvm-svn: 214474
2014-08-01 01:59:09 +00:00
Eric Fiselier 993dfb1eef Change lit.cfg to allow whitespace before comments
llvm-svn: 214454
2014-07-31 22:56:52 +00:00
Dan Albert ea32c105a6 Make Android's ctype_base::mask unsigned.
Keeping the regex code sane is much easier if we match the other
platforms and use an unsigned mask.

llvm-svn: 214442
2014-07-31 21:04:08 +00:00
Eric Fiselier 6d3bd8f7ec [libcxx] Remove use of default function template parameters in type traits. Fixes DR20484
Summary: This patch moves the SFINAE for __is_destructor_welformed out of the function template parameters. type_traits must compile in c++03 mode since it is included in c++03 headers. 

Test Plan: No tests have been added.

Reviewers: danalbert, mclow.lists

Reviewed By: danalbert

Subscribers: K-ballo, cfe-commits

Differential Revision: http://reviews.llvm.org/D4735

llvm-svn: 214422
2014-07-31 19:09:26 +00:00
Marshall Clow 2628dbb214 Add test cases for creating atomic types for trivially copyable types.
llvm-svn: 214406
2014-07-31 15:20:48 +00:00
Marshall Clow 6a577a819f Fix numeric_limits<XXX>::is_modulo for signed arithmetic types. We were reporting true, for all arithmetic types, which is incorrect. Fix the tests which were wrong, too. This fixes PR#20158.
llvm-svn: 214371
2014-07-31 01:18:05 +00:00
Marshall Clow 81f051cd10 std::once_flag was forward declared with _LIBCPP_TYPE_VIS decoration, and the defined with _LIBCPP_TYPE_VIS_ONLY decoration. Make them match
llvm-svn: 214219
2014-07-29 21:05:31 +00:00
Dan Albert 15c010a37e Base regex code on char_class_type.
__get_classname() and __bracket_expression were assuming that
char_class_type was ctype_base::mask rather than using
regex_traits<_CharT>::char_class_type.

This change allows char_class_type to be defined to something other than
ctype_base::mask so that the implementation will still work for
platforms with an 8-bit ctype mask (such as Android and OpenBSD).

llvm-svn: 214201
2014-07-29 19:23:39 +00:00
Alexey Samsonov 9d7323eca3 Fix linking with just-built libc++abi (added in r214037).
Pass target name ("cxxabi") to target_link_libraries(cxx ...) to ensure
that linker is able to locate just-built libc++abi in the build tree,
instead of relying on "-lc++abi" linker flag.

llvm-svn: 214114
2014-07-28 19:25:44 +00:00
Marshall Clow 51510e7f4c Fix PR#20471. Add a cast in __align_it to ensure that the bit twiddling is done at the correct size. A better solution, IMHO, would be to declare vector<bool>::__bits_per_word as 'size_type', rather than 'unsigned', but that's a possible ABI change.
llvm-svn: 214088
2014-07-28 15:02:42 +00:00
Dan Albert 55d029e6ae Better defaults for in-tree libc++ with cmake.
This will detect if you are building libcxx in-tree and libcxxabi is
available.  If so, it will default to using the in-tree libcxxabi by
setting LIBCXX_CXX_ABI to "libcxxabi", LIBCXX_LIBCXXABI_INCLUDE_PATHS to
"${CMAKE_SOURCE_DIR}/projects/libcxxabi/include" and will add "cxxabi"
as a proper dependency.

Patch by Russell Harmon.

llvm-svn: 214037
2014-07-26 23:08:33 +00:00
Eric Fiselier aa873af53d [libcxx] expose experimental::erased_type for all standard versions.
Summary: The polymorphic allocator implementation would greatly benefit by defining virtual functions in the dynlib instead of inline. In order to do that some types are going to have to be available outside of c++1y. This is the first step.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4554

llvm-svn: 213889
2014-07-24 19:17:38 +00:00
Eric Fiselier 567bb79bf2 D4451: Fix copy/move issues casude by __tuple_leafs's converting constructor
llvm-svn: 213888
2014-07-24 18:48:34 +00:00
Eric Fiselier d1854f9cb1 test commit
llvm-svn: 213887
2014-07-24 18:41:56 +00:00
Dan Albert a950658e3c Fix ctype_base::xdigit for Android.
Android's ctype implementation comes from openbsd, which for some reason
doesn't consider numbers to be hex digits.

llvm-svn: 213785
2014-07-23 19:32:03 +00:00
Marshall Clow 8116e1d1c3 Update the synopsis and comments with the results of LWG #2255. No code to back it up at the moment; just comments
llvm-svn: 213768
2014-07-23 16:58:25 +00:00
Dan Albert 4339903c94 Fix classic_locale for Android.
Android's classic_locale begins at _ctype_ + 1.

llvm-svn: 213672
2014-07-22 17:32:56 +00:00
David Majnemer 8b51260274 Fix std::make_heap's worst case time complexity
std::make_heap is currently implemented by iteratively applying a
siftup-type algorithm.  Since sift-up is O(ln n), this gives
std::make_heap a worst case time complexity of O(n ln n).

The C++ standard mandates that std::make_heap make no more than O(3n)
comparisons, this makes our std::make_heap out of spec.

Fix this by introducing an implementation of __sift_down and switch
std::make_heap to create the heap using it.
This gives std::make_heap linear time complexity in the worst case.

This fixes PR20161.

llvm-svn: 213615
2014-07-22 06:07:09 +00:00
Marshall Clow f915d67c60 make the same change as in 213546 for vector<bool>
llvm-svn: 213547
2014-07-21 15:15:15 +00:00
Marshall Clow 0df880209d In response to bug #20362, change the order of operations in vector move assignment so that if the allocator move assignment throws, we aren't left with two objects pointing at the same memory. This is not a complete fix; I am unconvinced that a complete fix is possible. With this change in place, we will leak the old contents of the vector. LWG issue #2106, when adopted, will make this problem illegal. Thanks to Thomas Koeppe for the report and analysis.
llvm-svn: 213546
2014-07-21 15:11:13 +00:00
Marshall Clow 3dd8846840 Fix bug #20335 - memory leak when move-constructing a string with unequal allocator. Thanks to Thomas Koeppe for the report
llvm-svn: 213269
2014-07-17 15:32:20 +00:00
Eric Fiselier 531d8b2bc4 [libcxx] Add <experimental/utility> header for LFTS.
Summary:
This patch adds the `<experimental/utility>` header as specified in the latest draft of the library fundamentals TS.

`<experimental/utility>` only contains `class erased_type`. 

This patch also updates the documentation to list the `erased_type` class as "initial implementation complete".

Test Plan:
Three test cases where added:

1. Test that `_LIBCPP_VERSION` is defined.
2. Test that `<utility>` has been included.
3. Test that `erased_type` is in the correct namespace and is constexpr default constructible.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4510

llvm-svn: 213226
2014-07-17 05:31:31 +00:00
Eric Fiselier 371aac1adb Change _LIBCXX_CONSTEXPR_AFTER_CXX11 to check for c++14 constexpr rules
llvm-svn: 213225
2014-07-17 05:16:18 +00:00
Eric Fiselier 68c89c2480 Test commit: Reverting whitespace changes
llvm-svn: 213223
2014-07-17 05:10:03 +00:00
Eric Fiselier 712ac189cc Test commit: whitespace change
llvm-svn: 213222
2014-07-17 05:06:09 +00:00
Marshall Clow f52c88f015 Correctly implement LWG 2049; std::is_destructible.
llvm-svn: 213163
2014-07-16 15:51:50 +00:00
Saleem Abdulrasool f4a391c07f Change Windows decoration on some base classes
Mark the base classes for time_get_byname and time_get as _LIBCPP_TYPE_VIS_ONLY
rather than _LIBCPP_TYPE_VIS.  These base classes are templated types and cannot
be stored with export dll storage.

Fixes compilation with _LIBCPP_DLL for Windows when the time_get and
time_get_byname classes are used.

llvm-svn: 213116
2014-07-16 01:00:26 +00:00
Marshall Clow 0030af8c35 Support the built-in type-trait support in gcc 4.7 and later. Thanks to Albert Wong for the patch.
llvm-svn: 212727
2014-07-10 15:38:20 +00:00
Marshall Clow b38f8f07c5 Add support for BIONIC C library (Android). Patch from Dan Albert
llvm-svn: 212724
2014-07-10 15:20:28 +00:00
Marshall Clow 490349d262 Fix warning in test - missing exception specifier for overload of operator new
llvm-svn: 212723
2014-07-10 15:19:50 +00:00
Marshall Clow 79d4ffbc8f Add a reset method to the counting predicates in the test suite
llvm-svn: 212651
2014-07-09 21:04:22 +00:00
Marshall Clow 926731b1e5 string_view enhancements. Move to the correct namespace. Better constexpr support (thanks to Richard for the suggestions). Update the tests to match this. Add <experimental/__config for experimental macros/etc to live.
llvm-svn: 212569
2014-07-08 22:38:11 +00:00
Marshall Clow 56cca89fc3 Fix some failing tests for the standard containers. The tests were failing in 32-bit mode because they assumed that std::size_type and make_unsigned<ptrdiff_t>::type were always the same type. No change to libc++, just the tests.
llvm-svn: 212538
2014-07-08 15:19:40 +00:00
Marshall Clow 35af19ab1f Minor cleanup for string_view; mostly from suggestions by Richard Smith. Also, make the tests pass under c++03
llvm-svn: 212185
2014-07-02 15:45:57 +00:00
Marshall Clow 38cae6330b Fix libc++ bug #20039: 'Constructing std::function from empty compatible std::function results in half-empty state' Thanks to Agustin Berge for the report, and for his and Eric Fiselier's work on a fix.
llvm-svn: 212070
2014-06-30 21:27:51 +00:00
Marshall Clow afa72ed47c Fix a typo in the noexcept calculation for __compressed_pair::swap. Thanks to EricWF for the bug report and the fix.
llvm-svn: 212046
2014-06-30 15:35:09 +00:00
Marshall Clow 3484495b3d Add checking for the complexity guarantees in the standard
llvm-svn: 212017
2014-06-30 05:04:20 +00:00
Marshall Clow 157a8f91bd Patch from Albert J. Wong to make type_traits take advantage of gcc intrinsics in 4.7 and later. No functionality change when using clang.
llvm-svn: 211755
2014-06-26 01:07:56 +00:00
David Fang ed7987dcfe eliminate install of duplicate headers (take 2)
Patch by Ryuta Suzuki

llvm-svn: 211629
2014-06-24 20:32:11 +00:00
Marshall Clow f9af6140ff Some calls to get<>() were qualified. Some were not. Qualify them all. Fixes bug #20092. Thanks to Agustín Bergé for the bug report and the fix.
llvm-svn: 211563
2014-06-24 00:46:19 +00:00
Marshall Clow 2f4bfdecb3 Formatting improvements in the <string_view> synopsis suggested by RSmith. No functionality change.
llvm-svn: 211191
2014-06-18 17:44:04 +00:00
David Fang 09b61ebcbe Revert "fixes duplicate header installation"
This reverts commit 0bd40d6c3da6719fecf77038673d453ff1eab25b.

llvm-svn: 210857
2014-06-12 23:19:55 +00:00
Marshall Clow 5aa8fa250d Implement string_view from the library fundamentals TS (n4023). Also works in C++11 and 03, with reduced functionality (mostly in the area of constexpr)
llvm-svn: 210659
2014-06-11 16:44:55 +00:00
David Fang 7070be1160 fixes duplicate header installation
http://llvm.org/bugs/show_bug.cgi?id=18681
Patch by Ryuta Suzuki <oroppas gmail com>

llvm-svn: 210577
2014-06-10 20:26:54 +00:00
Marshall Clow d0817f526c Mark assign to be constepr only in c++14; can't have constexpr fns that return void in C++11
llvm-svn: 210562
2014-06-10 18:52:57 +00:00
Marshall Clow 9b0af34d96 Make the helper routines in string really be constexpr. This required a bit of refacoring in algorithm as well. Give them better names while we're at it. All of these are internal rotines; no visible functionality change.
llvm-svn: 210561
2014-06-10 18:51:55 +00:00
Marshall Clow 98763eb520 A bunch of the char.traits tests were using unicode literals. #ifdef those bits out on c++03, since it doesn't support u"" and U "" style strings.
llvm-svn: 210560
2014-06-10 18:46:59 +00:00
David Blaikie bfd92afe01 Update Arcanist config to point to reviews.llvm.org
llvm-svn: 210558
2014-06-10 18:29:36 +00:00
Marshall Clow cd68ae3f10 Fixed damaged row in issues table; thanks to STL for the catch
llvm-svn: 210500
2014-06-09 23:27:27 +00:00
Marshall Clow 57e06dfb41 Testing infastructure: A template for char_traits where all the functions are constexpr, and a comparison predicate which counts how many times it's been called.
llvm-svn: 210381
2014-06-06 22:33:40 +00:00
Marshall Clow c369914758 Since we now have a value for __cplusplus for c++14, teach libc++ about it
llvm-svn: 210380
2014-06-06 22:31:09 +00:00
Richard Smith ff0aff3caf Use __builtin_operator_new/__builtin_operator_delete when available. This
allows allocations and deallocations to be optimized out.

llvm-svn: 210211
2014-06-04 19:54:15 +00:00
David Majnemer 58a0a70fb2 Handle partial nanosleeps in this_thread::sleep_for
Signals may result in nanosleep returning with only some of the
requested sleeping performed.

Utilize nanosleep's "time-remaining" out parameter to continue sleeping
when this occurs.

llvm-svn: 210210
2014-06-04 19:43:20 +00:00
Nico Weber 7babe4f074 Make meta.trans.other/aligned_storage.pass.cpp pass on arm.
The maximum alignment on arm is 8, not 16 like on x86. Use alignof(max_align_t)
to make the test work in both cases.

llvm-svn: 210195
2014-06-04 16:25:58 +00:00
Nico Weber 1d1b46cdf7 Make locales (and transitively, std::endl) work reliably with gcc.
libc++ currently relies on undefined initialization order of global
initializers when using gcc:

1. __start_std_streams in iostream.cpp calls locale:🆔:_init, which assigns
   an id to each locale::facet in an initializer

2. Every facet has a static locale::id id, whose constructor sets the facet's
   id to 0

If 2 runs after 1, it clobbers the facet's assigned consecutive id, causing
exceptions to be thrown when e.g. running code like "cout << endl".

To fix this, let _LIBCPP_CONSTEXPR evaluate to "constexpr" instead of nothing
with gcc.  locale::id's constructor is marked _LIBCPP_CONSTEXPR, which ensures
that it won't get an initializer that could potentially run after the
iostream.cpp initializer. (This remains broken when building with msvc.)

Also switch constexpr-specific code in bitset to use __SIZEOF_SIZE_T__ instead
of __SIZE_WIDTH__, because gcc doesn't define the latter.

Pair-programmed/debugged with Dana Jansens.

llvm-svn: 210188
2014-06-04 15:46:56 +00:00
Marshall Clow 425f00817c Add a note about debug mode being non-functional
llvm-svn: 210162
2014-06-04 04:49:49 +00:00
David Majnemer 2dfdfdf45c [libc++] Don't return uninitialized data from random_device::operator()
Make sure we appropriately retry calls to read if the return result is
less than what we asked for.

Additionally, check and handle IO errors: EINTR results in the read
operation getting restarted; other errors turn into exceptions.

llvm-svn: 210061
2014-06-03 02:40:39 +00:00
David Majnemer 1e9592a9c7 [libc++] random_device fails if open returns zero
random_device::random_device(const string&) wrongly assumes that open
can only validly return a file descriptor greater than zero.

This results in random_device believing that it didn't successfully open
the device causing it to throw in it's constructor, this ends up leaking
a file descriptor.

The fix is simple, don't error on file descriptors which are zero.

llvm-svn: 210060
2014-06-03 02:21:37 +00:00
Marshall Clow f39d914d33 First cut at a post c++14 status page
llvm-svn: 210056
2014-06-02 23:37:13 +00:00
Nico Weber 0797874f33 Remove unused code in a libc++ test.
Other tests in this directory use this type, so it's probably copypasta from
there.

(test_buf only forwards to the superclass in all tests where it's used though,
so I wonder if it can be replaced with just using filebuf / wfilebuf
everywhere?)

llvm-svn: 210019
2014-06-02 12:00:08 +00:00
Marshall Clow 5f0701f270 Preparation for <string_view>. More helper functions that can be shared between <string> and <string_view>. No functionality change
llvm-svn: 210002
2014-06-02 02:22:49 +00:00
Justin Bogner ca14e2b132 Fix XFAIL condition from r208840
The XFAILs in r208840 were too general. They were meant to only apply
to testing when use_system_lib was set.

llvm-svn: 209972
2014-05-31 07:59:03 +00:00