On Wed, 21 Oct 2020, Iain Sandoe wrote: > Arnaud Charlet <char...@adacore.com> wrote: > > > > This patch breaks bootstrap on Darwin platforms. > > > > > > Pierre-Marie de Rodat <dero...@adacore.com> wrote: > > > > > > > The modification file time precision now defined by OS. > > > > > > > > Tested on x86_64-pc-linux-gnu, committed on trunk > > > > > > > > gcc/ada/ > > > > > > > > * adaint.c (__gnat_file_time): New routine. > > > > (__gnat_copy_attribs): Copy timestamps in nanoseconds. > > > > * libgnat/a-direct.adb (C_Modification_Time): Bind to > > > > __gnat_file_time. > > > > (Modification_Time): Call to C_Modification_Time.<patch.diff> > > > > > > #if defined(st_mtime) > > > > > > is a necessary test - but the fields in the stat structure on Darwin > > > platforms are > > > named st_{a,c,m}timespec rather than the Linux st_{a,c,m}tim. > > > > What about instead putting above extern long long __gnat_file_time the > > following: > > > > #if __APPLE__ > > #define st_mtim st_mtimespec > > #define st_atim st_atimespec > > #endif > > > > To avoid having the two (nested) #if __APPLE__ and keep the code easier > > to follow? > > works for me (the test patch was drafted quickly to allow bootstrap to > continue) > - I can amend the patch and (re-)test more widely. > > Iain
For future reference, TRT for this kind of problem is to autoconf for the right struct field name, using AC_CHECK_MEMBER or AC_CHECK_MEMBERS (then use e.g. #if HAVE_STAT_ST_MTIM / #if HAVE_STAT_ST_MTIMESPEC, definitely not #if __APPLE__). brgds, H-P