[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-09-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

--- Comment #14 from CVS Commits  ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:294d11837367455499786578377c530a0238b6ca

commit r13-7782-g294d11837367455499786578377c530a0238b6ca
Author: Jonathan Wakely 
Date:   Thu Aug 31 18:31:32 2023 +0100

libstdc++: Avoid useless dependency on read_symlink from tzdb

chrono::tzdb::current_zone uses filesystem::read_symlink, which creates
a dependency on the fs_ops.o object in libstdc++.a, which then creates
dependencies on several OS functions if --gc-sections isn't used. For
more details see PR libstdc++/104167 comment 8 and comment 11.

In the cases where that causes linker failures, we probably don't have
readlink anyway, so the filesystem::read_symlink call will always fail.
Repeat the preprocessor conditions for filesystem::read_symlink in the
body of chrono::tzdb::current_zone so that we don't create a
dependency on fs_ops.o for a function that will always fail.

libstdc++-v3/ChangeLog:

* src/c++20/tzdb.cc (tzdb::current_zone): Check configure macros
for POSIX readlink before using filesystem::read_symlink.

(cherry picked from commit f2eb6132c6951edf7960a82828c571a1b98a1a09)

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-09-01 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

--- Comment #13 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:f2eb6132c6951edf7960a82828c571a1b98a1a09

commit r14-3616-gf2eb6132c6951edf7960a82828c571a1b98a1a09
Author: Jonathan Wakely 
Date:   Thu Aug 31 18:31:32 2023 +0100

libstdc++: Avoid useless dependency on read_symlink from tzdb

chrono::tzdb::current_zone uses filesystem::read_symlink, which creates
a dependency on the fs_ops.o object in libstdc++.a, which then creates
dependencies on several OS functions if --gc-sections isn't used. For
more details see PR libstdc++/104167 comment 8 and comment 11.

In the cases where that causes linker failures, we probably don't have
readlink anyway, so the filesystem::read_symlink call will always fail.
Repeat the preprocessor conditions for filesystem::read_symlink in the
body of chrono::tzdb::current_zone so that we don't create a
dependency on fs_ops.o for a function that will always fail.

libstdc++-v3/ChangeLog:

* src/c++20/tzdb.cc (tzdb::current_zone): Check configure macros
for POSIX readlink before using filesystem::read_symlink.

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-08-30 Thread clyon at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

--- Comment #12 from Christophe Lyon  ---
(In reply to Jonathan Wakely from comment #11)

> Please file a separate bug for these failures.

Thanks for the pointers, I digged a bit more, and filed:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111238

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-08-29 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

--- Comment #11 from Jonathan Wakely  ---
My best guess is that including  in those files causes a dependency on
std::chrono::tzdb::current_zone() which depends on
std::filesystem::read_symlink, which will pull in the symbols in
src/c++17/fs_ops.cc

Does arm-eabi build libstdc++.a with -ffunction-sections?

The tests should be built with -Wl,--gc-sections which combined with
-ffunction-sections should mean that the tests do not pull in symbols they
don't need.

I would *really* prefer not to have to split src/c++20/tzdb.cc and
src/c++17/fs_*.cc into dozens of separate files.

Please file a separate bug for these failures.

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-08-28 Thread clyon at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

--- Comment #10 from Christophe Lyon  ---
(In reply to Jonathan Wakely from comment #9)
> (In reply to Christophe Lyon from comment #8)
> > On arm-eabi targets (thus, using newlib), we've noticed new errors:
> 
> New since when? These files haven't changed in the last two weeks.

The bisection pointed to the patch in comment #6.

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-08-28 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

--- Comment #9 from Jonathan Wakely  ---
(In reply to Christophe Lyon from comment #8)
> On arm-eabi targets (thus, using newlib), we've noticed new errors:

New since when? These files haven't changed in the last two weeks.

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-08-28 Thread clyon at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

Christophe Lyon  changed:

   What|Removed |Added

 CC||clyon at gcc dot gnu.org

--- Comment #8 from Christophe Lyon  ---
On arm-eabi targets (thus, using newlib), we've noticed new errors:

FAIL: std/time/clock/gps/io.cc (test for excess errors)
UNRESOLVED: std/time/clock/gps/io.cc compilation failed to produce executable
FAIL: std/time/clock/tai/io.cc (test for excess errors)
UNRESOLVED: std/time/clock/tai/io.cc compilation failed to produce executable

The logs say:
FAIL: std/time/clock/gps/io.cc (test for excess errors)
Excess errors:
ld: /arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(fs_ops.o): in function
`std::filesystem::current_path(std::filesystem::__cxx11::path const&,
std::error_code&)':
/libstdc++-v3/src/c++17/fs_ops.cc:806:(.text._ZNSt10filesystem12current_pathERKNS_7__cxx114pathE+0x10):
undefined reference to `chdir'
ld:
/libstdc++-v3/src/c++17/fs_ops.cc:806:(.text._ZNSt10filesystem12current_pathERKNS_7__cxx114pathERSt10error_code+0x6):
undefined reference to `chdir'
ld: /arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(fs_ops.o): in function
`(anonymous namespace)::create_dir(std::filesystem::__cxx11::path const&,
std::filesystem::perms, std::error_code&)':
/libstdc++-v3/src/c++17/fs_ops.cc:583:(.text._ZN12_GLOBAL__N_110create_dirERKNSt10filesystem7__cxx114pathENS0_5permsERSt10error_code+0xa):
undefined reference to `mkdir'
ld: /arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(fs_ops.o): in function
`std::filesystem::create_directory(std::filesystem::__cxx11::path const&,
std::error_code&)':
/libstdc++-v3/src/c++17/fs_ops.cc:583:(.text._ZNSt10filesystem16create_directoryERKNS_7__cxx114pathERSt10error_code+0xe):
undefined reference to `mkdir'
ld: /arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(fs_ops.o): in function
`std::filesystem::permissions(std::filesystem::__cxx11::path const&,
std::filesystem::perms, std::filesystem::perm_options, std::error_code&)':
/libstdc++-v3/src/c++17/fs_ops.cc:1134:(.text._ZNSt10filesystem11permissionsERKNS_7__cxx114pathENS_5permsENS_12perm_optionsERSt10error_code+0x7c):
undefined reference to `chmod'
ld:
/libstdc++-v3/src/c++17/fs_ops.cc:1134:(.text._ZNSt10filesystem11permissionsERKNS_7__cxx114pathENS_5permsENS_12perm_optionsERSt10error_code+0x9c):
undefined reference to `chmod'
ld: /arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(fs_ops.o): in function
`std::filesystem::current_path[abi:cxx11](std::error_code&)':
/libstdc++-v3/src/c++17/fs_ops.cc:750:(.text._ZNSt10filesystem12current_pathB5cxx11ERSt10error_code+0x22):
undefined reference to `pathconf'
ld:
/libstdc++-v3/src/c++17/fs_ops.cc:769:(.text._ZNSt10filesystem12current_pathB5cxx11ERSt10error_code+0x54):
undefined reference to `getcwd'
ld: /arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(fs_ops.o): in function
`std::filesystem::do_copy_file(char const*, char const*,
std::filesystem::copy_options_existing_file, stat*, stat*, std::error_code&)':
/libstdc++-v3/src/c++17/../filesystem/ops-common.h:553:(.text._ZNSt10filesystem12do_copy_fileEPKcS1_NS_26copy_options_existing_fileEP4statS4_RSt10error_code+0x114):
undefined reference to `chmod'
collect2: error: ld returned 1 exit status


BTW I noticed the same error messages for other tests (eg.
std/time/clock/gps/1.cc)

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-08-11 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

Jonathan Wakely  changed:

   What|Removed |Added

   Target Milestone|13.3|14.0
 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Jonathan Wakely  ---
Fixed for GCC 14

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-08-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:ce6c4d3b4d336493cab128795467d832cb04c9ee

commit r14-3165-gce6c4d3b4d336493cab128795467d832cb04c9ee
Author: Jonathan Wakely 
Date:   Fri Jul 21 17:19:08 2023 +0100

libstdc++: Implement C++20 std::chrono::parse [PR104167]

This adds the missing C++20 features to .

I've implemented my proposed resolutions to LWG issues 3960, 3961, and
3962. There are some unimplemented flags such as %OI which I think are
not implementable in general. It might be possible to use na_llanginfo
with ALT_DIGITS, but that isn't available on all targets. I intend to
file another LWG issue about that.

libstdc++-v3/ChangeLog:

PR libstdc++/104167
* include/bits/chrono_io.h (operator|=, operator|): Add noexcept
to _ChronoParts operators.
(from_stream, parse): Define new functions.
(__detail::_Parse, __detail::_Parser): New class templates.
* include/std/chrono (__cpp_lib_chrono): Define to 201907L for
C++20.
* include/std/version (__cpp_lib_chrono): Likewise.
* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc:
Adjust expected value of feature test macro.
* testsuite/20_util/duration/io.cc: Test parsing.
* testsuite/std/time/clock/file/io.cc: Likewise.
* testsuite/std/time/clock/gps/io.cc: Likewise.
* testsuite/std/time/clock/system/io.cc: Likewise.
* testsuite/std/time/clock/tai/io.cc: Likewise.
* testsuite/std/time/clock/utc/io.cc: Likewise.
* testsuite/std/time/day/io.cc: Likewise.
* testsuite/std/time/month/io.cc: Likewise.
* testsuite/std/time/month_day/io.cc: Likewise.
* testsuite/std/time/weekday/io.cc: Likewise.
* testsuite/std/time/year/io.cc: Likewise.
* testsuite/std/time/year_month/io.cc: Likewise.
* testsuite/std/time/year_month_day/io.cc: Likewise.
* testsuite/std/time/syn_c++20.cc: Check value of macro and for
the existence of parse and from_stream in namespace chrono.
* testsuite/std/time/clock/local/io.cc: New test.
* testsuite/std/time/parse.cc: New test.

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-07-28 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167
Bug 104167 depends on bug 110719, which changed state.

Bug 110719 Summary: Should chrono formatters always use std::time_put for 
locale's representation?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110719

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-07-27 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|13.2|13.3

--- Comment #5 from Richard Biener  ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-07-10 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167
Bug 104167 depends on bug 110504, which changed state.

Bug 110504 Summary: std::format("{:%S}", duration>(4)) 
returns "02.0" instead of "02"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110504

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |INVALID

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2023-04-26 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|13.0|13.2

--- Comment #4 from Richard Biener  ---
GCC 13.1 is being released, retargeting bugs to GCC 13.2.

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2022-12-22 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

--- Comment #3 from Jonathan Wakely  ---
Time zones committed as r13-4853-g9fc61d45fa15fd

Formatting committed as r13-4856-gf99b94865fa629

Still missing std::chrono::parse.

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2022-11-13 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

--- Comment #2 from Jonathan Wakely  ---
Patch for time zones and incomplete formatting support:
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605926.html

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2022-11-12 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

--- Comment #1 from Jonathan Wakely  ---
Clocks are done in r13-3937-g1736bf5a61c736

Time zones and chrono I/O still missing.

[Bug libstdc++/104167] Implement C++20 std::chrono::utc_clock, std::chrono::tzdb etc.

2022-04-28 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104167

Jonathan Wakely  changed:

   What|Removed |Added

   Target Milestone|--- |13.0
 Ever confirmed|0   |1
   Last reconfirmed||2022-04-28
   Assignee|unassigned at gcc dot gnu.org  |redi at gcc dot gnu.org
 Status|UNCONFIRMED |ASSIGNED