Eric Fiselier
a016efb1dc
[Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows
...
Summary:
This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning.
This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header.
Reviewers: mclow.lists, bcraig, compnerd, EricWF
Reviewed By: EricWF
Subscribers: cfe-commits, krytarowski
Differential Revision: https://reviews.llvm.org/D33080
llvm-svn: 304357
2017-05-31 22:07:49 +00:00
Saleem Abdulrasool
2177f3ce5f
clean up some qualifier casting
...
This cleans up the `-Wqual-cast` warnings from gcc 6 when building
libc++. NFC.
llvm-svn: 290789
2016-12-31 18:13:34 +00:00
Eric Fiselier
87a82490fc
Enable and fix warnings during the build.
...
Although CMake adds warning flags, they are ignored in the libc++ headers
because the headers '#pragma system header' themselves.
This patch disables the system header pragma when building libc++ and fixes
the warnings that arose.
The warnings fixed were:
1. <memory> - anonymous structs are a GNU extension
2. <functional> - anonymous structs are a GNU extension.
3. <__hash_table> - Embedded preprocessor directives have undefined behavior.
4. <string> - Definition is missing noexcept from declaration.
5. <__std_stream> - Unused variable.
llvm-svn: 242623
2015-07-18 20:40:46 +00:00
Howard Hinnant
d7cda0680a
Partial implementation of N3665. This paper was not voted into the C++1y draft. However I was looking at it and with some experimentation realized that I could partially implement it, and at the same time offer a performance optimization to cout. I simply added an xsputn override to the cout filebuf. The override does nothing special at all if there is a non-trivial codecvt installed. However if the codecvt returns true for always_noconv(), then this function can dump an entire string to fwrite, instead of doing it a character at a time under overflow(). This just makes sense. I stopped short of a full implementation of N3665 because in order to do so, xsputn would have to allocate a buffer when always_noconv() returned false, and I don't want to go to that expense.
...
llvm-svn: 188077
2013-08-09 16:25:43 +00:00
Howard Hinnant
e9672d0448
Make cout a little more thread-safe. This fixes http://llvm.org/bugs/show_bug.cgi?id=12158
...
llvm-svn: 185222
2013-06-28 21:40:28 +00:00
Howard Hinnant
266abefed0
Put a 1-character unget buffer into cin. This fixes http://llvm.org/bugs/show_bug.cgi?id=15867
...
llvm-svn: 181470
2013-05-08 21:18:42 +00:00
Howard Hinnant
591ebe3cbb
This is an optimization which produces improved launching time. There should be no functionality change. Clients should see no ABI differences.
...
llvm-svn: 177443
2013-03-19 21:34:48 +00:00
Howard Hinnant
41801f14ed
This SO question: http://stackoverflow.com/questions/15344402/how-can-i-read-a-0xff-in-a-file-with-libc-istream-iterator/15347225#15347225 highlighted the lack of a cast in the implementation of std::cin. Added. I unfortunately don't have a test case to add to the suite since this bug only shows itself when using std::cin. The current testsuite setup does not have a way a good way to test std::cin.
...
llvm-svn: 176822
2013-03-11 19:53:48 +00:00
Howard Hinnant
c206366fd7
Quash a whole bunch of warnings
...
llvm-svn: 145624
2011-12-01 20:21:04 +00:00
Howard Hinnant
ab4f438239
Add protection from min/max macros
...
llvm-svn: 145407
2011-11-29 16:45:27 +00:00
Howard Hinnant
073458b1ab
Windows support by Ruben Van Boxem.
...
llvm-svn: 142235
2011-10-17 20:05:10 +00:00
Howard Hinnant
ce48a1137d
_STD -> _VSTD to avoid macro clash on windows
...
llvm-svn: 134190
2011-06-30 21:18:19 +00:00
Howard Hinnant
a0fe8c436e
Chris Jefferson noted many places where function calls needed to be qualified (thanks Chris).
...
llvm-svn: 125510
2011-02-14 19:12:38 +00:00
Howard Hinnant
412dbebe1b
license change
...
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant
5b08a8a432
Wiped out some non-ascii characters that snuck into the copyright.
...
llvm-svn: 103516
2010-05-11 21:36:01 +00:00
Howard Hinnant
3e519524c1
libcxx initial import
...
llvm-svn: 103490
2010-05-11 19:42:16 +00:00