Skip to content

Commit

Permalink
Merge branch 'gcc85-overflow' into v2022
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Jul 12, 2024
2 parents 9d1e02b + eae29b3 commit 7394dfc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion parse_date.re
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ static const timelib_relunit* timelib_lookup_relunit(const char **ptr)

static void add_with_overflow(Scanner *s, timelib_sll *e, timelib_sll amount, int multiplier)
{
#if defined(__has_builtin) && __has_builtin(__builtin_saddll_overflow)
#if TIMELIB_HAVE_BUILTIN_SADDLL_OVERFLOW
if (__builtin_saddll_overflow(*e, amount * multiplier, e)) {
add_error(s, TIMELIB_ERR_NUMBER_OUT_OF_RANGE, "Number out of range");
}
Expand Down
10 changes: 10 additions & 0 deletions timelib_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@
# define TIMELIB_BREAK_INTENTIONALLY_MISSING
#endif

#if defined(__has_builtin)
# if __has_builtin(__builtin_saddll_overflow)
# define TIMELIB_HAVE_BUILTIN_SADDLL_OVERFLOW 1
# endif
#endif

#ifndef TIMELIB_HAVE_BUILTIN_SADDLL_OVERFLOW
# define TIMELIB_HAVE_BUILTIN_SADDLL_OVERFLOW 0
#endif

struct _ttinfo
{
int32_t offset;
Expand Down

0 comments on commit 7394dfc

Please sign in to comment.