From 058c0d2786712b47871f25cefa5039a93a7d1f88 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 30 Nov 2002 19:45:07 +0000 Subject: [PATCH] For PR automake/375 (Debian Bug #168671): * automake.in (scan_texinfo_file): Erase all known index files, no matter whether they are used at the top-level or not, because we can never know if they are used in included files. The remaining macros we recognize at the top-level of a Texi document are @defindex, @defcodeindex, @synindex, and @syncodeindex. * tests/texinfo18.test: New file. * tests/Makefile.am (TESTS): Add texinfo18.test. Reported by Simon Richter. --- ChangeLog | 10 +++++++ automake.in | 65 +++++++++++++++-------------------------- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/texinfo18.test | 69 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 41 deletions(-) create mode 100755 tests/texinfo18.test diff --git a/ChangeLog b/ChangeLog index b26bfe06..a246c2d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2002-11-30 Alexandre Duret-Lutz + For PR automake/375 (Debian Bug #168671): + * automake.in (scan_texinfo_file): Erase all known index files, no + matter whether they are used at the top-level or not, because we + can never know if they are used in included files. The remaining + macros we recognize at the top-level of a Texi document are + @defindex, @defcodeindex, @synindex, and @syncodeindex. + * tests/texinfo18.test: New file. + * tests/Makefile.am (TESTS): Add texinfo18.test. + Reported by Simon Richter. + * automake.in (scan_texinfo_file): Honor only the first @setfilename. * tests/texinfo17.test: New file. * tests/Makefile.am (TESTS): Add texinfo17.test. diff --git a/automake.in b/automake.in index 409943a4..3201755b 100755 --- a/automake.in +++ b/automake.in @@ -3649,30 +3649,24 @@ sub scan_texinfo_file { my ($filename) = @_; - # These are always created, no matter whether indexes are used or not. - # (Actually tmp is only created if an @macro is used and a certain e-TeX + # Some of the following extensions are always created, no matter + # whether indexes are used or not. Other (like cps, fns, ... pgs) + # are only created when they are used. We used to scan $FILENAME + # for their use, but that is not enough: they could be used in + # included files. We can't scan included files because we don't + # know the include path. Therefore we always erase these files, + # no matter whether they are used or not. + # + # (tmp is only created if an @macro is used and a certain e-TeX # feature is not available.) - my @clean_suffixes = qw(aux log toc tmp - cp fn ky vr tp pg); # grep new.*index texinfo.tex - - # There are predefined indexes which don't follow the regular rules. - my %predefined_index = qw(c cps - f fns - k kys - v vrs - t tps - p pgs); - - # There are commands which include a hidden index command. - my %hidden_index = (tp => 'tps'); - $hidden_index{$_} = 'fns' foreach qw(fn un typefn typefun max spec - op typeop method typemethod); - $hidden_index{$_} = 'vrs' foreach qw(vr var typevr typevar opt cv - ivar typeivar); - - # Indexes stored into another one. In this case, the *.??s file - # is not created. - my @syncodeindexes = (); + my %clean_suffixes = + map { $_ => 1 } (qw(aux log toc tmp + cp cps + fn fns + ky kys + vr vrs + tp tps + pg pgs)); # grep 'new.*index' texinfo.tex my $texi = new Automake::XFile "< $filename"; verb "reading $filename"; @@ -3701,30 +3695,20 @@ sub scan_texinfo_file $vfile = $1; } - # Try to find what are the indexes which are used. + # Try to find new or unused indexes. # Creating a new category of index. elsif (/^\@def(code)?index (\w+)/) { - push @clean_suffixes, $2; - } - - # Storing in a predefined index. - elsif (/^\@([cfkvtp])index /) - { - push @clean_suffixes, $predefined_index{$1}; - } - elsif (/^\@def(\w+) /) - { - push @clean_suffixes, $hidden_index{$1} - if defined $hidden_index{$1}; + $clean_suffixes{$2} = 1; + $clean_suffixes{"$2s"} = 1; } # Merging an index into an another. elsif (/^\@syn(code)?index (\w+) (\w+)/) { - push @syncodeindexes, "$2s"; - push @clean_suffixes, "$3s"; + delete $clean_suffixes{"$2s"}; + $clean_suffixes{"$3s"} = 1; } } @@ -3737,9 +3721,8 @@ sub scan_texinfo_file my $infobase = basename ($filename); $infobase =~ s/\.te?xi(nfo)?$//; - my %clean_files = map { +"$infobase.$_" => 1 } @clean_suffixes; - grep { delete $clean_files{"$infobase.$_"} } @syncodeindexes; - return ($outfile, $vfile, (sort keys %clean_files)); + return ($outfile, $vfile, + map { "$infobase.$_" } (sort keys %clean_suffixes)); } # ($DIRSTAMP, @CLEAN_FILES) diff --git a/tests/Makefile.am b/tests/Makefile.am index 99d47cb7..19b6c491 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -412,6 +412,7 @@ texinfo10.test \ texinfo13.test \ texinfo16.test \ texinfo17.test \ +texinfo18.test \ transform.test \ unused.test \ vars.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index f4659505..b2cc9fed 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -505,6 +505,7 @@ texinfo10.test \ texinfo13.test \ texinfo16.test \ texinfo17.test \ +texinfo18.test \ transform.test \ unused.test \ vars.test \ diff --git a/tests/texinfo18.test b/tests/texinfo18.test new file mode 100755 index 00000000..d88f8425 --- /dev/null +++ b/tests/texinfo18.test @@ -0,0 +1,69 @@ +#! /bin/sh +# Copyright (C) 2002 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Automake is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with autoconf; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Make sure we clean index files, even if they are not used at the top-level. +# Only *new* indexes need to be declared at the top-level. +# PR/375. + +required='makeinfo tex' +. ./defs || exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am << 'END' +info_TEXINFOS = main.texi +main_TEXINFOS = sub.texi +END + +cat > main.texi << 'END' +\input texinfo +@setfilename main.info +@settitle main +@defindex au +@defindex sa +@defindex sb +@synindex sa sb +@node Top +Hello walls. +@include sub.texi +@bye +END + +cat > sub.texi << 'END' +@cindex foo +foo +@pindex bar +bar +@auindex baz +baz +@saindex sa +sa +@sbindex sb +sb +END + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +./configure +$MAKE distcheck -- 2.43.5