libstdc++: Avoid -Wmaybe-uninitialized warning in std::stop_source [PR109339]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 31 Mar 2023 12:38:14 +0000 (13:38 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 31 Mar 2023 13:20:52 +0000 (14:20 +0100)
commita35e8042fbc7a3eb9cece1fba4cdd3b6cdfb906f
treef9980df9ef35ce9d42deec52edbcc42c0435ed9a
parent10e573e86c6a1ed11df529288ed8fba97f876032
libstdc++: Avoid -Wmaybe-uninitialized warning in std::stop_source [PR109339]

We pass a const-reference to *this before it's constructed, and GCC
assumes that all const-references are accessed. Add the access attribute
to say it's not accessed.

libstdc++-v3/ChangeLog:

PR libstdc++/109339
* include/std/stop_token (_Stop_state_ptr(const stop_source&)):
Add attribute access with access-mode 'none'.
* testsuite/30_threads/stop_token/stop_source/109339.cc: New test.
libstdc++-v3/include/std/stop_token
libstdc++-v3/testsuite/30_threads/stop_token/stop_source/109339.cc [new file with mode: 0644]