Commit Graph

216 Commits

Author SHA1 Message Date
Marshall Clow
2ccffefaff Patch by Bruce Mitchener. Change all references to EMSCRIPTEN to __EMSCRIPTEN__. If you're not using the PP symbol EMSCRIPTEN, then you should see no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@195136 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 18:05:03 +00:00
Yaron Keren
81241a9440 G M suggestion: conditionally include files on _WIN32.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@195045 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-18 21:30:19 +00:00
Yaron Keren
15c04bedad This patch implements snprintf_l function in a way similar to the other
functions in src/support/win32/locale_win32.cpp and locale_win32.h, 
calling upon vsnprintf for which there is a MingW correct alternative.

Note! __USE_MINGW_ANSI_STDIO is not modified in this patch. In order to 
use the __mingw version it must be defined before including the MingW 
headers.




git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@195044 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-18 21:12:14 +00:00
Marshall Clow
0cdbe60481 Move <optional> into include/experimental, and into the std::experimental namespace, since it's not part of C++14, but of an upcoming TS
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@194867 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 22:42:10 +00:00
Marshall Clow
a46a0ad9e5 Patch from Bruce Mitchener; fixes two typos in comments. No functionality change. PR17843
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@194432 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-11 23:27:19 +00:00
Marshall Clow
a36451371c Patch from GM: locale.cpp; make implicit conversions to bool explicit, fix some 'unknown pragma' warnings when compiling under MSVC, and don't use the __sso_allocator under windows, b/c MSVC doesn't support aligned-by value parameters
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@193086 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 15:07:28 +00:00
Marshall Clow
9de3d4cab3 Patch from GM to make more implicit bools explicit since we can't stop MSVC warning about this in headers and to warn is the MSVC default. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192548 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-13 01:02:45 +00:00
Marshall Clow
61a8422ffa LWG Issue 2087: iostream_category() and noexcept
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192545 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-12 22:49:56 +00:00
Marshall Clow
206ce1faaf LWG issue 2143: ios_base::xalloc should be thread-safe
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192539 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-12 19:13:52 +00:00
Marshall Clow
b8dd5caf5a patch by Yaron: Uses rand_s() from stdlib.h (when building for Windows)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192325 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-09 21:49:03 +00:00
Peter Collingbourne
4a0555a9d4 Silence the unused function warning in exception.cpp.
Rather than try to protect the function behind a precise,
ever-changing #if expression, just inline it into every caller.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192077 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-06 22:13:24 +00:00
Peter Collingbourne
ece95914ac Implement std::exception_ptr under libsupc++.
libsupc++ does not implement the dependent EH ABI and the
functionality it uses to implement std::exception_ptr (which it
declares as an alias of std::__exception_ptr::exception_ptr) is not
directly exported to clients. So we have little choice but to hijack
std::__exception_ptr::exception_ptr's (which fortunately has the
same layout as our std::exception_ptr) copy constructor, assignment
operator and destructor (which are part of its stable ABI), and its
rethrow_exception(std::__exception_ptr::exception_ptr) function.

Also, remove some out of date comments.

Differential Revision: http://llvm-reviews.chandlerc.com/D1826

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192076 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-06 22:13:21 +00:00
Peter Collingbourne
d0d308f54b Make it possible to link against libstdc++ as well as libsupc++ with CMake.
Linking against libstdc++, rather than libsupc++, is probably better
for people who need to link against clients of libstdc++.  Because
libsupc++ is provided only as a static library, its globals are not
shared between the static library and the copy linked into libstdc++.
This has been found to cause at least one test failure.

This also removes a number of symbols which were multiply defined
between libstdc++ and libc++, only when linking with libstdc++.

Differential Revision: http://llvm-reviews.chandlerc.com/D1825

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192075 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-06 22:13:19 +00:00
Peter Collingbourne
40455c65da Eliminate more symbols multiply defined between libsupc++ and libc++.
The remaining multiple definitions were flushed out by attempting to
link libsupc++ and libc++ into the same executable with --whole-archive,
e.g.

clang++ -I../llvm/projects/libcxx/include -nodefaultlibs -Wl,--whole-archive lib/libc++.a /usr/lib/gcc/x86_64-linux-gnu/4.6/libsupc++.a -Wl,--no-whole-archive -lgcc -lgcc_s -lc -lpthread -lrt

(The same technique was used to flush out multiple definitions in
libstdc++.)

Differential Revision: http://llvm-reviews.chandlerc.com/D1824

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192074 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-06 22:13:16 +00:00
Howard Hinnant
35a98a00b3 Use _LIBCPP_NEW_DELETE_VIS instead of LIBCPP_FUNC_VIS in src/new.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192071 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-06 20:53:24 +00:00
Howard Hinnant
5a8b5783f8 G M: The attached patch is for libcxx's new.cpp and __config files. The patch's intent is to make new.cpp compile using MS's cl.exe compiler without changing the meaning of anything for any other compiler.
The issue this patch seeks to address is that MS's compiler (cl.exe) doesn't support the __attribute__((__weak__)) or __atribute__((__visibility__("default")) syntax; so a solution must be found where cl.exe doesn't see this syntax.

This patch seeks to solve this problem by changing code patterned like this:
__attribute__((__weak__, __visibility__("default")))
void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { /*snip*/; return p; }

to code like this:
_LIBCPP_WEAK
void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { return p; }

Howard:  Thanks for all the comments regarding the default visibility
tag on the definition.  I agree it isn't needed, and that there are lots
of other places where it is missing.  That being said, I'm not wanting
to rock the boat on that issue right now.  So I've added it back to the
definition via _LIBCPP_FUNC_VIS.  A later pass dedicated just to this
issue can bring things in to a consistent state one way or the other. 
Note that we do not want to have the exact same attributes on the
declaration and defintion in this case.  The declaration should not be
marked weak, whereas the definition should (which is what G M's patch
did). I've fully tested on OS X to ensure that the resultant attribute
syntax actually works.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192007 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-04 23:56:37 +00:00
Howard Hinnant
9844b6796b G M: A small patch to fix a couple of warnings in stdexcept.cpp for cl.exe which does not support #pragma visibility.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@191988 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-04 22:12:59 +00:00
Howard Hinnant
f7555069ab G M: Provides the _LIBCPP_WARNING macro, to be used for MSVC only, since that compiler doesn't support #warning.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@191980 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-04 21:14:44 +00:00
Peter Collingbourne
8df0320334 Re-add bad_cast and bad_typeid default ctor definitions under libsupc++.
libsupc++ declares these constructors inline, so we won't necessarily
get a definition for them in the library.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@191931 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-03 22:04:10 +00:00
Chandler Carruth
d1754fb3e9 Make the guard for external ABI libraries include the guard for
libsupc++ in typeinfo.cpp, bringing it into agreement with
exception.cpp. This fixes link errors due to duplicate symbols from
this translation unit.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@191397 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-25 20:01:44 +00:00
Howard Hinnant
fc910cb9a0 Peter Collingbourne: Fix warnings when compiling with -DNDEBUG.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@191148 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-21 21:26:37 +00:00
Howard Hinnant
ba898e4208 N3659: Shared locking in C++ Revision 2, c++1y only
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@191127 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-21 01:49:28 +00:00
Joerg Sonnenberger
bd64f140d4 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@190857 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-17 08:46:53 +00:00
Howard Hinnant
ef5aa93b9c G M: Restore the ability for libcxx to compile again on mingw 64.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@190837 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-17 01:34:47 +00:00
Howard Hinnant
cd942f1840 Marshall Clow: LWG Issue 2056: future_errc enums start with value 0 (invalid value for broken_promise).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@190756 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-14 18:20:10 +00:00
Marshall Clow
7f9f52e6c6 Adding bad_array_length to libc++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@190478 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 01:38:42 +00:00
Howard Hinnant
f2a137d360 Evgeniy Stepanov: Add noexcept to ~bad_optional_access() to silence warning during build.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189949 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-04 15:21:08 +00:00
Howard Hinnant
01afa5c6e4 Implement N3672, optional<T>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189772 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-02 20:30:37 +00:00
Howard Hinnant
5143722d14 Xing Xue: Some minor changes for IBM XLC++/AIX.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189623 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-29 23:37:50 +00:00
Howard Hinnant
04a2c71d67 Turn off extern templates for most uses. It is causing more problems than it is worth. The extern templates will still be built into the dylib, mainly for ABI stability purposes. And the client can still turn these back on with a #define if desire. This fixes http://llvm.org/bugs/show_bug.cgi?id=17027. However there's no associated test for the test suite because http://llvm.org/bugs/show_bug.cgi?id=17027 needs mismatched dylib and headers to fire.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189610 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-29 20:56:53 +00:00
Howard Hinnant
5ec0ff81ce G M: Improvements to Windows support.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189273 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-26 20:18:01 +00:00
Howard Hinnant
5e57142c59 Rename _LIBCPP_DEBUG2 to _LIBCPP_DEBUG.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189140 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-23 20:10:18 +00:00
Howard Hinnant
499cea12bb Debug mode for string. This commit also marks the first time libc++ debug-mode has found a bug (found one in regex). Had to play with extern templates a bit to get this to work since string is heavily used within libc++.dylib.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189114 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-23 17:37:05 +00:00
Howard Hinnant
e31c432a33 Glen: replace obsolete _LIBCPP_CANTTHROW with _NOEXCEPT.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189046 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-22 19:39:03 +00:00
Marshall Clow
5c316a6d04 LWG 2145 - mark constructor for std::error_category as inline and constexpr. Leave the (existing, out-of-line, non-constexpr) in the dylib for compatibility with existing programs)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188858 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-21 02:57:19 +00:00
Howard Hinnant
7f76450ee9 Xing Xue: port to IBM XLC++/AIX.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188396 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-14 18:00:20 +00:00
Marshall Clow
3e005bf6b2 Fix signed/unsigned warnings when building libc++ in C++14 mode
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188395 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-14 17:53:31 +00:00
Howard Hinnant
0f678bd69e Nico Rieck: this patch series fixes visibility issues on Windows as explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188192 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-12 18:38:34 +00:00
Howard Hinnant
8b00e6c960 Ok, 3 major changes for debug mode in one commit:
1.  I had been detecting and trapping iterator == and \!= among iterators
    in different containers as an error.  But the trapping itself is actually
    an error.
    
    Consider:
    
    #include <iostream>
    #include <vector>
    #include <algorithm>

    template <class C>
    void
    display(const C& c)
    {
        std::cout << "{";
        bool first = true;
        for (const auto& x : c)
        {
            if (\!first)
                std::cout << ", ";
            first = false;
            std::cout << x;
        }
        std::cout << "}\n";
    }

    int
    main()
    {
        typedef std::vector<int> V;
        V v1 = {1, 3, 5};
        V v2 = {2, 4, 6};
        display(v1);
        display(v2);
        V::iterator i = std::find(v1.begin(), v1.end(), 1);
        V::iterator j = std::find(v2.begin(), v2.end(), 2);
        if (*i == *j)
            i = j;    // perfectly legal
        // ...
        if (i \!= j)   // the only way to check
            v2.push_back(*i);
        display(v1);
        display(v2);
    }

    It is legal to assign an iterator from one container to another of the
    same type.  This is required to work.  One might want to test whether or
    not such an assignment had been made.  The way one performs such a check
    is using the iterator's ==, \!= operator.  This is a logical and necessary
    function and does not constitute an error.

2.  I had a header circular dependence bug when _LIBCPP_DEBUG2 is defined.
    This caused a problem in several of the libc++ tests.
    Fixed.

3.  There is a serious problem when _LIBCPP_DEBUG2=1 at the moment in that
    std::basic_string is inoperable.  std::basic_string uses __wrap_iterator
    to implement its iterators.  __wrap_iterator has been rigged up in debug
    mode to support vector.  But string hasn't been rigged up yet.  This means
    that one gets false positives when using std::string in debug mode.  I've
    upped std::string's priority in www/debug_mode.html.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187636 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-02 00:26:35 +00:00
Howard Hinnant
e9df0a5c6c Nico Rieck: Currently _MSC_VER and _WIN32 are used to guard code which is
MSVC-specific, MSVCRT-specific, or Windows-specific. Because Clang can
also define _MSC_VER, and MSVCRT is not necessarily the only C runtime,
these macros should not be used interchangeably.

This patch divides all Windows-related bits into the aforementioned
categories. Two new macros are introduced:

- _LIBCPP_MSVC: Defined when compiling with MSVC. Detected using
  _MSC_VER, excluding Clang.
- _LIBCPP_MSVCRT: Defined when using the Microsoft CRT. This is the default
   when _WIN32 is defined.

This leaves _WIN32 for code using the Windows API.

This also corrects the spelling of _LIBCP_HAS_IS_BASE_OF to _LIBCPP_HAS_IS_BASE_OF.

Nico, please prepare a patch for CREDITS.TXT, thanks.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187593 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-01 18:17:34 +00:00
Howard Hinnant
b87922c2c5 Glen: Minor tweaks to locale.cpp to help it compile with exceptions turned off.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187332 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-28 18:20:00 +00:00
Howard Hinnant
ed14a76beb Add some friendly messages to libcxx calls to abort().
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186951 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-23 16:05:56 +00:00
Howard Hinnant
171771a9f5 War on tabs.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185865 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 21:06:38 +00:00
Howard Hinnant
0769e6a785 Windows port for __codecvt_utf8<wchar_t>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185849 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 19:03:07 +00:00
Joerg Sonnenberger
9a06b9d017 Don't free the C locale on NetBSD.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185467 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02 19:46:18 +00:00
Howard Hinnant
725ae713f2 Windows support in thread::hardware_concurrency.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185451 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02 17:53:48 +00:00
Howard Hinnant
312926eed4 Matthew Dempsky: POSIX defines that the _POSIX_C_SOURCE macros are to be set by user
code to specify what version of POSIX the system should provide.  If
you want to check what version of POSIX is actually available, you're
supposed to test _POSIX_VERSION.

However, since sysconf() has been in POSIX since 1995, it's probably
safe to assume it's available on any system with a C++11 compiler,
especially if _SC_NPROCESSORS_ONLN is defined too.  So no point in a
complicated preprocessor rule if just we unconditionally include
<unistd.h> (on non-Windows systems).

Also, I've added a #warning for to help porters detect when a suitable
implementation isn't detected at compile-time.

Howard:  Matthew, can you patch CREDITS.TXT?  Thanks.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185275 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-30 00:14:43 +00:00
Howard Hinnant
09ca5d49e1 Matthew Dempsky: Same as stdexcept.cpp in libc++abi: we've already computed 'len strlen(msg)', so we can use memcpy() instead of strcpy().
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185274 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-29 23:53:20 +00:00
Joerg Sonnenberger
a71a952634 Add NetBSD support.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@182162 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-17 21:17:34 +00:00
Joerg Sonnenberger
67444034ed Create a weak pthread_create reference on NetBSD to not force a
dependency on libpthread for code that doesn't use threads itself.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@182161 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-17 21:16:18 +00:00