aboutsummaryrefslogtreecommitdiff
path: root/lib/libcxx/include/strstream
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-04-26 15:33:29 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-05-08 19:37:29 -0700
commit06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76 (patch)
tree1316711b92a43dd5c599e425b8693fa8e1e0c0b7 /lib/libcxx/include/strstream
parentbc6ebc6f2597fda1f98842c6f545751fef2a5334 (diff)
downloadzig-06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76.tar.gz
zig-06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76.zip
libcxx: update to LLVM 18
release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42 This adds the flag `-D_LIBCPP_HARDENING_MODE` which is determined based on the Zig optimization mode. This commit also fixes libunwind, libcxx, and libcxxabi to properly report sub compilation errors.
Diffstat (limited to 'lib/libcxx/include/strstream')
-rw-r--r--lib/libcxx/include/strstream339
1 files changed, 139 insertions, 200 deletions
diff --git a/lib/libcxx/include/strstream b/lib/libcxx/include/strstream
index 35d655b826..e20c86baa6 100644
--- a/lib/libcxx/include/strstream
+++ b/lib/libcxx/include/strstream
@@ -139,271 +139,210 @@ private:
# pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf
- : public streambuf
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf : public streambuf {
public:
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI strstreambuf() : strstreambuf(0) {}
- explicit strstreambuf(streamsize __alsize);
+ _LIBCPP_HIDE_FROM_ABI strstreambuf() : strstreambuf(0) {}
+ explicit strstreambuf(streamsize __alsize);
#else
- explicit strstreambuf(streamsize __alsize = 0);
+ explicit strstreambuf(streamsize __alsize = 0);
#endif
- strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
- strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
- strstreambuf(const char* __gnext, streamsize __n);
+ strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
+ strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
+ strstreambuf(const char* __gnext, streamsize __n);
- strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
- strstreambuf(const signed char* __gnext, streamsize __n);
- strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
- strstreambuf(const unsigned char* __gnext, streamsize __n);
+ strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
+ strstreambuf(const signed char* __gnext, streamsize __n);
+ strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
+ strstreambuf(const unsigned char* __gnext, streamsize __n);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- strstreambuf(strstreambuf&& __rhs);
- _LIBCPP_INLINE_VISIBILITY
- strstreambuf& operator=(strstreambuf&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI strstreambuf(strstreambuf&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI strstreambuf& operator=(strstreambuf&& __rhs);
#endif // _LIBCPP_CXX03_LANG
- ~strstreambuf() override;
+ ~strstreambuf() override;
- void swap(strstreambuf& __rhs);
+ void swap(strstreambuf& __rhs);
- void freeze(bool __freezefl = true);
- char* str();
- int pcount() const;
+ void freeze(bool __freezefl = true);
+ char* str();
+ int pcount() const;
protected:
- int_type overflow (int_type __c = EOF) override;
- int_type pbackfail(int_type __c = EOF) override;
- int_type underflow() override;
- pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __which = ios_base::in | ios_base::out) override;
- pos_type seekpos(pos_type __sp,
- ios_base::openmode __which = ios_base::in | ios_base::out) override;
+ int_type overflow(int_type __c = EOF) override;
+ int_type pbackfail(int_type __c = EOF) override;
+ int_type underflow() override;
+ pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out) override;
+ pos_type seekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out) override;
private:
- typedef unsigned __mode_type;
- static const __mode_type __allocated = 0x01;
- static const __mode_type __constant = 0x02;
- static const __mode_type __dynamic = 0x04;
- static const __mode_type __frozen = 0x08;
- static const streamsize __default_alsize = 4096;
-
- __mode_type __strmode_;
- streamsize __alsize_;
- void* (*__palloc_)(size_t);
- void (*__pfree_)(void*);
-
- void __init(char* __gnext, streamsize __n, char* __pbeg);
+ typedef unsigned __mode_type;
+ static const __mode_type __allocated = 0x01;
+ static const __mode_type __constant = 0x02;
+ static const __mode_type __dynamic = 0x04;
+ static const __mode_type __frozen = 0x08;
+ static const streamsize __default_alsize = 4096;
+
+ __mode_type __strmode_;
+ streamsize __alsize_;
+ void* (*__palloc_)(size_t);
+ void (*__pfree_)(void*);
+
+ void __init(char* __gnext, streamsize __n, char* __pbeg);
};
#ifndef _LIBCPP_CXX03_LANG
-inline _LIBCPP_INLINE_VISIBILITY
-strstreambuf::strstreambuf(strstreambuf&& __rhs)
+inline _LIBCPP_HIDE_FROM_ABI strstreambuf::strstreambuf(strstreambuf&& __rhs)
: streambuf(__rhs),
__strmode_(__rhs.__strmode_),
__alsize_(__rhs.__alsize_),
__palloc_(__rhs.__palloc_),
- __pfree_(__rhs.__pfree_)
-{
- __rhs.setg(nullptr, nullptr, nullptr);
- __rhs.setp(nullptr, nullptr);
+ __pfree_(__rhs.__pfree_) {
+ __rhs.setg(nullptr, nullptr, nullptr);
+ __rhs.setp(nullptr, nullptr);
}
-inline _LIBCPP_INLINE_VISIBILITY
-strstreambuf&
-strstreambuf::operator=(strstreambuf&& __rhs)
-{
- if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
- {
- if (__pfree_)
- __pfree_(eback());
- else
- delete [] eback();
- }
- streambuf::operator=(__rhs);
- __strmode_ = __rhs.__strmode_;
- __alsize_ = __rhs.__alsize_;
- __palloc_ = __rhs.__palloc_;
- __pfree_ = __rhs.__pfree_;
- __rhs.setg(nullptr, nullptr, nullptr);
- __rhs.setp(nullptr, nullptr);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI strstreambuf& strstreambuf::operator=(strstreambuf&& __rhs) {
+ if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0) {
+ if (__pfree_)
+ __pfree_(eback());
+ else
+ delete[] eback();
+ }
+ streambuf::operator=(__rhs);
+ __strmode_ = __rhs.__strmode_;
+ __alsize_ = __rhs.__alsize_;
+ __palloc_ = __rhs.__palloc_;
+ __pfree_ = __rhs.__pfree_;
+ __rhs.setg(nullptr, nullptr, nullptr);
+ __rhs.setp(nullptr, nullptr);
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI istrstream
- : public istream
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI istrstream : public istream {
public:
- _LIBCPP_INLINE_VISIBILITY
- explicit istrstream(const char* __s)
- : istream(&__sb_), __sb_(__s, 0) {}
- _LIBCPP_INLINE_VISIBILITY
- explicit istrstream(char* __s)
- : istream(&__sb_), __sb_(__s, 0) {}
- _LIBCPP_INLINE_VISIBILITY
- istrstream(const char* __s, streamsize __n)
- : istream(&__sb_), __sb_(__s, __n) {}
- _LIBCPP_INLINE_VISIBILITY
- istrstream(char* __s, streamsize __n)
- : istream(&__sb_), __sb_(__s, __n) {}
+ _LIBCPP_HIDE_FROM_ABI explicit istrstream(const char* __s) : istream(&__sb_), __sb_(__s, 0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit istrstream(char* __s) : istream(&__sb_), __sb_(__s, 0) {}
+ _LIBCPP_HIDE_FROM_ABI istrstream(const char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {}
+ _LIBCPP_HIDE_FROM_ABI istrstream(char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- istrstream(istrstream&& __rhs) // extension
- : istream(_VSTD::move(static_cast<istream&>(__rhs))),
- __sb_(_VSTD::move(__rhs.__sb_))
- {
- istream::set_rdbuf(&__sb_);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- istrstream& operator=(istrstream&& __rhs)
- {
- __sb_ = _VSTD::move(__rhs.__sb_);
- istream::operator=(_VSTD::move(__rhs));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI istrstream(istrstream&& __rhs) // extension
+ : istream(std::move(static_cast<istream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
+ istream::set_rdbuf(&__sb_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI istrstream& operator=(istrstream&& __rhs) {
+ __sb_ = std::move(__rhs.__sb_);
+ istream::operator=(std::move(__rhs));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- ~istrstream() override;
+ ~istrstream() override;
- _LIBCPP_INLINE_VISIBILITY
- void swap(istrstream& __rhs)
- {
- istream::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(istrstream& __rhs) {
+ istream::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- _LIBCPP_INLINE_VISIBILITY
- strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
- _LIBCPP_INLINE_VISIBILITY
- char *str() {return __sb_.str();}
+ _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
+ _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
private:
- strstreambuf __sb_;
+ strstreambuf __sb_;
};
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI ostrstream
- : public ostream
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI ostrstream : public ostream {
public:
- _LIBCPP_INLINE_VISIBILITY
- ostrstream()
- : ostream(&__sb_) {}
- _LIBCPP_INLINE_VISIBILITY
- ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
- : ostream(&__sb_),
- __sb_(__s, __n, __s + (__mode & ios::app ? _VSTD::strlen(__s) : 0))
- {}
+ _LIBCPP_HIDE_FROM_ABI ostrstream() : ostream(&__sb_) {}
+ _LIBCPP_HIDE_FROM_ABI ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
+ : ostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- ostrstream(ostrstream&& __rhs) // extension
- : ostream(_VSTD::move(static_cast<ostream&>(__rhs))),
- __sb_(_VSTD::move(__rhs.__sb_))
- {
- ostream::set_rdbuf(&__sb_);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- ostrstream& operator=(ostrstream&& __rhs)
- {
- __sb_ = _VSTD::move(__rhs.__sb_);
- ostream::operator=(_VSTD::move(__rhs));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ostrstream(ostrstream&& __rhs) // extension
+ : ostream(std::move(static_cast<ostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
+ ostream::set_rdbuf(&__sb_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ostrstream& operator=(ostrstream&& __rhs) {
+ __sb_ = std::move(__rhs.__sb_);
+ ostream::operator=(std::move(__rhs));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- ~ostrstream() override;
+ ~ostrstream() override;
- _LIBCPP_INLINE_VISIBILITY
- void swap(ostrstream& __rhs)
- {
- ostream::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(ostrstream& __rhs) {
+ ostream::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- _LIBCPP_INLINE_VISIBILITY
- strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
- _LIBCPP_INLINE_VISIBILITY
- void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
- _LIBCPP_INLINE_VISIBILITY
- char* str() {return __sb_.str();}
- _LIBCPP_INLINE_VISIBILITY
- int pcount() const {return __sb_.pcount();}
+ _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
+ _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); }
+ _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
private:
- strstreambuf __sb_; // exposition only
+ strstreambuf __sb_; // exposition only
};
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstream
- : public iostream
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstream : public iostream {
public:
- // Types
- typedef char char_type;
- typedef char_traits<char>::int_type int_type;
- typedef char_traits<char>::pos_type pos_type;
- typedef char_traits<char>::off_type off_type;
+ // Types
+ typedef char char_type;
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char>::pos_type pos_type;
+ typedef char_traits<char>::off_type off_type;
- // constructors/destructor
- _LIBCPP_INLINE_VISIBILITY
- strstream()
- : iostream(&__sb_) {}
- _LIBCPP_INLINE_VISIBILITY
- strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
- : iostream(&__sb_),
- __sb_(__s, __n, __s + (__mode & ios::app ? _VSTD::strlen(__s) : 0))
- {}
+ // constructors/destructor
+ _LIBCPP_HIDE_FROM_ABI strstream() : iostream(&__sb_) {}
+ _LIBCPP_HIDE_FROM_ABI strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
+ : iostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- strstream(strstream&& __rhs) // extension
- : iostream(_VSTD::move(static_cast<iostream&>(__rhs))),
- __sb_(_VSTD::move(__rhs.__sb_))
- {
- iostream::set_rdbuf(&__sb_);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- strstream& operator=(strstream&& __rhs)
- {
- __sb_ = _VSTD::move(__rhs.__sb_);
- iostream::operator=(_VSTD::move(__rhs));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI strstream(strstream&& __rhs) // extension
+ : iostream(std::move(static_cast<iostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
+ iostream::set_rdbuf(&__sb_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI strstream& operator=(strstream&& __rhs) {
+ __sb_ = std::move(__rhs.__sb_);
+ iostream::operator=(std::move(__rhs));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- ~strstream() override;
+ ~strstream() override;
- _LIBCPP_INLINE_VISIBILITY
- void swap(strstream& __rhs)
- {
- iostream::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(strstream& __rhs) {
+ iostream::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- // Members:
- _LIBCPP_INLINE_VISIBILITY
- strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
- _LIBCPP_INLINE_VISIBILITY
- void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
- _LIBCPP_INLINE_VISIBILITY
- int pcount() const {return __sb_.pcount();}
- _LIBCPP_INLINE_VISIBILITY
- char* str() {return __sb_.str();}
+ // Members:
+ _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
+ _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); }
+ _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
+ _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
private:
- strstreambuf __sb_; // exposition only
+ strstreambuf __sb_; // exposition only
};
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_STRSTREAM