diff options
author | Dmitriy Anisimkov <anisimko@adacore.com> | 2020-08-06 11:54:48 +0600 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-21 03:22:48 -0400 |
commit | 3c2d338129a5c77a95b1b6d165db0ec328fb1938 (patch) | |
tree | b3f1d35ef21bed7ea6549d022a6222846838f34d /gcc/ada/adaint.c | |
parent | ed9a428d02a5e3cd191aec9421808c5ce8ab7db3 (diff) | |
download | gcc-3c2d338129a5c77a95b1b6d165db0ec328fb1938.zip gcc-3c2d338129a5c77a95b1b6d165db0ec328fb1938.tar.gz gcc-3c2d338129a5c77a95b1b6d165db0ec328fb1938.tar.bz2 |
[Ada] Fix bootstrap with old GCC
gcc/ada/
* adaint.c (__gnat_file_time): Use regular arithmetic instead of
__builtin_*_overflow routines if GCC version 4 or less and
compiler is g++.
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r-- | gcc/ada/adaint.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 9ef0243..b7406a0 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -1503,6 +1503,9 @@ extern long long __gnat_file_time(char* name) t_write.ft_time = fad.ftLastWriteTime; +#if defined(__GNUG__) && __GNUG__ <= 4 + result = (t_write.ll_time - w32_epoch_offset) * 100; +#else /* Next code similar to (t_write.ll_time - w32_epoch_offset) * 100 but on overflow returns LLONG_MIN value. */ @@ -1513,6 +1516,7 @@ extern long long __gnat_file_time(char* name) if (__builtin_smulll_overflow(result, 100, &result)) { return LLONG_MIN; } +#endif #else @@ -1521,6 +1525,12 @@ extern long long __gnat_file_time(char* name) return LLONG_MIN; } +#if defined(__GNUG__) && __GNUG__ <= 4 + result = (sb.st_mtime - ada_epoch_offset) * 1E9; +#if defined(st_mtime) + result += sb.st_mtim.tv_nsec; +#endif +#else /* Next code similar to (sb.st_mtime - ada_epoch_offset) * 1E9 + sb.st_mtim.tv_nsec but on overflow returns LLONG_MIN value. */ @@ -1538,7 +1548,7 @@ extern long long __gnat_file_time(char* name) return LLONG_MIN; } #endif - +#endif #endif return result; } |