Re: Full disable of C++20 time zone support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 29 Jun 2023 at 10:16, Alexey Lapshin via Gcc-help
<gcc-help@xxxxxxxxxxx> wrote:
>
> > Which target are you building for?
>
> riscv32-esp-elf
>
> build with gcc v4.9.2
>
> > I think this should fix it:
>
> This brings next errors:
>
>
> gcc/libstdc++-v3/src/c++20/tzdb.cc:157:27: error: 'list_mutex' was not declared in this scope
> gcc/libstdc++-v3/src/c++20/tzdb.cc:158:28: error: 'using std::chrono::tzdb_list::_Node::head_ptr = class std::atomic<std::shared_ptr<std::chrono::tzdb_list::_Node> >' {aka 'class std::atomic<std::shared_ptr<std::chrono::tzdb_list::_Node> >'} has no member named 'get'
>
>
>
> Why it could not be disabled at all? like this:
>
>
> --- a/libstdc++-v3/src/c++20/tzdb.cc
> +++ b/libstdc++-v3/src/c++20/tzdb.cc
> @@ -22,6 +22,8 @@
>  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
>  // <http://www.gnu.org/licenses/>.
>
> +#ifndef TZDB_DISABLED

That macro isn't even defined until later in the file, so would never
be defined at this point.

But more importantly, that would give linker errors when including
<chrono>. The point of that macro is to disable trying to process
tzdata, not to create a broken libstdc++ with missing parts of the
C++20 library. It should always be possible to call
std::chrono::get_tzdb() even if the tzdb only contains the UTC time
zone.

> +
>  // The -Wabi warnings in this file are all for non-exported symbols.
>  #pragma GCC diagnostic ignored "-Wabi"
>
> @@ -2037,3 +2039,5 @@ namespace std::chrono
>    } // namespace
>  #endif // TZDB_DISABLED
>  } // namespace std::chrono
> +
> +#endif
>
>
>
> On Wed, 2023-06-28 at 20:40 +0100, Jonathan Wakely wrote:
> > [External: This email originated outside Espressif]
> >
> >
> > On Wed, 28 Jun 2023 at 20:33, Jonathan Wakely <jwakely@xxxxxxxxxx> wrote:
> > > On Wed, 28 Jun 2023 at 19:42, Alexey Lapshin wrote:
> > > > Hi!
> > > >
> > > > I faced an issue with compiling libstdc++-v3/src/c++20/tzdb.cc:
> > > >
> > > >
> > > > [ERROR]    gcc/libstdc++-v3/src/c++20/tzdb.cc:110:21: error: 'constinit' variable 'std::chrono::{anonymous}::list_mutex' does not have a constant initializer
> > > > [ERROR]    gcc/libstdc++-v3/src/c++20/tzdb.cc:110:21: error: call to non-'constexpr' function 'std::mutex::mutex()'
> > > >
> > > >
> > >
> > >
> > > Which target are you building for?
> > >
> > >
> > > >
> > > > Any plans to create a configure option to disable tzdb from build? Or at least make it compilable?
> > > >
> > > > Tried --with-libstdcxx-zoneinfo=no but it does not take effect, because it does not cover line with the bug.
> > > >
> > >
> > >
> > > Well then we should fix that. We don't want *another* configure option when we already have two for tzdb.
> > >
> >
> >
> > I think this should fix it:
> >
> > --- a/libstdc++-v3/src/c++20/tzdb.cc
> > +++ b/libstdc++-v3/src/c++20/tzdb.cc
> > @@ -43,8 +43,8 @@
> >
> >  #ifndef __GTHREADS
> >  # define USE_ATOMIC_SHARED_PTR 0
> > -#elif _WIN32
> > -// std::mutex cannot be constinit, so Windows must use atomic<shared_ptr<>>.
> > +#elif ! defined __GTHREAD_MUTEX_INIT
> > +// std::mutex cannot be constinit, so must use atomic<shared_ptr<>>.
> >  # define USE_ATOMIC_SHARED_PTR 1
> >  #elif ATOMIC_POINTER_LOCK_FREE < 2
> >  # define USE_ATOMIC_SHARED_PTR 0
> >
> >
>




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux