[bug#59991] [PATCH v2 0/3] Port tests to modern C

2023-02-03 Thread Jim Meyering
On Thu, Dec 15, 2022 at 10:19 PM Frederic Berat  wrote:
> From: Frédéric Bérat 
> Hello,
>
> There is ongoing work from both GCC and Clang community to set the C99 
> standard
> as the default one.
> In this context, Fedora packages were rebuilt with some warnings turned as
> errors to simulate the change. This leads to failures in Automake, that are
> attempted to be fixed, mainly in this patchset.
>
> Fred.
>
> Changes from v1:
>   - [PATCH 2/2] has been split in 2, in order to properly detail changes
> related to depcomp.sh. The code is untouched.
>
> ---
> Frédéric Bérat (3):
>   tests: Fix 'type defaults' error in link_cond due to main not being
> properly declared
>   tests: Fix implicit function declaration errors
>   tests: Fix implicit function declaration in ax/depcomp.sh
>
>  t/ax/depcomp.sh  |  4 ++--
>  t/c-demo.sh  |  1 +
>  t/cond35.sh  |  2 ++
>  t/dist-vs-built-sources.sh   |  1 +
>  t/lex-clean.sh   |  1 +
>  t/lex-multiple.sh|  4 
>  t/lex-nodist.sh  |  2 ++
>  t/link_cond.sh   |  2 +-
>  t/ltcond2.sh |  2 ++
>  t/ltconv.sh  |  6 ++
>  t/subobj-clean-lt-pr10697.sh | 10 +-
>  t/subobj-clean-pr10697.sh| 10 +-
>  t/tags-pr12372.sh|  3 ++-
>  t/yacc-basic.sh  |  1 +
>  t/yacc-clean.sh  |  4 
>  t/yacc-nodist.sh |  2 ++
>  16 files changed, 49 insertions(+), 6 deletions(-)

Hi Frederic,
Thanks for the work.
However, neither in this mail, nor in your original did I find a
corresponding patch.
Would you please resend them?

I looked here, too: https://bugs.gnu.org/59991





[bug#60807] [PATCH v2] tests: reuse am_cv_filesystem_timestamp_resolution

2023-02-03 Thread Jim Meyering
On Sat, Jan 14, 2023 at 4:19 PM Mike Frysinger  wrote:
> Rather than assume such coarse delays, re-use existing logic for
> probing the current filesystem resolution.  This speeds up the
> testsuite significantly.  On my system, it speeds -j1 up quite a
> lot -- by ~30%.  While I didn't gather many samples to produce a
> statistically significant distribution, my runs seem to be fairly
> consistent with the values below with deviations of <1 minute.
>
> $ time make -j1
> BeforeAfter
> real  33m17.182s  real  23m33.557s
> user  12m12.145s  user  12m12.763s
> sys   1m52.308s   sys   1m52.853s
>
> $ time make -j32
> BeforeAfter
> real  1m35.874s   real  1m4.908s
> user  14m24.664s  user  15m58.663s
> sys   2m9.297ssys   2m27.393s
>
> * configure.ac: Set test delays to am_cv_filesystem_timestamp_resolution.
> * t/aclocal-no-force.sh: Use slower sleep if subsecond APIs are missing.
> * t/ax/test-defs.in: Split sleep settings into separate variables.
> ---
>  configure.ac  | 10 +-
>  t/aclocal-no-force.sh | 12 
>  t/ax/test-defs.in |  5 ++---
>  3 files changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index dcf2d95566a0..d3a67d5ffec9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -172,15 +172,7 @@ result=no
>  test "x$am_cv_prog_ln" = xln && result=yes
>  AC_MSG_RESULT([$result])
>
> -# The amount we should wait after modifying files depends on the platform.
> -# On Windows '95, '98 and ME, files modifications have 2-seconds
> -# granularity and can be up to 3 seconds in the future w.r.t. the
> -# system clock.  When it is important to ensure one file is older
> -# than another we wait at least 5 seconds between creations.
> -case $build in
> -  *-pc-msdosdjgpp) MODIFICATION_DELAY=5;;
> -  *)   MODIFICATION_DELAY=2;;
> -esac
> +MODIFICATION_DELAY=$am_cv_filesystem_timestamp_resolution
>  AC_SUBST([MODIFICATION_DELAY])
>
>  ## --- ##
> diff --git a/t/aclocal-no-force.sh b/t/aclocal-no-force.sh
> index 3e0c04d12f18..2e139d75cf74 100644
> --- a/t/aclocal-no-force.sh
> +++ b/t/aclocal-no-force.sh
> @@ -19,6 +19,18 @@
>
>  . test-init.sh
>
> +# Automake relies on high resolution timestamps in perl.  If support isn't
> +# available (see lib/Automake/FileUtils.pm), then fallback to coarse sleeps.
> +# The creative quoting is to avoid spuriously triggering a failure in
> +# the maintainer checks.
> +case ${sleep_delay} in
> +0*)
> +  if ! $PERL -e 'use Time::HiRes' 2>/dev/null; then
> +sleep='sleep ''2'
> +  fi
> +  ;;

Thanks, Mike. Thanks for this.
Do you feel like adjusting this in light of Paul's
recent change to require a version of Perl new enough to
always provide Time::HiRes support?

https://git.savannah.gnu.org/cgit/automake.git/commit/?id=01bf65daf6f6627b56fbe78fc436fd877ccd3537





bug#60807: [PATCH 1/2] mtime: use Time::HiRes::stat when available for subsecond resolution

2023-02-03 Thread Jim Meyering
On Sun, Jan 15, 2023 at 12:27 AM Mike Frysinger  wrote:
> On 14 Jan 2023 21:27, Jacob Bachmeyer wrote:
> > Mike Frysinger wrote:
> > > --- a/lib/Automake/FileUtils.pm
> > > +++ b/lib/Automake/FileUtils.pm
> > > @@ -42,6 +42,11 @@ use Exporter;
> > >  use File::stat;
> > >  use IO::File;
> > >
> > > +# Perl's builtin stat does not provide sub-second resolution.  Use 
> > > Time::HiRes
> > > +# if it's available instead.  Hopefully one day perl will update.
> > > +# https://github.com/Perl/perl5/issues/17900
> > > +my $have_time_hires = eval { require Time::HiRes; };
> > > +
> > >  use Automake::Channels;
> > >  use Automake::ChannelDefs;
> > >
> > > @@ -115,10 +120,18 @@ sub mtime ($)
> > >return 0
> > >  if $file eq '-' || ! -f $file;
> > >
> > > -  my $stat = stat ($file)
> > > -or fatal "cannot stat $file: $!";
> > > -
> > > -  return $stat->mtime;
> > > +  if ($have_time_hires)
> > > +{
> > > +  my @stat = Time::HiRes::stat ($file)
> > > +   or fatal "cannot stat $file: $!";
> > > +  return $stat[9];
> > > +}
> > > +  else
> > > +{
> > > +  my $stat = stat ($file)
> > > +   or fatal "cannot stat $file: $!";
> > > +  return $stat->mtime;
> > > +}
> > >  }
> >
> > If you change that variable to a constant, you can eliminate the runtime
> > overhead entirely, since Perl optimizes if(1) and if(0) and folds
> > constants at compile time.
> >
> > Something like:
> >
> > use constant HAVE_Time_HiRes => eval { require Time::HiRes; };
> >
> > Then:
> >
> > if (HAVE_Time_HiRes)
> >...
> >
> > If you do this, Perl will inline the block actually used and elide the
> > branch at runtime.  This is generally useful for any test that can only
> > go one way in a specific run of the program.
>
> thanks, i'll integrate that idea.  i'm by no means a perl programmer.

Thanks, Mike.
It looks like this has been resolved slightly differently by a recent
change from Paul Eggert, so I'm closing this.





[bug#61240] improve high-res file timestamp in Automake

2023-02-03 Thread Paul Eggert

On 2023-02-03 18:27, Jacob Bachmeyer wrote:

Where are you actually using a 5.10 feature?


Where lib/Automake/FileUtils.pm says "use Time::HiRes qw(stat);". This 
does not work with Perl 5.6.


For why we bumped the version to 5.10, please see:

https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=61901a1a14fd50c03cfb1529d091554376fef286


Please do not arbitrarily bump version requirements just to bump version 
requirements.


That's not what was done here. The abovementioned URL says version 
requirements were bumped from 5.6 to 5.10 because the feature is not 
present in 5.6 (2000), is present in 5.10 (2007), and we lacked access 
to the museum pieces in the middle. If you are sure that a version 
number lower than 5.10 will do, please let us know.






[bug#61240] improve high-res file timestamp in Automake

2023-02-03 Thread Jacob Bachmeyer

Paul Eggert wrote:
I installed the attached to port a FileUtils.pm patch back from 
Autoconf into Automake. I wish Perl supported file timestamps with 
nanosecond resolution, but apparently not, so this is the best we 
could do easily.


Although this bumps the required Perl version from 5.6 (2000) to 5.10 
(2007), I don't think that's a problem nowadays.


Where are you actually using a 5.10 feature?  Please do not arbitrarily 
bump version requirements just to bump version requirements.



-- Jacob