[committed] libstdc++: Do not include <system_error> in concurrency headers

Jonathan Wakely jwakely@redhat.com
Fri Jan 13 16:39:28 GMT 2023


On Fri, 13 Jan 2023 at 15:08, Rainer Orth wrote:
>
> Hi Jonathan,
>
> > The <condition_variable>, <mutex>, and <shared_mutex> headers use
> > std::errc constants, but don't use std::system_error itself. They only
> > use the __throw_system_error(int) function, which is defined in
> > <bits/functexcept.h>.
> >
> > By including the header for the errc constants instead of the whole of
> > <system_error> we avoid depending on the whole std::string definition.
>
> it seems this patch broke many tests on Solaris, e.g.
>
> FAIL: 29_atomics/atomic/requirements/types_neg.cc (test for excess errors)
> Excess errors:
> /var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/libstdc++-v3/include/bits/std_mutex.h:157: error: 'EBUSY' was not declared in this scope
>

Oops, testing this patch now.
-------------- next part --------------
commit 58e6fe334e55f56eeb0211c10697be4d4a8c52b6
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jan 13 16:37:57 2023

    libstdc++: Add <errno.h> to <bits/std_mutex.h>
    
    This needs to be included explicitly now that we don't include all of
    <system_error> here.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/std_mutex.h: Include <errno.h>.

diff --git a/libstdc++-v3/include/bits/std_mutex.h b/libstdc++-v3/include/bits/std_mutex.h
index bc515358d23..f74ddc4123a 100644
--- a/libstdc++-v3/include/bits/std_mutex.h
+++ b/libstdc++-v3/include/bits/std_mutex.h
@@ -36,6 +36,7 @@
 # include <bits/c++0x_warning.h>
 #else
 
+#include <errno.h> // EBUSY
 #include <bits/functexcept.h>
 #include <bits/gthr.h>
 


More information about the Libstdc++ mailing list