head 1.1; branch 1.1.1; access; symbols netbsd-11-0-RC6:1.1.1.3 netbsd-11-0-RC5:1.1.1.3 netbsd-11-0-RC4:1.1.1.3 netbsd-11-0-RC3:1.1.1.3 netbsd-11-0-RC2:1.1.1.3 netbsd-11-0-RC1:1.1.1.3 gcc-14-3-0:1.1.1.4 perseant-exfatfs-base-20250801:1.1.1.3 netbsd-11:1.1.1.3.0.4 netbsd-11-base:1.1.1.3 gcc-12-5-0:1.1.1.3 netbsd-10-1-RELEASE:1.1.1.2 perseant-exfatfs-base-20240630:1.1.1.3 gcc-12-4-0:1.1.1.3 perseant-exfatfs:1.1.1.3.0.2 perseant-exfatfs-base:1.1.1.3 netbsd-10-0-RELEASE:1.1.1.2 netbsd-10-0-RC6:1.1.1.2 netbsd-10-0-RC5:1.1.1.2 netbsd-10-0-RC4:1.1.1.2 netbsd-10-0-RC3:1.1.1.2 netbsd-10-0-RC2:1.1.1.2 netbsd-10-0-RC1:1.1.1.2 gcc-12-3-0:1.1.1.3 gcc-10-5-0:1.1.1.2 netbsd-10:1.1.1.2.0.6 netbsd-10-base:1.1.1.2 gcc-10-4-0:1.1.1.2 cjep_sun2x-base1:1.1.1.2 cjep_sun2x:1.1.1.2.0.4 cjep_sun2x-base:1.1.1.2 cjep_staticlib_x-base1:1.1.1.2 cjep_staticlib_x:1.1.1.2.0.2 cjep_staticlib_x-base:1.1.1.2 gcc-10-3-0:1.1.1.2 gcc-9-3-0:1.1.1.1 FSF:1.1.1; locks; strict; comment @# @; 1.1 date 2020.09.05.07.52.09; author mrg; state Exp; branches 1.1.1.1; next ; commitid ZRYA7IOuwfMjAPmC; 1.1.1.1 date 2020.09.05.07.52.09; author mrg; state Exp; branches; next 1.1.1.2; commitid ZRYA7IOuwfMjAPmC; 1.1.1.2 date 2021.04.10.22.10.05; author mrg; state Exp; branches; next 1.1.1.3; commitid eC4g0MRpqTvEkNOC; 1.1.1.3 date 2023.07.30.05.21.20; author mrg; state Exp; branches; next 1.1.1.4; commitid tk6nV4mbc9nVEMyE; 1.1.1.4 date 2025.09.13.23.45.49; author mrg; state Exp; branches; next ; commitid KwhwN4krNWa6XBaG; desc @@ 1.1 log @Initial revision @ text @// -*- C++ -*- // Copyright (C) 2015-2019 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // . /** @@file experimental/io_service * This is a TS C++ Library header. */ #ifndef _GLIBCXX_EXPERIMENTAL_IO_SERVICE #define _GLIBCXX_EXPERIMENTAL_IO_SERVICE 1 #pragma GCC system_header #if __cplusplus >= 201402L #include #include #include #include #include #include #include #include #if _GLIBCXX_HAVE_UNISTD_H # include #endif #ifdef _GLIBCXX_HAVE_POLL_H # include #endif #ifdef _GLIBCXX_HAVE_FCNTL_H # include #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace experimental { namespace net { inline namespace v1 { /** * @@ingroup networking * @@{ */ class __socket_impl; /// An ExecutionContext for I/O operations. class io_context : public execution_context { public: // types: /// An executor for an io_context. class executor_type { public: // construct / copy / destroy: executor_type(const executor_type& __other) noexcept = default; executor_type(executor_type&& __other) noexcept = default; executor_type& operator=(const executor_type& __other) noexcept = default; executor_type& operator=(executor_type&& __other) noexcept = default; // executor operations: bool running_in_this_thread() const noexcept { lock_guard __lock(_M_ctx->_M_mtx); auto __end = _M_ctx->_M_call_stack.end(); return std::find(_M_ctx->_M_call_stack.begin(), __end, this_thread::get_id()) != __end; } io_context& context() const noexcept { return *_M_ctx; } void on_work_started() const noexcept { ++_M_ctx->_M_work_count; } void on_work_finished() const noexcept { --_M_ctx->_M_work_count; } template void dispatch(_Func&& __f, const _ProtoAllocator& __a) const { if (running_in_this_thread()) decay_t<_Func>{std::forward<_Func>(__f)}(); else post(std::forward<_Func>(__f), __a); } template void post(_Func&& __f, const _ProtoAllocator& __a) const { lock_guard __lock(_M_ctx->_M_mtx); // TODO (re-use functionality in system_context) _M_ctx->_M_reactor._M_notify(); } template void defer(_Func&& __f, const _ProtoAllocator& __a) const { post(std::forward<_Func>(__f), __a); } private: friend io_context; explicit executor_type(io_context& __ctx) : _M_ctx(std::addressof(__ctx)) { } io_context* _M_ctx; }; using count_type = size_t; // construct / copy / destroy: io_context() : _M_work_count(0) { } explicit io_context(int __concurrency_hint) : _M_work_count(0) { } io_context(const io_context&) = delete; io_context& operator=(const io_context&) = delete; // io_context operations: executor_type get_executor() noexcept { return executor_type(*this); } count_type run() { count_type __n = 0; while (run_one()) if (__n != numeric_limits::max()) ++__n; return __n; } template count_type run_for(const chrono::duration<_Rep, _Period>& __rel_time) { return run_until(chrono::steady_clock::now() + __rel_time); } template count_type run_until(const chrono::time_point<_Clock, _Duration>& __abs_time) { count_type __n = 0; while (run_one_until(__abs_time)) if (__n != numeric_limits::max()) ++__n; return __n; } count_type run_one() { return _M_do_one(chrono::milliseconds{-1}); } template count_type run_one_for(const chrono::duration<_Rep, _Period>& __rel_time) { return run_one_until(chrono::steady_clock::now() + __rel_time); } template count_type run_one_until(const chrono::time_point<_Clock, _Duration>& __abs_time) { auto __now = _Clock::now(); while (__now < __abs_time) { using namespace std::chrono; auto __ms = duration_cast(__abs_time - __now); if (_M_do_one(__ms)) return 1; __now = _Clock::now(); } return 0; } count_type poll() { count_type __n = 0; while (poll_one()) if (__n != numeric_limits::max()) ++__n; return __n; } count_type poll_one() { return _M_do_one(chrono::milliseconds{0}); } void stop() { lock_guard __lock(_M_mtx); _M_stopped = true; _M_reactor._M_notify(); } bool stopped() const noexcept { lock_guard __lock(_M_mtx); return _M_stopped; } void restart() { _M_stopped = false; } private: template friend class basic_waitable_timer; friend __socket_impl; template friend class __basic_socket_impl; template friend class basic_socket; template friend class basic_datagram_socket; template friend class basic_stream_socket; template friend class basic_socket_acceptor; count_type _M_outstanding_work() const { return _M_work_count + !_M_ops.empty(); } struct __timer_queue_base : execution_context::service { // return milliseconds until next timer expires, or milliseconds::max() virtual chrono::milliseconds _M_next() const = 0; virtual bool run_one() = 0; protected: explicit __timer_queue_base(execution_context& __ctx) : service(__ctx) { auto& __ioc = static_cast(__ctx); lock_guard __lock(__ioc._M_mtx); __ioc._M_timers.push_back(this); } mutable mutex _M_qmtx; }; template struct __timer_queue : __timer_queue_base { using key_type = __timer_queue; explicit __timer_queue(execution_context& __ctx) : __timer_queue_base(__ctx) { } void shutdown() noexcept { } io_context& context() noexcept { return static_cast(service::context()); } // Start an asynchronous wait. void push(const _Timer& __t, function __h) { context().get_executor().on_work_started(); lock_guard __lock(_M_qmtx); _M_queue.emplace(__t, _M_next_id++, std::move(__h)); // no need to notify reactor unless this timer went to the front? } // Cancel all outstanding waits for __t size_t cancel(const _Timer& __t) { lock_guard __lock(_M_qmtx); size_t __count = 0; auto __last = _M_queue.end(); for (auto __it = _M_queue.begin(), __end = __last; __it != __end; ++__it) { if (__it->_M_key == __t._M_key.get()) { __it->cancel(); __last = __it; ++__count; } } if (__count) _M_queue._M_sort_to(__last); return __count; } // Cancel oldest outstanding wait for __t bool cancel_one(const _Timer& __t) { lock_guard __lock(_M_qmtx); const auto __end = _M_queue.end(); auto __oldest = __end; for (auto __it = _M_queue.begin(); __it != __end; ++__it) if (__it->_M_key == __t._M_key.get()) if (__oldest == __end || __it->_M_id < __oldest->_M_id) __oldest = __it; if (__oldest == __end) return false; __oldest->cancel(); _M_queue._M_sort_to(__oldest); return true; } chrono::milliseconds _M_next() const override { typename _Timer::time_point __exp; { lock_guard __lock(_M_qmtx); if (_M_queue.empty()) return chrono::milliseconds::max(); // no pending timers if (_M_queue.top()._M_key == nullptr) return chrono::milliseconds::zero(); // cancelled, run now __exp = _M_queue.top()._M_expiry; } auto __dur = _Timer::traits_type::to_wait_duration(__exp); if (__dur < __dur.zero()) __dur = __dur.zero(); return chrono::duration_cast(__dur); } private: bool run_one() override { auto __now = _Timer::clock_type::now(); function __h; error_code __ec; { lock_guard __lock(_M_qmtx); if (_M_queue.top()._M_key == nullptr) // cancelled { __h = std::move(_M_queue.top()._M_h); __ec = std::make_error_code(errc::operation_canceled); _M_queue.pop(); } else if (_M_queue.top()._M_expiry <= _Timer::clock_type::now()) { __h = std::move(_M_queue.top()._M_h); _M_queue.pop(); } } if (__h) { __h(__ec); context().get_executor().on_work_finished(); return true; } return false; } using __timer_id_type = uint64_t; struct __pending_timer { __pending_timer(const _Timer& __t, uint64_t __id, function __h) : _M_expiry(__t.expiry()), _M_key(__t._M_key.get()), _M_id(__id), _M_h(std::move(__h)) { } typename _Timer::time_point _M_expiry; _Key* _M_key; __timer_id_type _M_id; function _M_h; void cancel() { _M_expiry = _M_expiry.min(); _M_key = nullptr; } bool operator<(const __pending_timer& __rhs) const { return _M_expiry < __rhs._M_expiry; } }; struct __queue : priority_queue<__pending_timer> { using iterator = typename priority_queue<__pending_timer>::container_type::iterator; // expose begin/end/erase for direct access to underlying container iterator begin() { return this->c.begin(); } iterator end() { return this->c.end(); } iterator erase(iterator __it) { return this->c.erase(__it); } void _M_sort_to(iterator __it) { std::stable_sort(this->c.begin(), ++__it); } }; __queue _M_queue; __timer_id_type _M_next_id = 0; }; template void async_wait(const _Timer& __timer, _CompletionHandler&& __h) { auto& __queue = use_service<__timer_queue<_Timer>>(*this); __queue.push(__timer, std::move(__h)); _M_reactor._M_notify(); } // Cancel all wait operations initiated by __timer. template size_t cancel(const _Timer& __timer) { if (!has_service<__timer_queue<_Timer>>(*this)) return 0; auto __c = use_service<__timer_queue<_Timer>>(*this).cancel(__timer); if (__c != 0) _M_reactor._M_notify(); return __c; } // Cancel the oldest wait operation initiated by __timer. template size_t cancel_one(const _Timer& __timer) { if (!has_service<__timer_queue<_Timer>>(*this)) return 0; if (use_service<__timer_queue<_Timer>>(*this).cancel_one(__timer)) { _M_reactor._M_notify(); return 1; } return 0; } template void async_wait(int __fd, int __w, _Op&& __op) { lock_guard __lock(_M_mtx); // TODO need push_back, use std::list not std::forward_list auto __tail = _M_ops.before_begin(), __it = _M_ops.begin(); while (__it != _M_ops.end()) { ++__it; ++__tail; } using __type = __async_operation_impl<_Op>; _M_ops.emplace_after(__tail, make_unique<__type>(std::move(__op), __fd, __w)); _M_reactor._M_fd_interest(__fd, __w); } void _M_add_fd(int __fd) { _M_reactor._M_add_fd(__fd); } void _M_remove_fd(int __fd) { _M_reactor._M_remove_fd(__fd); } void cancel(int __fd, error_code&) { lock_guard __lock(_M_mtx); const auto __end = _M_ops.end(); auto __it = _M_ops.begin(); auto __prev = _M_ops.before_begin(); while (__it != __end && (*__it)->_M_is_cancelled()) { ++__it; ++__prev; } auto __cancelled = __prev; while (__it != __end) { if ((*__it)->_M_fd == __fd) { (*__it)->cancel(); ++__it; _M_ops.splice_after(__cancelled, _M_ops, __prev); ++__cancelled; } else { ++__it; ++__prev; } } _M_reactor._M_not_interested(__fd); } struct __async_operation { __async_operation(int __fd, int __ev) : _M_fd(__fd), _M_ev(__ev) { } virtual ~__async_operation() = default; int _M_fd; short _M_ev; void cancel() { _M_fd = -1; } bool _M_is_cancelled() const { return _M_fd == -1; } virtual void run(io_context&) = 0; }; template struct __async_operation_impl : __async_operation { __async_operation_impl(_Op&& __op, int __fd, int __ev) : __async_operation{__fd, __ev}, _M_op(std::move(__op)) { } _Op _M_op; void run(io_context& __ctx) { if (_M_is_cancelled()) _M_op(std::make_error_code(errc::operation_canceled)); else _M_op(error_code{}); } }; atomic _M_work_count; mutable mutex _M_mtx; queue> _M_op; bool _M_stopped = false; struct __monitor { __monitor(io_context& __c) : _M_ctx(__c) { lock_guard __lock(_M_ctx._M_mtx); _M_ctx._M_call_stack.push_back(this_thread::get_id()); } ~__monitor() { lock_guard __lock(_M_ctx._M_mtx); _M_ctx._M_call_stack.pop_back(); if (_M_ctx._M_outstanding_work() == 0) { _M_ctx._M_stopped = true; _M_ctx._M_reactor._M_notify(); } } __monitor(__monitor&&) = delete; io_context& _M_ctx; }; bool _M_do_one(chrono::milliseconds __timeout) { const bool __block = __timeout != chrono::milliseconds::zero(); __reactor::__fdvec __fds; __monitor __mon{*this}; __timer_queue_base* __timerq = nullptr; unique_ptr<__async_operation> __async_op; while (true) { if (__timerq) { if (__timerq->run_one()) return true; else __timerq = nullptr; } if (__async_op) { __async_op->run(*this); // TODO need to unregister __async_op return true; } chrono::milliseconds __ms{0}; { lock_guard __lock(_M_mtx); if (_M_stopped) return false; // find first timer with something to do for (auto __q : _M_timers) { auto __next = __q->_M_next(); if (__next == __next.zero()) // ready to run immediately { __timerq = __q; __ms = __next; break; } else if (__next != __next.max() && __block && (__next < __ms || __timerq == nullptr)) { __timerq = __q; __ms = __next; } } if (__timerq && __ms == __ms.zero()) continue; // restart loop to run a timer immediately if (!_M_ops.empty() && _M_ops.front()->_M_is_cancelled()) { _M_ops.front().swap(__async_op); _M_ops.pop_front(); continue; } // TODO run any posted items if (__block) { if (__timerq == nullptr) __ms = __timeout; else if (__ms.zero() <= __timeout && __timeout < __ms) __ms = __timeout; else if (__ms.count() > numeric_limits::max()) __ms = chrono::milliseconds{numeric_limits::max()}; } // else __ms == 0 and poll() will return immediately } auto __res = _M_reactor.wait(__fds, __ms); if (__res == __reactor::_S_retry) continue; if (__res == __reactor::_S_timeout) if (__timerq == nullptr) return false; else continue; // timed out, so restart loop and process the timer __timerq = nullptr; if (__fds.empty()) // nothing to do return false; lock_guard __lock(_M_mtx); for (auto __it = _M_ops.begin(), __end = _M_ops.end(), __prev = _M_ops.before_begin(); __it != __end; ++__it, ++__prev) { auto& __op = **__it; auto __pos = std::lower_bound(__fds.begin(), __fds.end(), __op._M_fd, [](const auto& __p, int __fd) { return __p.fd < __fd; }); if (__pos != __fds.end() && __pos->fd == __op._M_fd && __pos->revents & __op._M_ev) { __it->swap(__async_op); _M_ops.erase_after(__prev); break; // restart loop and run op } } } } struct __reactor { __reactor() : _M_fds(1) { int __pipe[2]; if (::pipe(__pipe) == -1) __throw_system_error(errno); if (::fcntl(__pipe[0], F_SETFL, O_NONBLOCK) == -1 || ::fcntl(__pipe[1], F_SETFL, O_NONBLOCK) == -1) { int __e = errno; ::close(__pipe[0]); ::close(__pipe[1]); __throw_system_error(__e); } _M_fds.back().events = POLLIN; _M_fds.back().fd = __pipe[0]; _M_notify_wr = __pipe[1]; } ~__reactor() { ::close(_M_fds.back().fd); ::close(_M_notify_wr); } // write a notification byte to the pipe (ignoring errors) void _M_notify() { int __n; do { __n = ::write(_M_notify_wr, "", 1); } while (__n == -1 && errno == EINTR); } // read all notification bytes from the pipe void _M_on_notify() { // Drain the pipe. char __buf[64]; ssize_t __n; do { __n = ::read(_M_fds.back().fd, __buf, sizeof(__buf)); } while (__n != -1 || errno == EINTR); } void _M_add_fd(int __fd) { auto __pos = _M_lower_bound(__fd); if (__pos->fd == __fd) __throw_system_error((int)errc::invalid_argument); _M_fds.insert(__pos, __fdvec::value_type{})->fd = __fd; _M_notify(); } void _M_remove_fd(int __fd) { auto __pos = _M_lower_bound(__fd); if (__pos->fd == __fd) _M_fds.erase(__pos); // else bug! _M_notify(); } void _M_fd_interest(int __fd, int __w) { auto __pos = _M_lower_bound(__fd); if (__pos->fd == __fd) __pos->events |= __w; // else bug! _M_notify(); } void _M_not_interested(int __fd) { auto __pos = _M_lower_bound(__fd); if (__pos->fd == __fd) __pos->events = 0; _M_notify(); } # ifdef _GLIBCXX_HAVE_POLL_H using __fdvec = vector<::pollfd>; // Find first element p such that !(p.fd < __fd) // N.B. always returns a dereferencable iterator. __fdvec::iterator _M_lower_bound(int __fd) { return std::lower_bound(_M_fds.begin(), _M_fds.end() - 1, __fd, [](const auto& __p, int __fd) { return __p.fd < __fd; }); } enum __status { _S_retry, _S_timeout, _S_ok, _S_error }; __status wait(__fdvec& __fds, chrono::milliseconds __timeout) { // XXX not thread-safe! __fds = _M_fds; // take snapshot to pass to poll() int __res = ::poll(__fds.data(), __fds.size(), __timeout.count()); if (__res == -1) { __fds.clear(); if (errno == EINTR) return _S_retry; return _S_error; // XXX ??? } else if (__res == 0) { __fds.clear(); return _S_timeout; } else if (__fds.back().revents != 0) // something changed, restart { __fds.clear(); _M_on_notify(); return _S_retry; } auto __part = std::stable_partition(__fds.begin(), __fds.end() - 1, [](const __fdvec::value_type& __p) { return __p.revents != 0; }); __fds.erase(__part, __fds.end()); return _S_ok; } __fdvec _M_fds; // _M_fds.back() is the read end of the self-pipe #endif int _M_notify_wr; // write end of the self-pipe }; __reactor _M_reactor; vector<__timer_queue_base*> _M_timers; forward_list> _M_ops; vector _M_call_stack; }; inline bool operator==(const io_context::executor_type& __a, const io_context::executor_type& __b) noexcept { // https://github.com/chriskohlhoff/asio-tr2/issues/201 using executor_type = io_context::executor_type; return std::addressof(executor_type(__a).context()) == std::addressof(executor_type(__b).context()); } inline bool operator!=(const io_context::executor_type& __a, const io_context::executor_type& __b) noexcept { return !(__a == __b); } template<> struct is_executor : true_type {}; /// @@} } // namespace v1 } // namespace net } // namespace experimental _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // C++14 #endif // _GLIBCXX_EXPERIMENTAL_IO_SERVICE @ 1.1.1.1 log @initial import of GCC 9.3.0. changes include: - live patching support - shell completion help - generally better diagnostic output (less verbose/more useful) - diagnostics and optimisation choices can be emitted in json - asan memory usage reduction - many general, and specific to switch, inter-procedure, profile and link-time optimisations. from the release notes: "Overall compile time of Firefox 66 and LibreOffice 6.2.3 on an 8-core machine was reduced by about 5% compared to GCC 8.3" - OpenMP 5.0 support - better spell-guesser - partial experimental support for c2x and c++2a - c++17 is no longer experimental - arm AAPCS GCC 6-8 structure passing bug fixed, may cause incompatibility (restored compat with GCC 5 and earlier.) - openrisc support @ text @@ 1.1.1.2 log @initial import of GCC 10.3.0. main changes include: caveats: - ABI issue between c++14 and c++17 fixed - profile mode is removed from libstdc++ - -fno-common is now the default new features: - new flags -fallocation-dce, -fprofile-partial-training, -fprofile-reproducible, -fprofile-prefix-path, and -fanalyzer - many new compile and link time optimisations - enhanced drive optimisations - openacc 2.6 support - openmp 5.0 features - new warnings: -Wstring-compare and -Wzero-length-bounds - extended warnings: -Warray-bounds, -Wformat-overflow, -Wrestrict, -Wreturn-local-addr, -Wstringop-overflow, -Warith-conversion, -Wmismatched-tags, and -Wredundant-tags - some likely C2X features implemented - more C++20 implemented - many new arm & intel CPUs known hundreds of reported bugs are fixed. full list of changes can be found at: https://gcc.gnu.org/gcc-10/changes.html @ text @d3 1 a3 1 // Copyright (C) 2015-2020 Free Software Foundation, Inc. d25 1 a25 1 /** @@file experimental/io_context a26 1 * @@ingroup networking-ts d64 3 a66 2 /** @@addtogroup networking-ts * @@{ d670 4 a673 6 { if (__timerq == nullptr) return false; else continue; // timed out, so restart loop and process the timer } @ 1.1.1.3 log @initial import of GCC 12.3.0. major changes in GCC 11 included: - The default mode for C++ is now -std=gnu++17 instead of -std=gnu++14. - When building GCC itself, the host compiler must now support C++11, rather than C++98. - Some short options of the gcov tool have been renamed: -i to -j and -j to -H. - ThreadSanitizer improvements. - Introduce Hardware-assisted AddressSanitizer support. - For targets that produce DWARF debugging information GCC now defaults to DWARF version 5. This can produce up to 25% more compact debug information compared to earlier versions. - Many optimisations. - The existing malloc attribute has been extended so that it can be used to identify allocator/deallocator API pairs. A pair of new -Wmismatched-dealloc and -Wmismatched-new-delete warnings are added. - Other new warnings: -Wsizeof-array-div, enabled by -Wall, warns about divisions of two sizeof operators when the first one is applied to an array and the divisor does not equal the size of the array element. -Wstringop-overread, enabled by default, warns about calls to string functions reading past the end of the arrays passed to them as arguments. -Wtsan, enabled by default, warns about unsupported features in ThreadSanitizer (currently std::atomic_thread_fence). - Enchanced warnings: -Wfree-nonheap-object detects many more instances of calls to deallocation functions with pointers not returned from a dynamic memory allocation function. -Wmaybe-uninitialized diagnoses passing pointers or references to uninitialized memory to functions taking const-qualified arguments. -Wuninitialized detects reads from uninitialized dynamically allocated memory. -Warray-parameter warns about functions with inconsistent array forms. -Wvla-parameter warns about functions with inconsistent VLA forms. - Several new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. - Several C++20 features have been implemented. - The C++ front end has experimental support for some of the upcoming C++23 draft. - Several new C++ warnings. - Enhanced Arm, AArch64, x86, and RISC-V CPU support. - The implementation of how program state is tracked within -fanalyzer has been completely rewritten with many enhancements. see https://gcc.gnu.org/gcc-11/changes.html for a full list. major changes in GCC 12 include: - An ABI incompatibility between C and C++ when passing or returning by value certain aggregates containing zero width bit-fields has been discovered on various targets. x86-64, ARM and AArch64 will always ignore them (so there is a C ABI incompatibility between GCC 11 and earlier with GCC 12 or later), PowerPC64 ELFv2 always take them into account (so there is a C++ ABI incompatibility, GCC 4.4 and earlier compatible with GCC 12 or later, incompatible with GCC 4.5 through GCC 11). RISC-V has changed the handling of these already starting with GCC 10. As the ABI requires, MIPS takes them into account handling function return values so there is a C++ ABI incompatibility with GCC 4.5 through 11. - STABS: Support for emitting the STABS debugging format is deprecated and will be removed in the next release. All ports now default to emit DWARF (version 2 or later) debugging info or are obsoleted. - Vectorization is enabled at -O2 which is now equivalent to the original -O2 -ftree-vectorize -fvect-cost-model=very-cheap. - GCC now supports the ShadowCallStack sanitizer. - Support for __builtin_shufflevector compatible with the clang language extension was added. - Support for attribute unavailable was added. - Support for __builtin_dynamic_object_size compatible with the clang language extension was added. - New warnings: -Wbidi-chars warns about potentially misleading UTF-8 bidirectional control characters. -Warray-compare warns about comparisons between two operands of array type. - Some new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. - Several C++23 features have been implemented. - Many C++ enhancements across warnings and -f options. see https://gcc.gnu.org/gcc-12/changes.html for a full list. @ text @d3 1 a3 1 // Copyright (C) 2015-2022 Free Software Foundation, Inc. d38 1 a42 1 #include a44 1 #include d93 1 a93 2 #ifdef _GLIBCXX_HAS_GTHREADS lock_guard __lock(_M_ctx->_M_mtx); a96 3 #else return _M_ctx->_M_run_count != 0; #endif d118 1 a118 1 lock_guard __lock(_M_ctx->_M_mtx); d220 1 a220 1 lock_guard __lock(_M_mtx); d227 1 a227 1 lock_guard __lock(_M_mtx); d273 1 a273 1 lock_guard __lock(__ioc._M_mtx); d277 1 a277 1 mutable execution_context::mutex_type _M_qmtx; d299 1 a299 1 lock_guard __lock(_M_qmtx); d308 1 a308 1 lock_guard __lock(_M_qmtx); d330 1 a330 1 lock_guard __lock(_M_qmtx); d349 1 a349 1 lock_guard __lock(_M_qmtx); d370 1 a370 1 lock_guard __lock(_M_qmtx); a472 3 // The caller must know what the wait-type __w will be interpreted. // In the current implementation the reactor is based on // so the parameter must be one of POLLIN, POLLOUT or POLLERR. d477 1 a477 1 lock_guard __lock(_M_mtx); d496 1 a496 1 lock_guard __lock(_M_mtx); d556 1 a556 1 mutable execution_context::mutex_type _M_mtx; d564 1 a564 2 #ifdef _GLIBCXX_HAS_GTHREADS lock_guard __lock(_M_ctx._M_mtx); a565 3 #else _M_ctx._M_run_count++; #endif d570 1 a570 2 #ifdef _GLIBCXX_HAS_GTHREADS lock_guard __lock(_M_ctx._M_mtx); a571 3 #else _M_ctx._M_run_count--; #endif d616 1 a616 1 lock_guard __lock(_M_mtx); d682 1 a682 1 lock_guard __lock(_M_mtx); a702 1 #ifdef _GLIBCXX_HAVE_POLL_H a725 1 #endif d786 1 a786 1 #ifdef _GLIBCXX_HAVE_POLL_H a787 4 #else struct dummy_pollfd { int fd = -1; short events = 0, revents = 0; }; using __fdvec = vector; #endif a802 1 #ifdef _GLIBCXX_HAVE_POLL_H a831 5 #else (void) __timeout; __fds.clear(); return _S_error; #endif d835 1 a843 1 #ifdef _GLIBCXX_HAS_GTHREADS a844 3 #else int _M_run_count = 0; #endif @ 1.1.1.4 log @initial import of GCC 14.3.0. major changes in GCC 13: - improved sanitizer - zstd debug info compression - LTO improvements - SARIF based diagnostic support - new warnings: -Wxor-used-as-pow, -Wenum-int-mismatch, -Wself-move, -Wdangling-reference - many new -Wanalyzer* specific warnings - enhanced warnings: -Wpessimizing-move, -Wredundant-move - new attributes to mark file descriptors, c++23 "assume" - several C23 features added - several C++23 features added - many new features for Arm, x86, RISC-V major changes in GCC 14: - more strict C99 or newer support - ia64* marked deprecated (but seemingly still in GCC 15.) - several new hardening features - support for "hardbool", which can have user supplied values of true/false - explicit support for stack scrubbing upon function exit - better auto-vectorisation support - added clang-compatible __has_feature and __has_extension - more C23, including -std=c23 - several C++26 features added - better diagnostics in C++ templates - new warnings: -Wnrvo, Welaborated-enum-base - many new features for Arm, x86, RISC-V - possible ABI breaking change for SPARC64 and small structures with arrays of floats. @ text @d3 1 a3 1 // Copyright (C) 2015-2024 Free Software Foundation, Inc. a34 2 #include // experimental is currently omitted d149 1 a149 1 io_context(int /* __concurrency_hint */) : _M_work_count(0) { } a562 1 #ifdef _GLIBCXX_HAS_GTHREADS a563 3 #else count_type _M_work_count; #endif @