aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorSimon Wright <simon@pushface.org>2023-10-16 14:32:43 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-11-09 14:59:30 +0100
commita80daa2e52ab8fd8a83eec1379b4a5d4187a1162 (patch)
tree6fb64cb957aeff4e0fc9c8cde8b93de994335408 /libcpp
parent1c6d6b34b112b52566ebde49afef3e6eb747ef90 (diff)
downloadgcc-a80daa2e52ab8fd8a83eec1379b4a5d4187a1162.zip
gcc-a80daa2e52ab8fd8a83eec1379b4a5d4187a1162.tar.gz
gcc-a80daa2e52ab8fd8a83eec1379b4a5d4187a1162.tar.bz2
Fix PR ada/111813 (Inconsistent limit in Ada.Calendar.Formatting)
The description of the second Value function (returning Duration) (ARM 9.6.1(87) doesn't place any limitation on the Elapsed_Time parameter's value, beyond "Constraint_Error is raised if the string is not formatted as described for Image, or the function cannot interpret the given string as a Duration value". It would seem reasonable that Value and Image should be consistent, in that any string produced by Image should be accepted by Value. Since Image must produce a two-digit representation of the Hours, there's an implication that its Elapsed_Time parameter should be less than 100.0 hours (the ARM merely says that in that case the result is implementation-defined). The current implementation of Value raises Constraint_Error if the Elapsed_Time parameter is greater than or equal to 24 hours. This patch removes the restriction, so that the Elapsed_Time parameter must only be less than 100.0 hours. 2023-10-15 Simon Wright <simon@pushface.org> PR ada/111813 gcc/ada/ * libgnat/a-calfor.adb (Value (2)): Allow values of parameter Elapsed_Time greater than or equal to 24 hours, by doing the hour calculations in Natural rather than Hour_Number (0 .. 23). Calculate the result directly rather than by using Seconds_Of (whose Hour parameter is of type Hour_Number). If an exception occurs of type Constraint_Error, re-raise it rather than raising a new CE. gcc/testsuite/ * gnat.dg/calendar_format_value.adb: New test.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions