Commit Graph

4955 Commits

Author SHA1 Message Date
Fangrui Song 7cd67904f7 Remove redundant null pointer check in operator delete
Summary:
C89 4.10.3.2 The free function
C99 7.20.3.2 The free function
C11 7.22.3.3 The free function

    If ptr is a null pointer, no action shall occur.

_aligned_free on MSDN:

    If memblock is a NULL pointer, this function simply performs no actions.

Reviewers: EricWF, mclow.lists, khng300, hotpxl

Reviewed By: mclow.lists, khng300, hotpxl

Subscribers: lichray, llvm-commits, hotpxl, khng300, christof, ldionne, cfe-commits, libcxx-commits

Differential Revision: https://reviews.llvm.org/D52401

llvm-svn: 343503
2018-10-01 17:21:07 +00:00
Eric Fiselier b6f4d445f0 Attempt to fix aligned allocation configuration under clang-cl
When we're using clang-cl and Microsoft's runtime implementation,
we don't provide align_val_t or aligned new/delete ourselves.

This patch updates the _LIBCPP_HAS_NO_ALIGNED_ALLOCATION macro
to reflect this.

llvm-svn: 343441
2018-10-01 04:08:06 +00:00
Eric Fiselier 1f44fda0b9 Remove one more warning from clang-cl build
llvm-svn: 343440
2018-10-01 03:59:05 +00:00
Eric Fiselier a0e23576b8 Fix Shadowing warning on Windows
llvm-svn: 343439
2018-10-01 02:54:08 +00:00
Eric Fiselier 0b485f3e91 Fix even more Clang warnings.
This patch disables shift-sign-overflow warnings for now. It also
fixes most -Wfloat-equal warnings and -Wextra-semi warnings.

llvm-svn: 343438
2018-10-01 01:59:37 +00:00
Eric Fiselier cd269132ec Bump default dialect to C++14 for clang-cl
llvm-svn: 343437
2018-10-01 01:51:46 +00:00
Eric Fiselier e60359efbb Remove even more clang-cl warnings
llvm-svn: 343436
2018-10-01 01:47:23 +00:00
Eric Fiselier 356af2318d Mork more tests as FLAKY
llvm-svn: 343435
2018-10-01 01:43:42 +00:00
Eric Fiselier 5e0b8fc3fd Remove even more warnings from clang-cl build
llvm-svn: 343434
2018-10-01 01:31:23 +00:00
Eric Fiselier 0c8011f208 Turn off warnings under clang-cl
llvm-svn: 343433
2018-10-01 01:15:50 +00:00
Eric Fiselier a2d2e43bef Fix threaded test under no-threading configuration
llvm-svn: 343432
2018-10-01 01:05:51 +00:00
Eric Fiselier 11edd935c8 Attempt to unbreak Windows configuration.
Although libc++ doesn't yet support Windows we still have Windows
builders to track our progress.

Currently the clang-cl configuration seems broken because it doesn't
support -std=c++11 and instead requires /std:c++11. This patch attempts
to fix this.

llvm-svn: 343431
2018-10-01 01:00:11 +00:00
Vitaly Buka 0509070811 [cxx2a] Fix warning triggered by r343285
llvm-svn: 343369
2018-09-29 02:17:12 +00:00
Louis Dionne f9a52903ef [libc++] Remove Fuchsia-specific knowledge to pick the ABI version
Summary:
The ABI version used by libc++ is a configuration option just like any other
configuration option. It is a knob that can be used by vendors to customize
the libc++ that they ship. As such, we should not be hardcoding vendor-specific
configuration choices in libc++.

When building libc++ for Fuchsia, Fuchsia's build scripts should simply define
the libc++ ABI version to 2 -- this will result in the _LIBCPP_ABI_VERSION
macro being defined in the __config header that is generated when libc++ is
built and installed, which is the correct way to customize libc++'s behavior
for specific vendors.

Reviewers: phosek, EricWF

Subscribers: mgorny, christof, dexonsmith, cfe-commits, libcxx-commits

Differential Revision: https://reviews.llvm.org/D52397

llvm-svn: 343079
2018-09-26 08:24:51 +00:00
Louis Dionne 3c3e1c6265 Revert r342936 "Remove redundant null pointer check in operator delete"
A review for the change was opened in https://reviews.llvm.org/D52401
but the change was committed before being approved by any of the code
owners for libc++.

llvm-svn: 342938
2018-09-25 04:13:08 +00:00
Fangrui Song 6da5366ea9 Remove redundant null pointer check in operator delete
C89 4.10.3.2 The free function
C99 7.20.3.2 The free function
C11 7.22.3.3 The free function

    If ptr is a null pointer, no action shall occur.

_aligned_free on MSDN:

    If memblock is a NULL pointer, this function simply performs no actions.

Reviewers: EricWF, mclow.lists

Subscribers: christof, ldionne, cfe-commits, libcxx-commits

Differential Revision: https://reviews.llvm.org/D52401

llvm-svn: 342936
2018-09-25 02:50:57 +00:00
Louis Dionne 255f376f6b [libcxx] Fix the binder deprecation tests on Clang 5.
Tested on Docker containers with Clang 4, 5 and 6.

llvm-svn: 342855
2018-09-23 23:17:48 +00:00
Louis Dionne 593b23f6a7 [libcxx] Fix buildbots on Debian
Debian build bots are running Clang 4, which apparently does not support
the "deprecated" attribute properly. Clang pretends to support the attribute,
but the attribute doesn't do anything.

(live example: https://wandbox.org/permlink/0De69aXns0t1D59r)

On a separate note, I'm not sure I understand why we're even running the
libc++ tests under Clang-4. Is this a configuration we support? I can
understand that libc++ should _build_ with Clang 4, but it's not clear
to me that new libc++ headers should be usable under older compilers
like that.

llvm-svn: 342854
2018-09-23 22:16:35 +00:00
Louis Dionne 436a40128c [libcxx] Document new symbols __u64toa and __u32toa on Darwin
Summary:
This is the counterpart for https://reviews.llvm.org/D50130 and
https://reviews.llvm.org/D52391 on Darwin.

Reviewers: EricWF

Subscribers: christof, dexonsmith, cfe-commits, libcxx-commits, lichray

Differential Revision: https://reviews.llvm.org/D52396

llvm-svn: 342849
2018-09-23 21:10:06 +00:00
Louis Dionne ea5cd3b476 [libc++] Add deprecated attributes to many deprecated components
Summary:
These deprecation warnings are opt-in: they are only enabled when the
_LIBCXX_DEPRECATION_WARNINGS macro is defined, which is not the case
by default. Note that this is a first step in the right direction, but
I wasn't able to get an exhaustive list of all deprecated components
per standard, so there's certainly stuff that's missing. The list of
components this commit marks as deprecated is:

in C++11:
- auto_ptr, auto_ptr_ref
- binder1st, binder2nd, bind1st(), bind2nd()
- pointer_to_unary_function, pointer_to_binary_function, ptr_fun()
- mem_fun_t, mem_fun1_t, const_mem_fun_t, const_mem_fun1_t, mem_fun()
- mem_fun_ref_t, mem_fun1_ref_t, const_mem_fun_ref_t, const_mem_fun1_ref_t, mem_fun_ref()

in C++14:
- random_shuffle()

in C++17:
- unary_negate, binary_negate, not1(), not2()

<rdar://problem/18168350>

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, llvm-commits

Differential Revision: https://reviews.llvm.org/D48912

llvm-svn: 342843
2018-09-23 18:35:00 +00:00
Louis Dionne 0805a4fa9c [NFC][libcxx] Rename helpers with 4 underscores to something more reasonable
llvm-svn: 342840
2018-09-23 16:44:50 +00:00
Louis Dionne 95530082c4 [NFC][libc++] Fix typo in the description of LIBCXX_INCLUDE_BENCHMARKS
llvm-svn: 342822
2018-09-22 21:30:12 +00:00
Eric Fiselier a793b84d81 Mark [[nodiscard]] tests unsupported on GCC prior to 7.0
llvm-svn: 342821
2018-09-22 21:01:07 +00:00
Eric Fiselier 67e881d112 Fix UB in SIMD tests.
One of the SIMD tests attempted to left shift a value by 42, which
is UB when the left hand side is a 32 bit integer type.

This patch adjusts the test to use the value 4 instead of 42.

llvm-svn: 342820
2018-09-22 20:09:02 +00:00
Roman Lebedev 2f02863bf2 [libcxx] Readjust nodiscard_extensions.pass.cpp test - just disable for ASAN
In rL342814, i have committed a blind fix to unbreak the asan buildbot,
but as it was later discussed, the leak is intentional,
so we can not fix the failure that way.

So this reverts the leak 'fix',
and simply disables the test in the presence of ASAN.

llvm-svn: 342819
2018-09-22 20:07:02 +00:00
Eric Fiselier 76c83ea16d Mark test as flaky
llvm-svn: 342818
2018-09-22 20:03:47 +00:00
Eric Fiselier 0ef540bd51 Correct docs to reference the new libc++ lists.
We recently added libcxx-dev and libcxx-commits mailing lists.
This patch updates the libc++ documentation to correctly reference
the libc++ lists instead of the old Clang ones.

llvm-svn: 342816
2018-09-22 19:49:29 +00:00
Roman Lebedev 931d66cd22 [libcxx] Blind attempt to fix harmless leak in nodiscard_extensions.pass.cpp test
libcxx-libcxxabi-x86_64-linux-ubuntu-asan complains about a leak here.

llvm-svn: 342814
2018-09-22 19:09:57 +00:00
Louis Dionne 8a15c924ae [libcxx] Fix the definition of the check-cxx-abilist target on Darwin
Summary:
r342805 added support for the check-cxx-abilist target on FreeBSD, but broke
the target on macOS in doing so. The problem is that the GENERIC_TARGET_TRIPLE
gets overwritten after replacing the FreeBSD regular expression, which
nullifies the replacement done with the darwin regular expression.

Reviewers: dim, EricWF

Subscribers: emaste, mgorny, krytarowski, christof, dexonsmith, cfe-commits, libcxx-commits

Differential Revision: https://reviews.llvm.org/D52394

llvm-svn: 342813
2018-09-22 18:39:38 +00:00
Zhihao Yuan dbbb4b104d Document new symbols for __u64toa and __u32toa
Summary:
They are introduced in r338479; their Linux ABI changes are recorded in r338486.

TODO: Record the Mac OS X ABI changes.

Reviewers: EricWF

Reviewed By: EricWF

Subscribers: christof, ldionne, libcxx-commits, cfe-commits

Differential Revision: https://reviews.llvm.org/D52391

llvm-svn: 342810
2018-09-22 18:05:28 +00:00
Roman Lebedev c65d39a464 [libc++] Add _LIBCPP_ENABLE_NODISCARD and _LIBCPP_NODISCARD_EXT to allow pre-C++2a [[nodiscard]]
Summary:
The `[[nodiscard]]` attribute is intended to help users find bugs where
function return values are ignored when they shouldn't be. After C++17 the
C++ standard has started to declared such library functions as `[[nodiscard]]`.
However, this application is limited and applies only to dialects after C++17.
Users who want help diagnosing misuses of STL functions may desire a more
liberal application of `[[nodiscard]]`.

For this reason libc++ provides an extension that does just that! The
extension must be enabled by defining `_LIBCPP_ENABLE_NODISCARD`. The extended
applications of `[[nodiscard]]` takes two forms:

1. Backporting `[[nodiscard]]` to entities declared as such by the
   standard in newer dialects, but not in the present one.

2. Extended applications of `[[nodiscard]]`, at the libraries discretion,
   applied to entities never declared as such by the standard.

Users may also opt-out of additional applications `[[nodiscard]]` using
additional macros.

Applications of the first form, which backport `[[nodiscard]]` from a newer
dialect may be disabled using macros specific to the dialect it was added. For
example `_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17`.

Applications of the second form, which are pure extensions, may be disabled
by defining `_LIBCPP_DISABLE_NODISCARD_EXT`.

This patch was originally written by me (Roman Lebedev),
then but then reworked by Eric Fiselier.

Reviewers: mclow.lists, thakis, EricWF

Reviewed By: thakis, EricWF

Subscribers: llvm-commits, mclow.lists, lebedev.ri, EricWF, rjmccall, Quuxplusone, cfe-commits, christof

Differential Revision: https://reviews.llvm.org/D45179

llvm-svn: 342808
2018-09-22 17:54:48 +00:00
Dimitry Andric f3b94728c7 Similar to the handling of darwin target triples, strip the version
numbers off of freebsd target triples, when generating the name of the
ABI list file for check-cxx-abilist target.

Also remove unnecessary parentheses in the regex for darwin, and
slightly reword the comment.

llvm-svn: 342805
2018-09-22 14:37:49 +00:00
Sylvestre Ledru 6616b4c9e9 fix some typos in the doc
llvm-svn: 342628
2018-09-20 08:05:01 +00:00
Sylvestre Ledru 8e5a0b1f7b add a quick link to libc++abi
llvm-svn: 342625
2018-09-20 07:58:43 +00:00
Sylvestre Ledru 0296eea49b refresh the libc++ homepage
llvm-svn: 342624
2018-09-20 07:57:31 +00:00
Eric Fiselier 2d79835ccb Fix diagnostic regex in variant tests to tolerate older clang versions
llvm-svn: 342609
2018-09-20 01:15:17 +00:00
Volodymyr Sapsai 8d6ac8f689 Revert "Implement LWG 2221 - No formatted output operator for nullptr."
This reverts r342566 as it causes on bots linker errors like

> Undefined symbols for architecture i386:
>   "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(std::nullptr_t)", referenced from:

llvm-svn: 342599
2018-09-19 23:31:34 +00:00
Marshall Clow 4a71f9cfcc Implement LWG 2221 - No formatted output operator for nullptr. Reviewed as https://reviews.llvm.org/D44263
llvm-svn: 342566
2018-09-19 18:29:57 +00:00
Eric Fiselier 7dca3127c2 Don't require relops on variant alternatives to all return the same
type.

Libc++ correctly asserts that a set of visitors for a variant all
return the same type. However, we use the visitation machinary to
perform relational operations. This causes a static assertion when
some of the alternatives relops return a UDT which is implicitly
convertible to bool instead of 'bool' exactly.

llvm-svn: 342560
2018-09-19 17:53:21 +00:00
Marshall Clow 8ae45e0e59 Remove unused include of "verbose_assert.h"
llvm-svn: 342524
2018-09-19 02:27:44 +00:00
Fangrui Song cac6d21731 Fix typo
llvm-svn: 342361
2018-09-17 07:40:42 +00:00
Marshall Clow 08ebf19e52 Mark LWG#3102 as complete. No code changes, but I updated a test or two
llvm-svn: 342103
2018-09-13 02:23:52 +00:00
Marshall Clow f56972e224 Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955
llvm-svn: 342073
2018-09-12 19:41:40 +00:00
Marshall Clow a4ce437104 Actually mark LWG#2953, don't just say you've done so in r342070
llvm-svn: 342071
2018-09-12 18:53:02 +00:00
Marshall Clow 71f7d7b1c7 mark LWG#2953 as complete. No code changes required, but added a couple of extra tests.
llvm-svn: 342070
2018-09-12 18:51:12 +00:00
Marshall Clow 4d0509f61a Update the failure annotations for the uncaught_exceptions test. The underlying abi library on some Mac OS versions does not support the plural uncaught_exceptions, so libc++ emulates it from the singlar; this means it will only return 0 or 1.
llvm-svn: 342063
2018-09-12 16:59:09 +00:00
Marshall Clow ebff3123a2 Implement LWG #3017. list splice functions should use addressof
llvm-svn: 342057
2018-09-12 14:46:17 +00:00
Marshall Clow 48e5b8b1a4 Update the synopsis for <version>. NFC
llvm-svn: 341990
2018-09-11 20:51:54 +00:00
Marshall Clow e9cc545129 Fix PR# 38900 - don't call swap inside of random_shuffle when we'd be swapping an element with itself
llvm-svn: 341975
2018-09-11 18:33:45 +00:00
Hans Wennborg 462429c03d ReleaseNotes: update links to use https
llvm-svn: 341789
2018-09-10 08:57:12 +00:00